Skip to main content

ESP8266 + DHT22 + Arduino + Web Server

So here is a modified version of how to get a DHT22 working on ESP8266 NodeMcu board using the Arduino IDE (not Lua)

The project is based on:
http://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide/

  1. Get the components and assemble them. In India you can find these on VishaWorld.com
    1. NodeMcu ESP8266 | Link
    2. DHT22 | 
    3. Male-Male Jumper Wires | 
    4. Bread Board | Link
    5. MicroUSB cable | 
  2. Assemble the circuit as shown. Connect the Data pin of SHT22 to D2 of NodeMcu (which is referred to pin 4 in Arduino IDE)
  3. Install the driver for USB-Serial chip on your PC:
    http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx
  4. Install Arduino on your computer and install support for ESP8266 Board, refer:
    https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/installing-the-esp8266-arduino-addon
  5. Install the DHT-sensor-library-master library as outlined here:
    http://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide/
  6. You would need to download and place Adafruit_Sensor.h in this same library folder as well. Get that file from: https://github.com/adafruit/Adafruit_Sensor/blob/master/Adafruit_Sensor.h
    Click on "Raw" to get the file.
  7. Copy the code below, and download it into your ESP8266 NodeMcu board. Make sure to select the proper board and COM port.
To test:
  1. Connect your mobile to the WiFi hotspot created by ESP8266 : Temperature_Server
    Password is: vishaworld.com
  2. Make sure to turn off the 3G data connection on your phone. Andorid will report that the wifi network "Temperature_Server" does not provide internet access. Ignore the message.
  3. Open chrome and punch in 10.10.10.10 in the URL field and ESP8266 will serve you with the latest reading from the temperature sensor.




Comments