esphome-docs/components/sensor/dht.rst

91 lines
3.8 KiB
ReStructuredText
Raw Normal View History

2018-05-13 11:37:02 +02:00
DHT Temperature+Humidity Sensor
===============================
2018-11-14 22:12:27 +01:00
.. seo::
:description: Instructions for setting up DHT11 and DHT22 temperature and humidity sensors.
:image: dht.jpg
2022-04-26 01:32:02 +02:00
:keywords: DHT11, DHT21, DHT22, AMS2301, AM2302, RHT03, SI7021
2018-11-14 22:12:27 +01:00
The DHT Temperature+Humidity sensor allows you to use your
- DHT11 (`datasheet <https://akizukidenshi.com/download/ds/aosong/DHT11.pdf>`__, `Adafruit <https://www.adafruit.com/product/386>`__),
- DHT21/DHT22 (`datasheet <https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf>`__, `Adafruit <https://www.adafruit.com/product/385>`__),
- AMS2301/AM2302 (`datasheet <https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf>`__, `Adafruit <https://www.adafruit.com/product/393>`__),
- RHT03 (`datasheet <https://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf>`__, `SparkFun <https://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf>`__) and
- SI7021 (one wire Sonoff version) (`datasheet <https://cdn.sparkfun.com/assets/b/1/b/8/5/Si7021-A20.pdf>`__, `SparkFun <https://cdn.sparkfun.com/assets/b/1/b/8/5/Si7021-A20.pdf>`__)
2019-02-16 23:25:23 +01:00
sensors with ESPHome.
2018-05-13 11:37:02 +02:00
.. figure:: images/dht-full.jpg
2018-05-14 21:15:49 +02:00
:align: center
:width: 50.0%
2018-05-13 11:37:02 +02:00
DHT22 Temperature & Humidity Sensor.
2018-05-13 11:37:02 +02:00
.. _Adafruit: https://www.adafruit.com/product/385
2018-06-03 23:20:14 +02:00
The DHT22 and DHT11 require external pull up resistors on the data line. To do this, solder
a resistor with *about* 4.7kΩ (anything in the range from 1kΩ to 10kΩ probably works fine, but
if you're having issues try the 4.7kΩ recommended by the manufacturer) between ``DATA`` and ``3.3V``.
2018-06-01 18:10:00 +02:00
.. figure:: images/temperature-humidity.png
:align: center
2018-05-14 21:15:49 +02:00
:width: 80.0%
2018-05-13 11:37:02 +02:00
.. code-block:: yaml
2018-05-13 11:37:02 +02:00
# Example configuration entry
sensor:
- platform: dht
pin: D2
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
2019-01-06 18:56:14 +01:00
update_interval: 60s
2018-05-13 11:37:02 +02:00
Configuration variables:
2018-08-24 22:44:01 +02:00
------------------------
2018-05-13 11:37:02 +02:00
2018-06-01 18:10:00 +02:00
- **pin** (**Required**, :ref:`config-pin`): The pin where the DHT bus is connected.
- **temperature** (**Required**): The information for the temperature sensor.
- **name** (**Required**, string): The name for the temperature sensor.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
2019-02-17 12:28:17 +01:00
- All other options from :ref:`Sensor <config-sensor>`.
2018-06-01 18:10:00 +02:00
- **humidity** (**Required**): The information for the humidity sensor
- **name** (**Required**, string): The name for the humidity sensor.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
2019-02-17 12:28:17 +01:00
- All other options from :ref:`Sensor <config-sensor>`.
2018-06-01 18:10:00 +02:00
- **model** (*Optional*, int): Manually specify the DHT model, can be
one of ``AUTO_DETECT``, ``DHT11``, ``DHT22``, ``DHT22_TYPE2``, ``AM2302``, ``RHT03``, ``SI7021``
2019-02-02 11:44:41 +01:00
and helps with some connection issues. Defaults to ``AUTO_DETECT``. Auto detection doesn't work for the SI7021 chip.
2018-06-01 18:10:00 +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-05-14 21:15:49 +02:00
.. note::
2022-11-28 10:06:10 +01:00
The default ``accuracy_decimals`` value of the *humidity* levels is ``0``, as the DHT11 for which this was
originally written does not have a higher resolution. All other DHT sensors have a higher resolution, it's worth
to configure them with ``accuracy_decimals: 1``.
2019-02-27 18:32:47 +01:00
If you're seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the
DHT model with the ``model:`` configuration variable. Other problems could be wrong pull-up resistor values
on the DATA pin or too long cables.
2018-06-01 18:10:00 +02:00
See Also
2018-08-24 22:44:01 +02:00
--------
2018-06-01 18:10:00 +02:00
- :ref:`sensor-filters`
- :doc:`dht12`
- :doc:`hdc1080`
- :doc:`htu21d`
- :doc:`sht3xd`
2019-05-12 22:44:59 +02:00
- :apiref:`dht/dht.h`
2018-08-24 22:44:01 +02:00
- `Arduino DHTLib <https://playground.arduino.cc/Main/DHTLib>`__
- :ghedit:`Edit`