Fork me on GitHub

Project Notes

#343 Sensors/DHT11

Reading temperature and humidity with a DHT11 sensor and ESP-01, coding with ESP8266 core for Arduino.

Build

Notes

The DHT11 sensor is a very cheap and common sensor that provides readings of:

  • relative humidity: 20-80% ±5%
  • temperature: 0-50°C ±2°C

I’ve used this before with an Arduino - see LEAP#301. This time I’m testing with the most basic ESP8266 board - an ESP-01, which exposes one free GPIO.

Programming Setup

I’m using a LEAP#194 DIYDevBoard to host the ESP-01 module, and a cheap CH340G-based USB to UART adapter. With the correct drivers installed, it shows up in the tty device list.

My host computer is running MacOSX.

Required Libraries

I’m using ESP8266 core with the Arduino IDE, and the Adafruit sensor library to interface with the DHT11:

These need to be installed in the Arduino IDE.

Test Sketch

The DHT11.ino sketch simply reads the sensor every 2 seconds and outputs the readings to the serial port.

Here is a test run:

console_output

Construction

Breadboard

Schematic

Build

Credits and References

About LEAP#343 ESP8266Sensors

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader