You are on page 1of 4

5/7/2014 Arduino: Arduino and Nokia 5110

http://contract312.blogspot.in/2013/02/arduino-and-nokia-5110.html 1/4
Arduino
Thursday, February 21, 2013
Arduino and Nokia 5110
Original: http://www.avdweb.nl/arduino/hardware-interfacing/nokia-5110-lcd.html#h0-1-1-1-
operation-at-5v
How to use the Nokia 5110 LCD Module
at Arduino
Contents
1. Hardware

o 1.1. Operation at 5V
o 1.2. PCD8544 supply current versus supply voltage
o 1.3. Using the control lines
o 1.4. Auto reset circuit
o 1.5. Nokia 5110 LCD with different connector wiring
2. Software

o 2.1. PCD8544 library
o 2.2. LCD printing with streaming operator <<
o 2.3. Adjusting the contrast value
3. Notes
1. Hardware
1.1. Operation at 5V
The Nokia 5110 LCD Module uses a Philips PCD8544 LCD driver, which is designed for mobile
phones.
2013 (1)
February (1)
Arduino and Nokia 5110
Blog Archive
contract312
View my complete profile
About Me
Share
1

More

Next Blog Create Blog

Sign In
5/7/2014 Arduino: Arduino and Nokia 5110
http://contract312.blogspot.in/2013/02/arduino-and-nokia-5110.html 2/4
Many devices that can be used with an Arduino, require a power supply of 3.3V. This is also the
case with the Nokia 5110. The best way to deal with 3.3V devices is to take an Arduino Pro, which
can run on 3.3V.
The PCD8544 controller can handle 5V, because VDD max = 7V. However, operation at 5V can
sometimes cause streaks on the LCD display, so 3.3V is preferred. Thanks to the internal clamp
of the PCD8544 we can use a very simple level shifter. Four current limiting resistors of 10k can
do the job. When an LCD control line is high, the current through the 10k resistor is just 40uA,
so this is harmless. Note that we can't read back from the LCD with this circuit.
1.2. PCD8544 supply current versus supply voltage
1.3. Using the control lines
The Nokia 5110 LCD has 5 control lines; the interface is of the type SPI. Mostly, when no other
SPI devices are used, the chip select can be connected to the GND, so 4 control lines stay
over. To saveArduino pins, there is an option to use only 3 control lines, while the Nokia reset pin is connected to
the Arduino reset. This works only when the serial monitor is used, not with a standalone Arduino.
1.4. Auto reset circuit
An option is to generate a reset pulse on power up automatically, with a RC combination, to save
one control line to the Arduino. However, I found out that this solution is poorly reproducible; the
proper functioning depends for instance on the capacitor across the 3.3V supply. Also
the Arduino can't be used with the serial monitor anymore.
1.5. Nokia 5110 LCD with different connector wiring
Not all Nokia 5110 LCDs are the same. Although they look identical, the connector wiring can be
completely different.
5/7/2014 Arduino: Arduino and Nokia 5110
http://contract312.blogspot.in/2013/02/arduino-and-nokia-5110.html 3/4
2. Software
2.1. PCD8544 library
Limor Fried has created a library which can be download at github
. I have cleaned up and optimized the library a little bit, you can download it here. Unzip the library
and place it into the Arduino library folder like this: \libraries\PCD8544. For troubleshooting
see HERE.
2.2. LCD printing with streaming operator <<
With the Streaming library, we can use the streaming operator << for printing to the console:
Serial << "hello!\n"; instead of Serial.println("hello!\n");
Because the PCD8544 parent class is Print we can also use the streaming operator << for printing
to the LCD. Here is an example of the Nokia 5110 LCD application:
#include <PCD8544.h>
#include <Streaming.h>
#include <Arduino.h>
//PCD8544 nokia = PCD8544(10, 11, 12, 13, 14); // 5 pin LCD control, SCLK, DN,
D/C, CS, RST
PCD8544 nokia = PCD8544(10, 11, 12, 0, 13); // 4 pin LCD control, SCLK, DN,
D/C, RST
//PCD8544 nokia = PCD8544(10, 11, 12); // 3 pin LCD control, SCLK, DN,
D/C
void setup(void)
{ Serial.begin(9600);
Serial << F("Hello!\n");

nokia.init(60); // set contrast
nokia.clear();
nokia << "Hello!\n"; // without using F
nokia << F("Save RAM with the Flash library\n"); // use F to save RAM space
nokia.display();
}
void loop(void)
{ findBestContrast(40, 65);
}
void findBestContrast(int contrastMin, int contrastMax)
{ for(int contrast=contrastMin; contrast<=contrastMax; contrast++)
{ nokia.clear();
nokia.setContrast(contrast);
nokia << F("12345678901234");
nokia << F("12345678901234\n"); // Bug: "\n" after 14 characters creates a
blank line
nokia << F("bla bla bla bla bla bla\n");
nokia << contrast;
nokia.display();
delay(1000);
}
}
2.3. Adjusting the contrast value
The contrast must be set separately for each LCD. With the function findBestContrast(), the
correct contrast value can be determined.
3. Notes
Don't use "\n" after a 14 character line, this creates an extra blank line.
The PCD8544 LCD driver may be damaged if it is not properly reset.
5/7/2014 Arduino: Arduino and Nokia 5110
http://contract312.blogspot.in/2013/02/arduino-and-nokia-5110.html 4/4
Home
Subscribe to: Post Comments (Atom)
Posted by contract312 at 10:02 PM
To make the program running without error: you should coppy the " PCD8544" and "Streaming"
to the library
When you bought nokia5110 led sometime you need to connect the light to ground via 100ohm to
make it works (instead to Vcc)

+1 Recommend this on Google
Enter your comment...
Comment as:
Google Account
Publish

Preview
No comments:
Post a Comment
Simple template. Powered by Blogger.

You might also like