Component: Colour Sensor (Grove 101020341) (101020341) (Light): Difference between revisions
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable"" |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 75: | Line 75: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CalculateLux''' | ||
|- | |- | ||
| colspan="2" | Uses the RGB values stored in RAM from the last Sample to calculate the luminance in lux. | | colspan="2" | Uses the RGB values stored in RAM from the last Sample to calculate the luminance in lux. | ||
| Line 89: | Line 89: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CalculateTemp''' | ||
|- | |- | ||
| colspan="2" | Uses the RGB values stored in RAM from the last Sample to calculate the colour temperature in degrees Kelvin. | | colspan="2" | Uses the RGB values stored in RAM from the last Sample to calculate the colour temperature in degrees Kelvin. | ||
| Line 103: | Line 103: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClearInterrupt''' | ||
|- | |- | ||
| colspan="2" | Clears the interrupt flag allowing the device to interrupt again. | | colspan="2" | Clears the interrupt flag allowing the device to interrupt again. | ||
| Line 117: | Line 117: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ControlInterrupt''' | ||
|- | |- | ||
| colspan="2" | Enables or Disables the Interrupt pin to fire when the light levels are inside the interrupt limits. | | colspan="2" | Enables or Disables the Interrupt pin to fire when the light levels are inside the interrupt limits. | ||
| Line 146: | Line 146: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''DisableSensor''' | ||
|- | |- | ||
| colspan="2" | Powers down the device to save power. | | colspan="2" | Powers down the device to save power. | ||
| Line 160: | Line 160: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''EnableSensor''' | ||
|- | |- | ||
| colspan="2" | Powers up the device ready for taking colour readings. | | colspan="2" | Powers up the device ready for taking colour readings. | ||
| Line 174: | Line 174: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Initialise the sensor configuration as set by the component properties. Sets the default intigration time and gain as well as enable the sensor. | | colspan="2" | Initialise the sensor configuration as set by the component properties. Sets the default intigration time and gain as well as enable the sensor. | ||
| Line 188: | Line 188: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadDataChannel''' | ||
|- | |- | ||
| colspan="2" | Returns the value of the selected colour channel from the last sample. The Red, Green and Blue channels have a colour filter to remove light of other colours. The Clear channel has no filter allowing the ambient light level to be easily collected. | | colspan="2" | Returns the value of the selected colour channel from the last sample. The Red, Green and Blue channels have a colour filter to remove light of other colours. The Clear channel has no filter allowing the ambient light level to be easily collected. | ||
| Line 207: | Line 207: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SampleSensor''' | ||
|- | |- | ||
| colspan="2" | Reads the raw colour channels from the sensor and stores the readings into RAM to be collected by the ReadDataChannel macro. | | colspan="2" | Reads the raw colour channels from the sensor and stores the readings into RAM to be collected by the ReadDataChannel macro. | ||
| Line 221: | Line 221: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetGain''' | ||
|- | |- | ||
| colspan="2" | Controls the gain. 0x00 = 1X 0x01 = 4X 0x02 = 16X 0x03 = 60X | | colspan="2" | Controls the gain. 0x00 = 1X 0x01 = 4X 0x02 = 16X 0x03 = 60X | ||
| Line 240: | Line 240: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetIntegrationTime''' | ||
|- | |- | ||
| colspan="2" | Controls the integration time. 0 = 700mS / 1 = 154mS / 2 = 101mS / 3 = 50mS / 4 = 24mS / 5 = 2.4mS | | colspan="2" | Controls the integration time. 0 = 700mS / 1 = 154mS / 2 = 101mS / 3 = 50mS / 4 = 24mS / 5 = 2.4mS | ||
| Line 260: | Line 260: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Sensor Settings | ||
|- | |- | ||
|- | |- | ||
| Line 278: | Line 278: | ||
| colspan="2" | Length of time period used to sample the sensor frequency (longer is more accurate) | | colspan="2" | Length of time period used to sample the sensor frequency (longer is more accurate) | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 312: | Line 312: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:37, 13 July 2026
| Author | Matrix TSL |
| Version | 8.0 |
| Category | Light |
Colour Sensor (Grove 101020341) component
Based on the color sensor TCS34725FN with digital output I2C. Based on the 8*2 array of filtered photodiodes and 16-bits analog-to-digital converters, you can gain the color chromaticity of ambient light or the color of objects. Of the 16 photodiodes, 4 have red filters, 4 have green filters, 4 have blue filters and 4 have no filter(clear). With the synchronization input pin, external pulsed light source can provides precise synchronous conversion control.
Version information
Library Version, Component Version, Date, Author, Info 8, 0.0, 27-06-25, MW, Not working on ESP32, changed I2C to transaction functions
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
CalculateLux
| CalculateLux | |
| Uses the RGB values stored in RAM from the last Sample to calculate the luminance in lux. | |
| Return | |
CalculateTemp
| CalculateTemp | |
| Uses the RGB values stored in RAM from the last Sample to calculate the colour temperature in degrees Kelvin. | |
| Return | |
ClearInterrupt
| ClearInterrupt | |
| Clears the interrupt flag allowing the device to interrupt again. | |
| Return | |
ControlInterrupt
DisableSensor
| DisableSensor | |
| Powers down the device to save power. | |
| Return | |
EnableSensor
| EnableSensor | |
| Powers up the device ready for taking colour readings. | |
| Return | |
Initialise
| Initialise | |
| Initialise the sensor configuration as set by the component properties. Sets the default intigration time and gain as well as enable the sensor. | |
| Return | |
ReadDataChannel
SampleSensor
| SampleSensor | |
| Reads the raw colour channels from the sensor and stores the readings into RAM to be collected by the ReadDataChannel macro. | |
| Return | |
SetGain
| SetGain | |
| Controls the gain. 0x00 = 1X 0x01 = 4X 0x02 = 16X 0x03 = 60X | |
| Setting | |
| Range: 0 to 3 | |
| Return | |
SetIntegrationTime
| SetIntegrationTime | |
| Controls the integration time. 0 = 700mS / 1 = 154mS / 2 = 101mS / 3 = 50mS / 4 = 24mS / 5 = 2.4mS | |
| Setting | |
| Range: 0 to 5 | |
| Return | |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Colour_Sensor_I2C_Grove.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Colour_Sensor_I2C_Grove.fcfx