TCS34725 RGB Color Sensor¶
tcs34725 sensor platform allows you to use your TCS34725 RGB color sensors
Adafruit), color temperature and illuminance sensors with ESPHome. The I²C is
required to be set up in your configuration for this sensor to work.
Note: If the integration_time is set too long for the light conditions, the sensor will overexpose. In this case the sensor may not show 100% on its clear channel. With an integration_time of 614ms and a gain of 1x the sensor will max out at around 4100 lx. In this case the individual color channels will show 100%, the clear channel 25%. The illumination in lux is shown as 0 as well as the color temperature in kelvin will show 0.
# Example configuration entry sensor: - platform: tcs34725 red_channel: name: "TCS34725 Red Channel" green_channel: name: "TCS34725 Green Channel" blue_channel: name: "TCS34725 Blue Channel" clear_channel: name: "TCS34725 Clear Channel" illuminance: name: "TCS34725 Illuminance" color_temperature: name: "TCS34725 Color Temperature" glass_attenuation_factor: 1.0 address: 0x29 update_interval: 60s
red_channel (Optional): Value of the red color channel relative to the clear channel, as a percentage. All options from Sensor.
green_channel (Optional): Value of the green color channel relative to the clear channel, as a percentage. All options from Sensor.
blue_channel (Optional): Value of the blue color channel relative to the clear channel, as a percentage. All options from Sensor.
clear_channel (Optional): Value of the clear (without a color filter) channel, relative to the maximum value for the chosen integration time. All options from Sensor.
illuminance (Optional): Get the total illuminance of the sensor in lx.
color_temperature (Optional): Get the calculated color temperature of the light in Kelvin.
gain (Optional): Set the gain for the internal ADCs to work better in certain low-light conditions. Valid values are
60x(highest gain). Will be overwritten if auto integration time is used
integration_time (Optional): The amount of time the light sensor is exposed. Valid values are
glass_attenuation_factor (Optional): The attenuation factor of glass if it’s behind some glass facia. Default is
address (Optional, int): Manually specify the I²C address of the sensor. Defaults to
update_interval (Optional, Time): The interval to check the sensor. Defaults to
For many applications, you can use AUTO timing or leave integration time empty to have the ESP select a suitable gain setting based on the previous measurement. If light levels change dramatically this may cause the next reading to saturate, after which the gain will adjust down and subsequent readings will be in range. If auto is used in a dynamic environment an update rate of 1 second is best. Filters can be used to throttle the output and prevent updates of marginal changes like:
illuminance: name: "TCS34725 Illuminance" filters: - or: - delta: 50 - throttle: 60sec
When using integration times lower than 154ms the accuracy of the sensor drops with no further gain in possible light accumulation. Use faster timings only if fast readout is necessary with stable light conditions recommended.