Thursday, 17 March 2016 01:00

Nokia 5110 LCD Backlight To Ground Using GPIO

Written by 
Rate this item
(0 votes)

Nokia 5110 LCD Backlight that requires ground

Use GPIO on Raspberry Pi to turn it on and off

Many times the Nokia 5110 LCD backlight is turned on with 3.3V (a current source), but many of the low cost LCDs from eBay are wired as common anode, meaning you need to apply a Ground (a current sink) in order to light the backlight.

Lighting LED Backlight from Pi GPIO

Your LCD display backlght requires either 3.3V or a Ground connection at the LIGHT connection, depends on where it was manufactured.  Most of the lower cost Nokia 5110 LCDs I've bought from eBay require a Ground.  You can find out by using the DIODE measurement on your multimeter, or just by wiring the LCD as shown here.

To use a multimeter, take 2 measurements, measure between the backlight and ground, and measure between backlight to VCC, and see which one turns on the backlight. (You may have to flip the meter leads as well).


Connect the backlight to a GPIO on the Raspberry Pi to allow control from your program to turn the backlight On or Off.  Here we use GPIO 17.  We discuss in further detail below to find out the specific series resistor value required.

GPIO LCD Ground Connection 04*Only 2 wires are needed to light the backlight, one to GPIO with a series resistor, and one to either Ground or VCC, using all 3 wires allows us to control the backlight either way it is made (common anode vs common cathode.  Both VCC and Ground are required for the LCD itself, so all 3 should be present in most cases.


GPIO as a Current Sink

I've read countless forums discussing the need of an external transistor to switch the 4 LED backlight on and off, and while that is true for higher current applications, for our Nokia 5110 backlight, this is simply not the case.  Raspberry Pi's GPIOs are designed to handle up to 16mA.  That 16mA limit is both source or sink (providing a current, or sinking the current to ground as we are doing in this example). 

Few things to keep in mind regardng Raspberry Pi GPIO:

  • In your program, be sure to set your GPIO as an OUTPUT, setting it up as an INPUT, you can not sink more than 0.5mA
  • Never demand that any output pin source or sink more than 16 mA*
  • The maximum you can source from all the GPIO outputs simultaneously is less than 50 mA*

On a side note, Most Arduinos can handle similar currents, but depending on the specific board and total GPIO current it does vary, so I recommend looking up the specific details for each design you have in mind.  For our example, lighting a Nokia 5110 LCD backlight, on a single GPIO on the Raspberry Pi, it works fine.


Current Test with my LCD Backlight

Without any external current limiting resistors I only get a draw of ~8mA when I connected LIGHT to ground, with 3.3V at VCC with the specific 5110 LCD I had purchased off of eBay.  This is because our LCD backlight already has current limiting resistors on the board.  Each LED (total of 4) on our board has a smd resistor labelled 301 which is 300 ohm. 

GPIO LCD Ground Connection 05

8mA is low enough for us to connect the backlight directly to our GPIO (remember, the GPIOs have up to 16mA current source or sinking capabilities). 

GPIO LCD Ground Connection 01

I would suggest measuring your specific LCD backlight current draw, as different manufacturing designs from China may vary.  Some LCDs may include current limiting resistors already on the board, and some may not. 

To measure the current, use a multimeter on the CURRENT setting and wiring the meter leads in series with your circuit (vs in parallel when measuring voltage, ohms, etc).  You may also need to change where your positive measuring lead connects to the multimeter.

I added a 39 ohm resistor in series and brought the current down to ~4mA without much of a visible difference in brightness to the backlight.  This wasn't required, as it already only measured 8mA, but you want to make sure you are not running at the threshold of 16mA consistently. 


Adding Control Into Our Program For The Backlight

The full sample program is below, but I will walk through the full details first.

If your backlight requires a connection to Ground (current sink) in order to turn on the backlght, when connecting to one of the GPIO pins you need to set the pin to LOW/False in order for it to light up.  For backlights that require a current source (3.3V), this will be reversed.

For current sink (Ground) connection it is:

GPIO is True = Backlight is OFF

GPIO is False = Backlight is ON


I'll be using python as an example, as this is what I used for my project.  You'll need to include the Rpi.GPIO library into your script.  Most new distributions (including Raspbian Jessie) already have this library installed.

import RPi.GPIO as GPIO

Next we set the mode for the naming convention we use for our GPIOs (actually header pin number (BOARD) or GPIO number (BCM)) We choose the actual GPIO number - BCM


GPIO LCD Ground Connection 02

You'll next have to setup the GPIO pin you connected the backlight (with series resistor) to as an output.  We choose GPIO 17 (pin# 11 on pi header) in this example, but you can use any GPIO pin available on your Pi header.

GPIO.setup(17, GPIO.OUT)


Next we turn on the backlight

GPIO.output (17, False)


Python Blink Code for Backlight

Here's a python script that also includes the time library to allow us to blink the backlight.  I'll use nano and save it as


Copy & paste the code below (Ctrl x & y to save)


import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT)
while True: GPIO.output(17,True)
print "GPIO is True" time.sleep(5) GPIO.output(17,False)
print "GPIO is False" time.sleep(5)

Make the code executable

chmod +x

then run from the Pi console




Using a GPIO on the Raspberry Pi, we can control an LCD backlight with python.  We want to limit the current at the GPIO to below 16mA, and with a total series resistance around 300 ohm is sufficient to achieve this.  If your backlight requires a ground connection (a current sink) at the LIGHT connection, GPIO is True = Backlight is OFF, if it requires 3.3V (a current source), GPIO is True = Backlight is ON



*Quoted from the website:










Read 13986 times Last modified on Thursday, 17 March 2016 20:31
Algis Salys

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