Temperature and humidity reading from RHT03 (also known as DHT22) using ESP8266 WeMos D1 mini board.

As many other examples available on the internet, it was inevitably to post myself a temperature and humidity reading application.

The values from sensors are displayed on the mobile phone, using Blynk IoT framework.

Ingredients:

ESP8266 WeMos D1 mini board

IMG_20160219_131333

RHT03 temperature and humidity sensor

rht03-dht22 sensor
Sensor specifications:

  • 3.3-6V Input
  • Humidity from 0-100% RH, ±2% RH accuracy
  • -40 – 80 degrees C temperature range,±0.5 degrees C

source: http://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf

Details here: https://learn.adafruit.com/dht

Download and install DHT22 arduino library into your Arduino IDE. The library is available here: https://github.com/adafruit/DHT-sensor-library

dht library arduino

Blynk knowledge and blynk app installed on your android or iphone.

blynk

Breadboard and wires

400_points_breadboard

Ok, let’s put this ingredients into one “bowl”, like this

esp8266-dht22-temperature-breadboard

Connect the data pin of the sensor to GPIO2 (marked as D4) which already has an internal 10k pull-up resistor.

 

Change your BlynkAuthWiFiNetworkWiFiPassword to your settings.

This program generate a serial output like this:

esp-utput serial

 

The blynk app has a gauge, a value display and a history graph item

 

updated 2019.01.30


BOM used in this article:


ESP8266: DHT22 temperature sensor
Tagged on:                         

4 thoughts on “ESP8266: DHT22 temperature sensor

  • February 3, 2017 at 16:09
    Permalink

    This is EXACTLY what I needed!
    Many thanks for documenting this so good.

    Reply
    • February 3, 2017 at 16:12
      Permalink

      Still working right now in my home.
      Glad it helps!

      I’ve added a loop of 3 times readings from the sensor (with a pause of 3 seconds) if I get a fail reading from the sensor.

      Reply
  • February 17, 2017 at 06:42
    Permalink

    Thank you. This is one of the best well expleined instructions. Is this code suitable for ESP8266 only (without WeMos D1 mini board) if we program the ESP8266 module via CP2102 USB UART Board (mini)? I want to miniaturize the setup that is why I am asking:)

    Reply
    • February 17, 2017 at 10:03
      Permalink

      Thanks for reading.
      This instructions and my knowledges are gathered from many sources. You cand find many instructables with this setup.

      To answer on you question, yes, you can use this code on any ESP8266 module. The only mention is that to check if the board/module you have has an internal pull-up resistor on D4 pin (for this example).
      If you are using any other digital pin, the reading of the sensor will also be ok.
      Here is an example with nodemcu board
      https://blog.squix.org/2016/01/esp8266-weather-station-measuring.html
      Join us on facebook group “ESP8266” to get specific answers.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.