Search

NodeMCU Temp/Humidity Sensor

Posted 7 months ago - 2 min read

Connect a DHT22 temperature/humidity sensor to an ESP8266 (NodeMCU) and display the values to a self-hosted webpage.

Part List

Setup

  1. Download and install the latest version of Arduino.
  2. Open esp8266-dh22.ino using Arduino.
  3. Open preferences and include the additional board manager url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Open board manager and search for and install esp8266.
  5. Select select your compatabible esp8266 board and verify COM port
  6. Using the library manager, search for and install DHT sensor library by Adafruit and PageBuilder by Hieromon Ikasamo.
  7. Update code to use desired credentials for wifi.
  8. Verify, compile and upload code to ESP8266.

Testing

  1. After uploading the code to ESP8266, open the serial monitor.
  2. Make note of the IP address listed for the device.
  3. Verify temperature and humidity readings are displayed to the serial monitor.
  4. Open a browser and navigate to the IP address of the device.
  5. You should see the temperature and humidity values printed to the webpage.

Wiring

DHT22 ESP8266 Wiring Diagram

Built-in web server display

Temperature and humidity reading displayed on a built-in webserver hosted by the esp8266


Will Makes
Projects in electronics, 3D printing and programming.