2018-08-22 22:05:28 +02:00
|
|
|
TCS34725 RGB Color Sensor
|
|
|
|
=========================
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
|
|
|
:description: Instructions for setting up TCS34725 RGB color sensors.
|
|
|
|
:image: tcs34725.jpg
|
|
|
|
:keywords: tcs34725
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
The ``tcs34725`` sensor platform allows you to use your TCS34725 RGB color sensors
|
|
|
|
(`datasheet <https://cdn-shop.adafruit.com/datasheets/TCS34725.pdf>`__,
|
2019-10-13 18:07:33 +02:00
|
|
|
`Adafruit`_), color temperature and illuminance sensors with ESPHome. The :ref:`I²C <i2c>` is
|
2018-08-22 22:05:28 +02:00
|
|
|
required to be set up in your configuration for this sensor to work.
|
|
|
|
|
2022-08-16 06:08:16 +02:00
|
|
|
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`.
|
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
.. figure:: images/tcs34725-full.jpg
|
|
|
|
:align: center
|
|
|
|
:width: 50.0%
|
|
|
|
|
|
|
|
TCS34725 RGB Color Sensor
|
|
|
|
|
|
|
|
.. _Adafruit: https://www.adafruit.com/product/1334
|
|
|
|
|
|
|
|
.. figure:: images/tcs34725-ui.png
|
|
|
|
:align: center
|
|
|
|
:width: 80.0%
|
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
# 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"
|
|
|
|
gain: 1x
|
|
|
|
integration_time: 2.4ms
|
2021-10-13 18:45:58 +02:00
|
|
|
glass_attenuation_factor: 1.0
|
2018-08-22 22:05:28 +02:00
|
|
|
address: 0x29
|
2019-01-06 18:56:14 +01:00
|
|
|
update_interval: 60s
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
Configuration variables:
|
2018-08-24 22:44:01 +02:00
|
|
|
------------------------
|
2018-08-22 22:05:28 +02:00
|
|
|
|
2022-01-24 23:42:06 +01:00
|
|
|
- **red_channel** (*Optional*): Value of the red color channel relative to the clear channel, as a percentage.
|
2019-02-17 12:28:17 +01:00
|
|
|
All options from :ref:`Sensor <config-sensor>`.
|
2022-01-24 23:42:06 +01:00
|
|
|
- **green_channel** (*Optional*): Value of the green color channel relative to the clear channel, as a percentage.
|
2019-02-17 12:28:17 +01:00
|
|
|
All options from :ref:`Sensor <config-sensor>`.
|
2022-01-24 23:42:06 +01:00
|
|
|
- **blue_channel** (*Optional*): Value of the blue color channel relative to the clear channel, as a percentage.
|
2019-02-17 12:28:17 +01:00
|
|
|
All options from :ref:`Sensor <config-sensor>`.
|
2022-01-24 23:42:06 +01:00
|
|
|
- **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 :ref:`Sensor <config-sensor>`.
|
2018-08-22 22:05:28 +02:00
|
|
|
- **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
|
2022-05-12 06:53:37 +02:00
|
|
|
values are ``1x`` (default), ``4x``, ``16x``, ``60x`` (highest gain). Will be overwritten if auto integration time
|
|
|
|
is used
|
2018-08-22 22:05:28 +02:00
|
|
|
- **integration_time** (*Optional*): The amount of time the light sensor is exposed. Valid values are
|
2022-05-12 06:53:37 +02:00
|
|
|
``auto`` (default), ``2.4ms``, ``24ms``, ``50ms``, ``101ms``, ``120ms``, ``154ms``, ``180ms``, ``199ms``,
|
2021-10-13 18:45:58 +02:00
|
|
|
``240ms``, ``300ms``, ``360ms``, ``401ms``, ``420ms``, ``480ms``, ``499ms``, ``540ms``, ``600ms``, ``614ms``.
|
|
|
|
- **glass_attenuation_factor** (*Optional*): The attenuation factor of glass if it's behind some glass facia.
|
|
|
|
Default is ``1.0`` means ``100%`` transmissivity. ``2`` means ``50%`` transmissivity etc.
|
2020-11-09 02:22:55 +01:00
|
|
|
- **address** (*Optional*, int): Manually specify the I²C address of the sensor. Defaults to ``0x29``.
|
2018-08-22 22:05:28 +02:00
|
|
|
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
|
2019-01-06 18:56:14 +01:00
|
|
|
sensor. Defaults to ``60s``.
|
2018-08-22 22:05:28 +02:00
|
|
|
|
2022-05-12 06:53:37 +02:00
|
|
|
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:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
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.
|
2022-01-24 23:42:06 +01:00
|
|
|
|
2018-08-22 22:05:28 +02:00
|
|
|
See Also
|
2018-08-24 22:44:01 +02:00
|
|
|
--------
|
2018-08-22 22:05:28 +02:00
|
|
|
|
|
|
|
- :ref:`sensor-filters`
|
2018-08-24 22:44:01 +02:00
|
|
|
- `TCS34725 library <https://github.com/adafruit/Adafruit_TCS34725>`__ by `Adafruit <https://www.adafruit.com/>`__
|
2019-05-12 22:44:59 +02:00
|
|
|
- :apiref:`tcs34725/tcs34725.h`
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|