Arduino Nokia 5110 with U8GLIB Tutorial

Nokia 5110 with U8GLIB

5110The Nokia 5110 display has long been an Arduino Hobbyist favorite and a search of the internet will show that there are tons of different ways to drive this device.   This tutorial focuses on the freely available U8GLIB graphics library.

One of the reasons I like this library is because it makes it simple for me to adopt a different display for a project without a lot of code changes.

A discussion of the U8GLIB can be found HERE.

Getting Your Nokia 5110

Nearly anyone selling Arduino stuff is selling one of these.  If you can’t find one, you can try one of these.

eBay     Amazon     Bang Good     Deal Extreme     IC Station

NOTE – Another thing you may wish to purchase is a LEVEL SHIFTER.    The Nokia 5110 is a 3.3 volt device and while there are examples of people using 5 volts with these successfully,   I like my stuff to last more than a week.

The level shifter allows you to use your Arduino 5V logic levels with a 3.3 Volt device.  I keep a few on hand,  though I tend to reach for my 8 Channel bi-directional shifter first.  Level shifters can be found at any of the links below:

eBay     Amazon     Bang Good     IC Station

Nokia 5110 Pin Outs

There are a few varieties of this module are out there.   Mine are labeled as you see below.   Others should work just fine with this tutorial if you map your pins correctly.

Remember,  VCC is 3.3 Volts.   The LIGHT Control can use pulse width modulation through a 330 ohm resistor.

Nokia 5110 Pinouts

 

Arduin0 Nokia 5110 U8GLIB Tutorial

Get The U8GLIB Library

The library is freely available from Github and can be found HERE

If you’re unfamiliar with adding new libraries,  read THIS ARTICLE.

Connect the Arduino and the Nokia 5110

I’m showing a generic level shifter.  You may have another.  They’re not too complicated.

Arduino Nokia 5110 U8GLIB Tutorial Hook UpCopy, Paste and Upload the Nokia 5110 U8Glib Sketch

This sketch uses the U8Glib library.  Using this library effectively requires the use of a ‘Picture Loop’.  I discuss the Picture Loop HERE.

// Henry's Bench
// Arduino Nokia 5110 U8Glib Tutorial


#include "U8glib.h"

 

#define backlight 11
 
//Delcare the display and assign the pins
 
U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);  // CLK=8, DIN=4, CE=7, DC=5, RST=6
 

 
void draw() {
 
  u8g.setFont(u8g_font_profont11);  // select font
  u8g.drawStr(0, 15, "Nokia 5110..");  // put string of display at position X, Y
  u8g.drawStr(29, 35, "HELLO!!!!");
  
  
}
 
void setup() {
  // Set Backlight Intensity
  // 0 is Fully bright
  // 255 is off
  analogWrite(backlight, 80);
  //
  // Enter the U8Glib Picture Loop
  //
  
}
 
void loop() { 
 u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() ); 
  
}

Test Your Sketch

The results will be nearly immediate.   You will see a text display with a lit back light.