# How to Use NOKIA 5110 LCD Screen With Arduino

13,998

200

19

Posted

## Introduction: How to Use NOKIA 5110 LCD Screen With Arduino

Hi guys!
This is my first tutorial that I'm writing. So, sorry for any mistakes. I might not be effectively able to make u understand what i'm trying to tell!

Please do vote for my tutorial(Click on the 'Vote!' button on the top-right corner), if you really like it.Thanks, in advance!!

Anyways, let's start it...

This tutorial on 'How to use a NOKIA 5110 LCD screen' is different from the all the tutorial that are available online because I'm not going to use any library in this tutorial(No worries!! it's pretty easy,which i figured out after trying without libraries). I'm not using any libraries just because it makes it easy to understand how the LCD screen works. I mean what block of code(or a command, u'll know in the upcoming steps) does. It makes it easy to control the graphics on the LCD screen. I'm going to write another tutorial after this tutorial on how to play 'SNAKE GAME' using this NOKIA 5110 LCD screen.

So, let's get started!( Feel free to ping me, in case you have any doubts)

## Step 1: Understanding NOKIA 5110 LCD Screen

The NOKIA 5110 LCD screen has a resolution of 84x48(or 48x84, however you read it) i.e. the screen has pixels arranged in 84 rows and 48 columns making a total of 4032 pixels (84*48=4032). So, since a NOKIA 5110 LCD screen is called a 'Graphical LCD screen', one has access to all the pixels, i mean, access to control each and every pixel individually(you know what I mean) unlike some of the LCD screens which are named as 'Alphanumeric LCD Displays' where one can access a block of pixels, generally 7x5 and place only a single alphabet or a number in that block of 7x5. If you have already worked with some alphanumeric LCD screens earlier(without any libraries), you are half-way done. In case, you haven't worked with one earlier, no probs. I'll let you know every possible detail I know.

So, as said earlier, the above image shows the arrangement of pixels in 48 rows and 84 columns( or vice-versa). Just like how each block in a alphanumeric LCD screens is addressed by a unique 8-bit code, every 8 pixels in the NOKIA 5110 LCD screen are assigned with a unique 8-bit address. So, let me explain about this 8 pixels grouping in the NOKIA 5110 LCD screen. Every 8 pixels vertically is grouped, as shown above and let's call it a block(different from the alphanumeric LCD screen's block). So, each block has a unique address to access it.

With this prerequisite, we can continue to learn how to code before having a look at the pin-diagram.

## Step 2: Pin-Diagram of NOKIA 5110 LCD SCREEN

{image of pindiagram}

Some NOKIA 5110 LCD screens operate at 3.3V as Vcc while some can work with both 5V and 3.3V. Mine is a 5V version which works even when plugged to 3.3V.

NOKIA 5110 LCD screen uses SPI protocol as one can find a DIN pin which can also be call as MOSI(Master-Out Slave-In). So, all we gonna do is just pass commands with a couple of 8-bit data through the DIN pin while using the other pins(like DC, CE and CLK pins) simultaneously and appropriately.

## Step 4: Getting Started With Programming

I'll first show you guys the code and then explain it block by block

