2021-02-13 01:21:13 +01:00
# DHT Temperature/Humidity sensor usermod
This usermod will read from an attached DHT22 or DHT11 humidity and temperature sensor.
2022-12-10 16:12:55 +01:00
The sensor readings are displayed in the Info section of the web UI (and optionally sent to an MQTT broker).
2021-02-13 01:21:13 +01:00
2022-12-10 16:12:55 +01:00
If sensor is not detected after 10 update intervals, the usermod will be disabled.
2021-02-13 01:21:13 +01:00
2022-12-10 16:12:55 +01:00
If enabled, measured temperature and humidity will be published to the following MQTT topics
2022-10-20 01:02:52 +02:00
* `{devceTopic}/dht/temperature`
* `{devceTopic}/dht/humidity`
2021-02-13 01:21:13 +01:00
## Installation
Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini` .
### Define Your Options
2022-12-10 16:12:55 +01:00
* `USERMOD_DHT` - define this to include this user mod wled00\usermods_list.cpp
2021-02-13 01:21:13 +01:00
* `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22
* `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board
2022-12-10 16:12:55 +01:00
* `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported
* `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60000 ms
* `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90000 ms
* `USERMOD_DHT_MQTT` - publish measurements to an MQTT broker
2021-02-13 01:21:13 +01:00
* `USERMOD_DHT_STATS` - For debug, report delay stats
## Project link
* [QuinLED-Dig-Uno ](https://quinled.info/2018/09/15/quinled-dig-uno/ ) - Project link
### PlatformIO requirements
If you are using `platformio_override.ini` , you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dht_C` . If not, you can add the libraries and dependencies into `platformio.ini` as you see fit.
## Change Log
2022-10-20 01:02:52 +02:00
2022-10-15
2022-12-10 16:12:55 +01:00
* Add ability to publish sensor readings to an MQTT broker
2022-10-20 01:02:52 +02:00
* fix compilation error for sample [env:d1_mini_usermod_dht_C] task
2021-02-13 01:21:13 +01:00
2020-02-04
* Change default QuinLed pin to Q2
2022-12-10 16:12:55 +01:00
* Instead of trying to keep updates at constant cadence, space out readings by measurement interval. Hopefully, this helps eliminate occasional bursts of readings with errors
2021-02-13 01:21:13 +01:00
* Add some more (optional) stats
2020-02-03
* Due to poor readouts on ESP32 with previous DHT library, rewrote to use https://github.com/alwynallan/DHT_nonblocking
2022-10-20 01:02:52 +02:00
* The new library serializes/delays up to 5ms for the sensor readout
2020-02-02
2021-02-13 01:21:13 +01:00
* Created