PIC18F4550 Interface with DHT11 sensor and Nokia 5110 LCD

This small tutorial shows how to interface PIC18F4550 microcontroller with Nokia 5110 LCD and DHT11 humidity and temperature sensor. The values of temperature (in degree Celsius) and humidity (in relative humidity percent, rH%) are displayed on the Nokia 5110 LCD which has a resolution of 84 x 48 pixel.
The compiler used in this project is CCS PIC C.

Last time I made a simple interfacing of the PIC18F4550 MCU and the Nokia 5110 LCD, link is below:
Interfacing PIC18F4550 MCU with NOKIA 5110 LCD

and to see how to interface the PIC18F4550 MCU with the DHT11 sensor for the first time, visit the following post:
Interfacing PIC18F4550 with DHT11 humidity and temperature sensor

Hardware Required:

  • PIC18F4550 microcontroller
  • Nokia 5110 (3310) LCD module
  • DHT11 (RHT01) humidity and temperature sensor   —->  datasheet
  • AMS1117 3V3 voltage regulator
  • 10 uF capacitor
  • 100 nF ceramic capacitor
  • 5 x 3.3k ohm resistor
  • 5 x 2.2k ohm resistor
  • 4.7k ohm resistor
  • 5V source
  • Breadboard
  • Jumper wires

Interfacing PIC18F4550 with DHT11 sensor Nokia 5110 LCD circuit:
The following image shows project circuit diagram.

PIC18F4550 DHT11 Nokia 5110 LCD circuit

All the grounded terminals are connected together.

The DHT11 sensor has 4 pins (from left to right):
VCC: connected to circuit +5V
data pin: connected to PIC18F4550 pin RB2 (#35)
not connected pin
GND: connected to circuit ground (0V).

The Nokia 5110 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 works with 3.3V only (power supply and control lines). The LCD module is supplied with 3.3V which comes from the AMS1117 3V3 voltage regulator, this regulator steps down the 5V into 3.3V.

To connect the PIC18F4550 to the LCD module, I used voltage divider for each line which means there are 5 voltage dividers. Each voltage divider consists of 2.2k and 3.3k resistors, this drops the 5V into 3V which is sufficient.

Therefore, the Nokia 5110 LCD pins are connected to PIC18F4550 MCU as follows (each one through voltage divider):
RST (reset) pin is connected to pin RD0 (#19)
CE (chip enable) pin is connected to pin RD1 (#20)
DC (data/command) pin is connected to pin RD2 (#21)
DIN (data in)  pin is connected to pin RC7 (#26)
CLK (clock) pin is connected to pin RB1 (#34)

VCC and BL are connected to AMS1117 3V3 regulator output pin and GND is connected to circuit ground (0V).

In this project the PIC18F4550 uses its internal oscillator and MCLR pin function is disabled.

Interfacing PIC18F4550 with DHT11 sensor Nokia 5110 LCD C code:
The C code below is for CCS C compiler, it was tested with version 5.051.

To be able to compile project C code, a driver for the Nokia 5110 LCD is required, download link is below. After you download the driver file which named NOKIA5110.c, add it to your project folder:
Nokia 5110 LCD driver for CCS C compiler

Connection of LCD reset, chip select and data/command pin are defined in the code as:

And the DHT11 data pin is defined as:

Rest of code is described through comments!

Full CCS C code:

My simple protoboard circuit result is shown below:

PIC18F4550 MCU with Nokia 5110 LCD and DHT11 sensor

Proteus simulation of this project should give the same result as shown in the following video where Arduino UNO is used instead of the PIC18F4550 microcontroller:

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