#define LCD_CE        7
#define LCD_RESET     6
#define LCD_DC        5
#define LCD_DIN       4
#define LCD_CLK       3
#define LCD_C     LOW
#define LCD_D     HIGH
int index=0;
static byte grap[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0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 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
void LCD_Initialise(void)
{
pinMode(LCD_CE, OUTPUT);
pinMode(LCD_RESET, OUTPUT);
pinMode(LCD_DC, OUTPUT);
pinMode(LCD_DIN, OUTPUT);
pinMode(LCD_CLK, OUTPUT);
digitalWrite(LCD_RESET, LOW);
digitalWrite(LCD_RESET, HIGH);
LCD_Write(LCD_C, 0x21 );  // LCD Extended Commands.
LCD_Write(LCD_C, 0xB9 );  // Set LCD Vop (Contrast).
LCD_Write(LCD_C, 0x04 );  // Set Temp coefficent.
LCD_Write(LCD_C, 0x14 );  // LCD bias mode 1:48.
LCD_Write(LCD_C, 0x20 );  // LCD Basic Commands
LCD_Write(LCD_C, 0x0C );  // LCD in normal mode.
}
void LCD_Write(byte dc, byte data)
{
digitalWrite(LCD_DC, dc);
digitalWrite(LCD_CE, LOW);
shiftOut(LCD_DIN, LCD_CLK, MSBFIRST, data);
digitalWrite(LCD_CE, HIGH);
}
void setup(void)
{
Serial.begin(9600);
LCD_Initialise();
}
void loop(void)
{
digitalWrite(8,HIGH);
for (index = 0; index < (84*48) / 8; index++)
{
LCD_Write(LCD_D, grap[index]);
}
}</p>

This is the total code which displays two rectangular boxes on the LCD screen as shown below. If you are having trouble getting the output, feel free to ping me or comment down below.

## Step 5: Program Explaination: Macros

#define LCD_CE        7
#define LCD_RESET     6
#define LCD_DC        5
#define LCD_DIN       4
#define LCD_CLK       3
#define LCD_C     LOW
#define LCD_D     HIGH

'A macro (short for "macroinstruction", from Greek μακρός 'long') in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to a replacement output sequence (also often a sequence of characters) according to a defined procedure.', says Wikipedia.
In short, macros is the technique people use to make their program easy. For example, the first line of my code is

#define LCD_CE        7

This line means that when ever i type 'LCD_CE' anywhere in my code, it gets replace with '7', which is the pin of arduino to which I've connected the CE pin of LCD screen. And similarly, all the other pins. I've also declared LCD_C and LCD_D which I'll explain in the upcoming steps.

## Step 6: Program Explaination: Bitmaps

You must have observed that there is an array 'grap'(which refers to graphics) in my code which is very very big.

<p>static byte grap[]=<br>{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0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 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};</p>

The elements in this array are the one which decide the graphics that are displayed on the LCD screen. As I've said earlier, every 8 bits on the LCD screen are grouped together, every element in this array are 8-bit(2-digits in hexadecimal). Suppose, let us consider the first element of the element as 0xF0. 0xF0 in hexadecimal is equivalent to 0b11110000 in binary. So, when the 0xF0 is sent to the LCD screen(i'll discuss about it in the next step), the first four pixels in the first group of 8-vertically grouped pixels(as discussed in STEP-1) are made dark(black) as the first four bits in the input data are '1' and similarly, the remaining 4-bits are not darkened as they are '0'.
Initially, in the start, the cursor is at the top left group of 8-pixels. As soon as you send the first 8-bit data, the cursor moves on to the next group. After all the groups are covered, the cursor returns to the top left (first) pixel. So, I always prefer to send data for all the groups even if i prefer not to darken the pixel by sending a 0x00 so that the cursor returns to the first pixel group and this makes it easy to change the graphic for the nect time.

## Step 7: Program Explanation: LCD_Write()

I was talking about sending the 8-bits data to the LCD screen in the previous step. Let's discuss about it now.

As I said earlier, the NOKIA 5110 LCD screen can be communicated with SPI or through the MOSI pin i.e. DIN pin on the LCD screen. So, we need to send 8-bit commands or data to work with the display. The commands are so simple. One need not prefer to remember them if you can refer to datasheet of NOKIA 5110 LCD screen when ever needed. I've included a page of the data sheet in the next step.
So, as mentioned in the datasheet, before sending the data or command to the LCD screen, we need to make the CE(chip enable) pin low and make it high again after sending the command.(Basically, CE pin is an active low pin. So, make it low to use the LCD screen). also, we need to make the DC(data/command) pin low for command and high for data.

The LCD_Write command takes in two parameters, 1. Data/Command and 2. 8-bit data. Depending on the Data/Command, the DC pin is made low or high for command or data respectively. shiftOut() is a function available in SPI.h but is also included by default and so we need not include the SPI.h library seperately.

<p>void LCD_Write(byte dc, byte data)<br>{
digitalWrite(LCD_DC, dc);
digitalWrite(LCD_CE, LOW);
shiftOut(LCD_DIN, LCD_CLK, MSBFIRST, data);
digitalWrite(LCD_CE, HIGH);
}</p>

## Step 8: Program Explanation: Initialization

Now that we know how to communicate with the LCD screen, let's initialize it.

First, setting up the CE, RESET, DC, DIN, CLK as outputs, we continue to reset the LCD screen just to make sure all the garbage values in the pixels are cleared. Next we send some commands, which set-up the LCD screen. You can have a look at all the commands in the data sheet.

After initialization, ofcouse, we need to execute this LCD_Initialise() function in the setup() function of the arduino. Also need to setup serial communication using Serial.begin(9600) where 9600 is the baud rate. After that, we are ready to go to display the graphics on LCD screen.

void LCD_Initialise(void){
pinMode(LCD_CE, OUTPUT);
pinMode(LCD_RESET, OUTPUT);
pinMode(LCD_DC, OUTPUT);
pinMode(LCD_DIN, OUTPUT);
pinMode(LCD_CLK, OUTPUT);
digitalWrite(LCD_RESET, LOW);
digitalWrite(LCD_RESET, HIGH);
LCD_Write(LCD_C, 0x21 );  // LCD Extended Commands.
LCD_Write(LCD_C, 0xB9 );  // Set LCD Vop (Contrast).
LCD_Write(LCD_C, 0x04 );  // Set Temp coefficent.
LCD_Write(LCD_C, 0x14 );  // LCD bias mode 1:48.
LCD_Write(LCD_C, 0x20 );  // LCD Basic Commands
LCD_Write(LCD_C, 0x0C );  // LCD in normal mode.
}
void setup(void){
Serial.begin(9600);</p><p>  LCD_Initialise();
}

## Step 9: Displaying Graphics of You Choice on the LCD Screen

