Interfacing PIC18F4550 with Nokia 5110 LCD and DHT22 sensor

This is another project that shows how to interface PIC18F4550 microcontroller with Nokia 5110 (Nokia 3310) LCD and how to use its library.
In this project the Nokia 5110 LCD (84 x 48 pixel) is used to display temperature (in degree Celsius) and humidity (in relative humidity percent, rH%) where DHT22 (equivalent to AM2302) digital humidity and temperature sensor is used.
The compiler used in this project is CCS PIC C.

To see how to interface the PIC18F4550 with the Nokia 5110 for the first time, visit the post below:
Interfacing PIC18F4550 MCU with NOKIA 5110 LCD

and to see how to interface the PIC18F4550 MCU with the DHT22 sensor, take a look at this post:
PIC18F4550 Interface with DHT22(AM2302) sensor + Proteus simulation

Hardware Required:

  • PIC18F4550 microcontroller
  • Nokia 5110 (3310) LCD module
  • DHT22 (AM2302) 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

PIC18F4550 with Nokia 5110 LCD and DHT22 sensor circuit:
The following image shows project circuit diagram.

PIC18F4550 Nokia 5110 DHT22 AM2302 circuit

All the grounded terminals are connected together.

The DHT22 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 DHT22 data pin is defined as:

Rest of code is described through comments!

Full CCS C code:

My simple protoboard circuit gave the following result:

PIC18F4550 with Nokia 5110 LCD and DHT22 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:


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