Jump to content

Component: Colour Sensor (Grove 101020341) (101020341) (Light): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable""
Line 73: Line 73:


===CalculateLux===
===CalculateLux===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 87: Line 87:


===CalculateTemp===
===CalculateTemp===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 101: Line 101:


===ClearInterrupt===
===ClearInterrupt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 115: Line 115:


===ControlInterrupt===
===ControlInterrupt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 144: Line 144:


===DisableSensor===
===DisableSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 158: Line 158:


===EnableSensor===
===EnableSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 172: Line 172:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 186: Line 186:


===ReadDataChannel===
===ReadDataChannel===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 205: Line 205:


===SampleSensor===
===SampleSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 219: Line 219:


===SetGain===
===SetGain===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 238: Line 238:


===SetIntegrationTime===
===SetIntegrationTime===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Line 258: Line 258:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]

Revision as of 14:15, 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. 
- UINT Return


CalculateTemp

CalculateTemp
Uses the RGB values stored in RAM from the last Sample to calculate the colour temperature in degrees Kelvin. 
- UINT Return


ClearInterrupt

ClearInterrupt
Clears the interrupt flag allowing the device to interrupt again. 
- VOID Return


ControlInterrupt

ControlInterrupt
Enables or Disables the Interrupt pin to fire when the light levels are inside the interrupt limits. 
- BYTE Enable
Range: 0 to 1 - 0=Interrupt Off / 1=Interrupt On 
- UINT LowLevel
 
- UINT HighLevel
 
- VOID Return


DisableSensor

DisableSensor
Powers down the device to save power. 
- VOID Return


EnableSensor

EnableSensor
Powers up the device ready for taking colour readings. 
- VOID 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. 
- VOID Return


ReadDataChannel

ReadDataChannel
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. 
- BYTE ColourChannel
Range: 0 to 3 - 0=Red, 1=Green, 2=Blue, 3=Clear 
- UINT Return


SampleSensor

SampleSensor
Reads the raw colour channels from the sensor and stores the readings into RAM to be collected by the ReadDataChannel macro. 
- VOID Return


SetGain

SetGain
Controls the gain. 0x00 = 1X 0x01 = 4X 0x02 = 16X 0x03 = 60X 
- BYTE Setting
Range: 0 to 3 
- VOID Return


SetIntegrationTime

SetIntegrationTime
Controls the integration time. 0 = 700mS / 1 = 154mS / 2 = 101mS / 3 = 50mS / 4 = 24mS / 5 = 2.4mS 
- BYTE Setting
Range: 0 to 5 
- VOID Return


Property reference

Properties
Sensor Settings
Integration Time
Length of time period used to sample the sensor frequency (longer is more accurate) 
Gain
Length of time period used to sample the sensor frequency (longer is more accurate) 
Connections
Channel
Channel selection 
Mode
Defines if the component will be used for Master or Slave communications. Master mode supports a software bitbanged I2C channel. Slave mode requires a hardware I2C peripheral to catch the communications from the Master. 
SDA
Pin used for SDA (data signal) 
SDA Remap Pin
 
SCL
Pin used for SCL (clock signal) 
SCL Remap Pin
 
Simulation
Simulation Type
Selects the simulation type for the component. Component GUI - Interacts with the panel to sense the colour of a object in close proximity to the sensor. I2C Injector - Performs the I2C commands allowing you to connect an injector component or view and debug the I2C communications. 

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