So, we know how to initialize the LCD screen, we know how to communicate with the LCD screen, we know how the LCD screen works, but we don't know how to display the graphics of our owe choice. To do that, we need to know how to convert any image into bitmap. The image must be in 'BLACK AND WHITE', if not conver it into B&W using some software.
1. First, convert the image to Gray scale(Take Google's help, in case if you don't know how to)
2. Convert the Gray scale image into data arrays(those 8-bit hexadecimal data we have store in an array)

Generally, I use GIMP and LCDAssistant(and paint.net) softwares. Again, try getting Google's help in knowing how to use GIMP to convert a B&W image to Gray scale and I'm going to tell you about LCD Assistant and paint.net.

## Step 10: How to Use LCDAssistant and Paint.net Software

So, once you download and open it, it looks something as shown in the image

This software converts 'monochromatic bitmaps' images into 'data arrays'. These output data arrays are set to 8-bit in the software. You can self-understand how to use this software(else, I'll post a video shortly.Till then checkout Google).

This software is used to draw any image which you want to display on the LCD screen. Sounds cool, isn't it?? For example, you can display your name in your handwriting or some cool stuff. Again, go to Google and find a video which can help you with until I post a video.

## Step 11: Conclusion

Now, you are ready to use a NOKIA 5110 LCD screen.

Do comment bellow if you have any doubts.
Do comment bellow if I've gone wrong somewhere.
Do comment bellow your experience, if you have done one.

Thank you guys. Thanks for reading my 'FIRST INSTRUCTABLE". Please do vote for my tutorial, if you really like it.

Stay awesome and keep learning things till I post my second Instructable which is going to be on 'How to play SNAKES game on NOKIA 5110 LCD screen'.

## Recommendations

• ### Arduino Class

66,444 Enrolled

• ### Pocket-Sized Contest

We have a be nice policy.

## Questions

the code does not verify/compile in the arduino ide 1.8.5 Arduino: 1.8.5 (Windows 10), Board: "Arduino Due (Programming Port)"

sketch_jan17a:8: error: 'int index' redeclared as different kind of symbol

int index=0;

^

In file included from c:\users\blind\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdlib.h:11:0,

from C:\Users\blind\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Arduino.h:24,

from sketch\sketch_jan17a.ino.cpp:1:

c:\users\blind\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\string.h:55:8: error: previous declaration of 'char* index(const char*, int)'

char *_EXFUN(index,(const char *, int));

^

C:\Users\blind\Documents\Arduino\sketch_jan17a\sketch_jan17a.ino: In function 'void loop()':

sketch_jan17a:75: error: assignment of function 'char* index(const char*, int)'

for (index = 0 index < (84*48) / 8; index ++);

^

sketch_jan17a:75: error: cannot convert 'int' to 'char*(const char*, int)' in assignment

sketch_jan17a:75: error: expected ';' before 'index'

for (index = 0 index < (84*48) / 8; index ++);

^

sketch_jan17a:75: error: ISO C++ forbids incrementing a pointer of type 'char* (*)(const char*, int)' [-fpermissive]

for (index = 0 index < (84*48) / 8; index ++);

^

sketch_jan17a:75: error: lvalue required as increment operand

sketch_jan17a:75: error: expected ';' before ')' token

for (index = 0 index < (84*48) / 8; index ++);

^

sketch_jan17a:77: error: invalid types 'byte [504] {aka unsigned char [504]}[char*(const char*, int)]' for array subscript

LCD_Write(LCD_D, grap[index]);

^

C:\Users\blind\Documents\Arduino\sketch_jan17a\sketch_jan17a.ino: At global scope:

sketch_jan17a:79: error: expected unqualified-id before '<' token

}</p>

^

exit status 1

'int index' redeclared as different kind of symbol

Invalid library found in C:\Users\blind\Documents\Arduino\libraries\jan19_2017: C:\Users\blind\Documents\Arduino\libraries\jan19_2017

Invalid library found in C:\Users\blind\Documents\Arduino\libraries\ST7565: C:\Users\blind\Documents\Arduino\libraries\ST7565

Invalid library found in C:\Users\blind\Documents\Arduino\libraries\jan19_2017: C:\Users\blind\Documents\Arduino\libraries\jan19_2017

Invalid library found in C:\Users\blind\Documents\Arduino\libraries\ST7565: C:\Users\blind\Documents\Arduino\libraries\ST7565

"Show verbose output during compilation"

option enabled in File -> Preferences.

>>> char *_EXFUN(index,(const char *, int));
"index" is an old C-library function much like strchr(). Replace this var with e.g. "idx" or "jj" and you should be good to go !!

Hello. Can this code be directly used for Arduino Mega? If any changes has to be made, please mention it. Thanks in advance.

Yes! it will also work for Arduino Mega. Connect the wire just as shown in the image in this tutorial and you are good to go!

Perfect !!!

Thank you :)

Please do do vote for my tutorial(checkout 'Vote!' button on the top-right corner.