Interface DHT 11 Sensor with ESP8266
Interface DHT 11 Sensor with ESP8266 (Node MCU)
Before that a brief overview of DHT 11
DHT11 sensor consists of a capacitive humidity sensing element and a thermistor for sensing temperature. The humidity sensing capacitor has two electrodes with a moisture-holding substrate as a dielectric between them. Change in the capacitance value occurs with the change in humidity levels. The IC measure, process these changed resistance values and change them into digital form
Let’s Start
✘ Connect Vcc pin of the sensor to 3V3 pin of Node MCU.
✘ Connect GND pin of the sensor to GND pin of Node MCU.
✘ Connect signal pin of the sensor to D5 pin of Node MCU.
Install DHT Library.
Go to menu Sketch – Include Library -Manage Library
Program
Go to menu File >> Example >> DHT sensor library >>
DHT_Unified_Sensor
Interface sensors with Node MCU.
- Comment the 20th line in the code.
- Uncomment the 19th line in the code.
- Change the pin number from 2 to 5 in 14th line of the code.