2018-06-01 18:10:00 +02:00
|
|
|
TEMT6000
|
|
|
|
========
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
2019-02-16 23:25:23 +01:00
|
|
|
:description: Instructions for setting up TEMT6000 ambient light sensors in ESPHome using the ADC sensor component.
|
2018-11-14 22:12:27 +01:00
|
|
|
:image: temt6000.jpg
|
|
|
|
:keywords: TEMT6000
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
The TEMT6000 is a simple and cheap ambient light sensor. The sensor itself
|
|
|
|
changes its resistance based on how much light hits the sensor. In order
|
|
|
|
for us to read this resistance the breakout boards you can buy these chips on
|
|
|
|
often have a small constant value resistor and three pins: ``GND``, ``VCC`` and
|
|
|
|
``SIG``. Connect ``VCC`` to ``3.3V``, ``GND`` to ``GND`` and ``SIG`` to any
|
2019-02-07 13:54:45 +01:00
|
|
|
available :doc:`analog pin </components/sensor/adc>`.
|
2018-06-01 18:10:00 +02:00
|
|
|
|
2018-06-07 14:54:11 +02:00
|
|
|
.. figure:: images/temt6000-header.jpg
|
|
|
|
:align: center
|
|
|
|
:width: 75.0%
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
To get the brightness the sensor measures, we then simply have to measure the voltage
|
2019-02-07 13:54:45 +01:00
|
|
|
on the ``SIG`` (also called ``OUT``) pin using the :doc:`/components/sensor/adc`
|
2018-06-07 14:54:11 +02:00
|
|
|
and convert those voltage measurements to illuminance values in lux using a formula:
|
2018-06-01 18:10:00 +02:00
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-06-01 18:10:00 +02:00
|
|
|
|
2018-06-07 11:18:06 +02:00
|
|
|
sensor:
|
|
|
|
- platform: adc
|
2018-06-01 18:10:00 +02:00
|
|
|
pin: A0
|
|
|
|
name: "TEMT6000 Illuminance"
|
2021-08-05 08:29:45 +02:00
|
|
|
device_class: illuminance
|
2018-06-07 11:18:06 +02:00
|
|
|
unit_of_measurement: lx
|
2018-06-01 18:10:00 +02:00
|
|
|
filters:
|
2019-01-06 18:56:14 +01:00
|
|
|
- lambda: |-
|
2018-06-01 18:10:00 +02:00
|
|
|
return (x / 10000.0) * 2000000.0;
|
|
|
|
|
2018-06-07 14:54:11 +02:00
|
|
|
.. figure:: images/temt6000-pins.jpg
|
|
|
|
:align: center
|
|
|
|
:width: 75.0%
|
|
|
|
|
|
|
|
Pins on the TEMT6000. Connect ``OUT`` to an ADC pin, ``GND`` to ``GND``, and ``VCC``
|
|
|
|
to ``3.3V``
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
Formula Explanation:
|
2018-08-24 22:44:01 +02:00
|
|
|
--------------------
|
2018-06-01 18:10:00 +02:00
|
|
|
|
|
|
|
To get the illuminance in lux, we first need to convert the measured voltage to the
|
|
|
|
current flowing across the TEMT6000 sensor. This current is also equal to the current
|
|
|
|
flowing across the 10kΩ resistor in the voltage divider circuit, which is
|
|
|
|
``I = adc_value/10000kΩ``.
|
|
|
|
|
|
|
|
The `datasheet for the TEMT6000 <https://www.sparkfun.com/datasheets/Sensors/Imaging/TEMT6000.pdf>`__
|
|
|
|
specifies a proportional correlation between current and illuminance: Every 2 µA of current
|
|
|
|
correlates to 1 lx in the illuminance.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The default voltage range of the ADC for the ESP8266 and ESP32 are from 0 to 1.0V.
|
|
|
|
So you won't be able to measure any value above 200 lx using the default setup.
|
|
|
|
|
|
|
|
For the ESP32, you have the option of setting a :ref:`Voltage Attenuation <adc-esp32_attenuation>`
|
|
|
|
(note that the formula doesn't need to be adjusted if you set an attenuation, as the value ``x``
|
|
|
|
is automatically converted to volts).
|
|
|
|
|
|
|
|
For the ESP8266, you unfortunately need to tinker with the hardware a bit to decrease
|
|
|
|
the voltage a bit. So one option would be to create another voltage divider on the ``SIG`` pin
|
|
|
|
to divide the analog voltage by a constant value.
|
|
|
|
|
|
|
|
See Also
|
2018-08-24 22:44:01 +02:00
|
|
|
--------
|
2018-06-01 18:10:00 +02:00
|
|
|
|
2019-02-07 13:54:45 +01:00
|
|
|
- :doc:`/components/sensor/adc`
|
2018-06-01 18:10:00 +02:00
|
|
|
- `TEMT6000 datasheet <https://www.sparkfun.com/datasheets/Sensors/Imaging/TEMT6000.pdf>`__
|
|
|
|
- :doc:`bruh`
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|