ESP8266 NodeMCU interfacing with DHT11 sensor and SSD1306

This Simple Projects post shows how to interface the ESP8266 NodeMCU development board with DHT11 digital humidity & temperature sensor and SSD1306 OLED display (128×64 Pixel).
The NodeMCU reads temperature and relative humidity values from the DHT11 sensor and prints it on Arduino IDE serial monitor and the SSD1306 OLED display.

The SSD1306 OLED used in this post projects is configured to work in I2C mode, some SSD1306 OLED boards may require a small hardware modifications (to select between SPI mode or I2C mode) such as soldering, placing jumpers ….

Related Projects:
To see how to connect the SSD1306 OLED with NodeMCU board see the following post:
ESP8266 NodeMCU interfacing with SSD1306 OLED
Arduino interfacing with DHT11 sensor and LCD
Interfacing NodeMCU with DHT22 sensor and SSD1306 OLED

ESP-12E NodeMCU with DHT11 sensor and SSD1306 OLED display

Hardware Required:

  • NodeMCU development board
  • SSD1306 OLED screen (128×64 Pixel)
  • DHT11 temperature and humidity sensor
  • 4.7k ohm resistor
  • Micro USB cable (for programming and powering the whole circuit)
  • Breadboard
  • Jumper wires

ESP8266 NodeMCU interfacing with DHT11 sensor circuit:
Project circuit schematic diagram is shown below.

ESP8266 NodeMCU DHT11 SSD1306 OLED circuit

and the second image shows fritzing breadboard circuit:

ESP8266 NodeMCU SSD1306 OLED DHT11 fritzing circuit

The SDA and SCL lines of the I2C bus come from GPIO4 (D2) and GPIO0 (D3) of the NodeMCU board (respectively), they are connected to SDA and SCL (SCK) pins of the SSD1306 display module.
Reset pin (RES) of the display module is connected to GPIO5 (D1) of the NodeMCU development board.

The DHT11 sensor has 4 pins (from left to right): VCC, data pin, NC (not connected pin) and GND. The data pin is connected to pin D5 (GPIO14). A pull-up resistor of 4.7k ohm is required for the data pin.

The SSD1306 display module and the DHT11 sensor are supplied with 3.3V which comes from the NodeMCU board.

ESP8266 NodeMCU interfacing with DHT11 sensor code:
In this project i used two libraries from Adafruit: the first one is for the SSD1306 OLED display and the second is for the DHT11 sensor.
Adafruit library for DHT series (after extracting put the folder named DHT in the library folder of Arduino):

Leave a Comment

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.

Scroll to Top