Sunday, 06 March 2016 00:09

Nokia 5110 LCD on Raspberry Pi

Written by 
Rate this item
(1 Vote)

Raspberry Pi and a Nokia 5110 LCD

Wiring, Configuring, and Testing a Nokia 5110 LCD on the Pi

$3 monochrome LCD's for feedback, information, and real-time stats installed on a raspberry pi

I wanted a simple LCD screen to use in some upcomming projects I have planned for the Pi.  The nokia 5110 is a cheap, monochorme LCD that can fit in many cases with minor modifications, and can display more information than a 16x2 LCD screen.



There are many wiring diagrams out there, but there are a few things that are important to note

  • The Nokia 5110 LCD uses 3.3V (and not 5V)
  • The first 26 pins on the Raspberry Pi 1 and Raspberry Pi 2 header layouts are the same (Raspberry Pi 2 header has additional 14 pins which makes up a total of 40 pin header)
  • The backlight on the Nokia 5110 LCD (labeled LED/LIGHT) needs a connection to GROUND or VCC(3.3V) depending on where you purchased the LCD.  You can also connect this to a GPIO to enable you to turn the backlight on/off from your code.  You'll need a series resistor of around 300 ohms (maybe less if your board already includes these as many do. 

The last one is especially important, as many diagrams out there show to tie VCC (3.3V) to the LED pin, which may work for some LCDs but others require a Ground connection.  You can either leave it open (for no backlight, which I did) or tie it to GROUND (or 3.3V depending on your model) or to a GPIO with a series resistor of around 300 ohms.  I discuss this in further detail in an article Nokia 5110 LCD Backlight To Ground Using GPIO if you want to learn more about figuring out what resistor value is needed, and adding control for it in your python code.

Unless you are well experienced at soldering, I would recommend to use either a full female header connector or wires with female pins already attached that can easily slip over the header pins.  These are available at a very low cost on eBay (search for female jumper wires).


- Raspberry Pi Pins to Nokia 5110 LCD

Raspberry Pi (Physical Pins)
18 GPIO 24
24 SPI_CE0
16 GPIO 23
1 VCC 3.3V
11 GPIO 17
5110 LCD



nokia-5110-lcd-raspberry-pi 03*See the article Nokia 5110 LCD Backlight To Ground Using GPIO if want to wire in the backlight to a GPIO.


Installing Prerequisites

We'll be using python to interact with our Nokia 5110 LCD.  There are a few things we need to install prior to being able to interact with the LCD.

Install some prerequisites

sudo apt-get update
sudo apt-get install python-pip python-dev build-essential python-imaging git

Install RPi.GPIO to allow python programs to interact with the GPIOs

sudo pip install RPi.GPIO


Enable Hardware SPI on Raspberry Pi

SPI is the protocol we use to communicate with the LCD.  On the Raspbian image, hardware SPI is disabled by default.  Some distributions you may need to edit the blacklist.conf file and comment out spi-bcm2708, but with latest Raspbian image (jessie), we need to edit /boot/config.txt (this can also be done using the raspi-config interface)

sudo nano /boot/config.txt

Scroll down and uncomment (remove the #) dtparam=spi=on . Ctrl+x and y to save and exit

nokia-5110-lcd-raspberry-pi 02


You will need to reboot

sudo reboot

after reboot, you can confirm the spi module is loaded with

lsmod | grep "spi_bcm*"

nokia-5110-lcd-raspberry-pi 01


Install the Nokia 5110 LCD Library

There are a few different python libraries written for the Nokia 5110 LCD.  I decided to use adafruit's library as it seems to be popular.

Clone and setup the library's git

git clone
cd Adafruit_Nokia_LCD
sudo python install


Testing the Nokia 5110 LCD

Goto to the Adafruit/examples directory

cd Adafruit_Nokia_LCD/examples/

If you wired the LCD to the Raspberry Pi as shown above, the wiring setup in the python examples will be the same, if not, you will have to edit the example files to match your particular situation.  You may need to adjust the contrast (default it is set to 60, one of my display's worked better at a value of 40 and another at 55)  The lower the value, the less black the entire screen is.  So if you don't see anything, try to turn up the contrast.  The value is set by variable disp.begin(contrast=40)


Run the example program from inside the examples directory

sudo python

nokia-5110-lcd-raspberry-pi 04 





Raspberry Pi Image: 2015-11-21-raspbian-jessie.img

cat /etc/*-release: Raspbian GNU/Linux 8 (jessie)

Python: Python 2.7.9





Read 34415 times Last modified on Thursday, 17 March 2016 20:18
Algis Salys

Creator and owner of  Linux enthusiast, electronics tinkerer, and likes to spend time in the workshop building and creating new projects.