Introduction: Write Messages in a Nokia5110 Screen With Arduino.

Picture of Write Messages in a Nokia5110 Screen With Arduino.

With the following instructions you will be able to easily print messages in a nokia 5110 LCD screen with the help of an Arduino microcontroler.

What we need:

Hardware:

LCD Display Screen Nokia 5110 LCD

Arduino (In this example I'm using the model Arduino Leonardo but any model can be used)

Male To male 40p 20cm 1p-1p Jumper Ribbon Wire

Breadboard (recommended)

USB Cable

Ribbon Wire connector

Software:

Arduino IDE (Download from http://arduino.cc/en/pmwiki.php?n=main/software)

Adafruit PCD8544 library: https://github.com/adafruit/Adafruit-PCD8544-Nokia...

Adafruit GFX libraries: https://github.com/adafruit/Adafruit-GFX-Library

The code template can be taken from here: https://github.com/sparkfun/GraphicLCD_Nokia_5110

Step 1: Connect the Cables!

Picture of Connect the Cables!

1. Connect the Ribbon Wire to the Ribbon Wire connector so all the cables are connected in order and they are easy to identify.

2. Connect the Nokia LCD to the breadboard, make sure every pin connects to a different row and that there is enough space to connect the Ribbon wire.

3. Connect the Ribbon wire in the same rows as the LCD Screen.

4. Connect the other extremes of the ribbon wire to the proper pins. The pins should be the same as the ones written in the software. Do not drive the backlight with 5V. It will smoke.

You will need 5 signal lines to connect to the LCD, 3.3 or 5V for power, 3.3V for LED backlight, and 1 for ground. As the software says those are the pins:

#define PIN_RESET 3 //Pin 3 on LCD

#define PIN_SCE 4 //Pin 4 on LCD

#define PIN_DC 5 //Pin 5 on LCD

#define PIN_SDIN 6 //Pin 6 on LCD

#define PIN_SCLK 7 //Pin 7 on LCD

So the last 3 cables goes to 3.3v, GND and GND in the power section of the Arduino Leonardo The first 5 cables goes to the digital section in order to the pins: 3,4,5,6 & 7.

If the power cables are properly connected. you should be able to see the backlight on If you plug the Arduino to an usb power battery or connector.

Step 2: Send the Instructions to the Arduino and Print the Message in the Screen

Picture of Send the Instructions to the Arduino and Print the Message in the Screen

The IDE image above contents the basic code for showing text. If you want to test further features like graphics please check the following tutorial: http://playground.arduino.cc/Code/PCD8544 and download the file attached in this step (pcdtest.ino)

This is the basic function needed to write text:

void setup() { // put your setup code here, to run once:

LCDInit(); //Init the LCD

}

void loop() { // put your main code here, to run repeatedly:

LCDClear();

LCDString("Hello World!");

}

After this, the function LCDString which sents the text to the screen should be added and it is as simple as follows:

//This function takes in a character, looks it up in the font table/array

//And writes it to the screen

//Each character is 8 bits tall and 5 bits wide. We pad one blank column of

//pixels on each side of the character for readability.

void LCDCharacter(char character) {

LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

for (int index = 0 ; index < 5 ; index++)

LCDWrite(LCD_DATA, ASCII[character - 0x20][index]);

//0x20 is the ASCII character for Space (' '). The font table starts with this character

LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

}

//Given a string of characters, one by one is passed to the LCD

void LCDString(char *characters) {

while (*characters)

LCDCharacter(*characters++);

}

Open the Arduino IDE, Open the Nokia code (Check the link given before to download it), compile it! If there are no compilation errors, click the arduino button and press the upload button in the arduino IDE and you should be able to see the message in the screen.

Have fun!

Comments

Hippycrack (author)2017-07-09

Where is the code that you wrote that displays Hello World, this is an
example. I do not see a link to this code. The only link I see is to a
graphic set of code that had different pin layout.

xpheres (author)Hippycrack2017-10-07

Hello, as many people requested me I explained it in the tutorial, added a picture with the basic function that shows text and added a file ready to be downloaded. I hope it helps.

xpheres (author)2017-10-07

Hello, as many people requested I added the file with all functions to show text and graphics, I added a link to the tutorial where the code is explained: http://playground.arduino.cc/Code/PCD8544 and I added a picture with the basic function needed to write text, it is as simple as this:

void setup() {

// put your setup code here, to run once:

LCDInit(); //Init the LCD

}

void loop() {

// put your main code here, to run repeatedly:

LCDClear();

LCDString("Hello World!");

}

After this, the function LCDString which sents the text to the screen should be added and it is as simple as follows:

//This function takes in a character, looks it up in the font table/array

//And writes it to the screen

//Each character is 8 bits tall and 5 bits wide. We pad one blank column of

//pixels on each side of the character for readability.

void LCDCharacter(char character) {

LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

for (int index = 0 ; index < 5 ; index++)

LCDWrite(LCD_DATA, ASCII[character - 0x20][index]);

//0x20 is the ASCII character for Space (' '). The font table starts with this character

LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

}

//Given a string of characters, one by one is passed to the LCD

void LCDString(char *characters) {

while (*characters)

LCDCharacter(*characters++);

}

I hope this helps :)

mkpeker (author)2017-10-07

tutorial is not necessary, where is the code that produces this screen?

xpheres (author)mkpeker2017-10-07

Hello, I answered you and all the people requesting the code in the post above

justbennett (author)2015-04-16

Do you need the adafruit libraries with the Sparkfun code? It looks like it would run without the adafruit libraries.

Er SukhmanS (author)justbennett2015-07-30

yes sir i need m new in programming plz send it on my mail sukhmandeol751@gmail.com

xpheres (author)2015-04-16

I have functions in my code that not only write text but it also draw geometry and other stuff that requires the library. I guess it may be possible to write text without them, but I recommend them if you want to play further :)

Er SukhmanS (author)xpheres2015-07-30

sir i made this circuit plz send me the coading @ sukhmandeol751@gmail.com