ESP8266 NodeMCU with Nokia 5110 LCD and DHT11 Sensor

This Simple Projects post shows how to interface ESP8266 NodeMCU development board (ESP-12E) with DHT11 digital humidity & temperature sensor and Nokia 5110 LCD.
The NodeMCU reads temperature and relative humidity values from the DHT11 (RHT01) sensor and prints them (respectively in °C and RH%) on the Nokia 5110 LCD display which has a resolution of 84×48 pixel.

To see how to interface NodeMCU board with Nokia 5110 LCD, visit this post:
Interfacing ESP8266 NodeMCU with Nokia 5110 LCD

There are two types of the DHT11 sensor: old type (AOSONG) and new type (ASAIR). The differences between the 2 types are summarized below:

DHT11 ASAIR VS AOSONG
DHT11 ASAIR VS AOSONG

Seeed Studio provides a good module of the new DHT11 sensor (ASAIR version) named “Grove Temperature & Humidity Sensor”, more details in its official page:
Grove Temperature & Humidity Sensor

Hardware Required:

  • NodeMCU development board
  • Nokia 5110 LCD module
  • DHT11 (RHT01) humidity and temperature sensor   —->  datasheet
  • 4.7k ohm resistor
  • Micro USB cable (for programming and powering the whole circuit)
  • Breadboard
  • Jumper wires

NodeMCU with Nokia 5110 LCD and DHT11 sensor circuit:
The image below shows project circuit diagram.

The DHT11 sensor has 4 pins (from left to right):
Pin 1 is power supply pin, connected NodeMCU 3V3 pin,
Pin 2: data output pin, connected to NodeMCU digital pin 5 (D5),
Pin 3: not connected pin,
Pin 4: GND (ground), connected to NodeMCU GND pin.

ESP8266 NodeMCU DHT11 Nokia 5110 LCD circuit

The Nokia 5110 LCD which is shown in the circuit diagram has 8 pins (from left to right): RST (reset), CE (chip enable), DC (or D/C: data/command), Din (data in), Clk (clock), VCC (3.3V), BL (back light) and Gnd (ground).

The Nokia 5110 LCD is connected to the NodeMCU board as follows:
RST (reset) pin is connected to pin D0 (ESP8266EX GPIO16),
CE (chip enable) pin is connected to pin D1 (ESP8266EX GPIO5),
DC (data/command) pin is connected to pin D2 (ESP8266EX GPIO4),
DIN (data in)  pin is connected to pin D3 (ESP8266EX GPIO0),
CLK (clock) pin is connected to pin D4 (ESP8266EX GPIO2),
VCC and BL are connected to pin 3V3,
GND is connected to pin GND.

NodeMCU with Nokia 5110 LCD and DHT11 sensor code:
The following Arduino code requires 3 libraries from Adafruit Industries:
The first library is a driver for the Nokia 5110 LCD (PCD8544 controller), download link is below:
Adafruit Nokia 5110 LCD library

The 2nd library is Adafruit graphics library which can be downloaded from the following link
Adafruit graphics library             —->  direct link

The 3rd one is for the DHT11 sensor:
Adafruit DHT library                  —->   direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library files.

The previous 3 libraries (and Arduino SPI library) are included in the main code as follows:

Definition of sensor type, its data pin connection and the initialization of the DHT library:

Rest of code is described through comments.

Full Arduino code:

ESP8266 NodeMCU with Nokia 5110 LCD and DHT11 sensor


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

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