The Nokia 5110 LCD module is a small and cheap LCD with a lot of graphical possibilities and is quick to add to projects that need a display. The programming of the display is a bit difficult but there are a number of very good libraries available. Adafruit ofcourse has a library that is available here: here you will also need to install the GFX library that library is a bit slow but a faster hardware SPI library by Snigelen is available here: here.
Some additions to the Adafruit library have been made by avdweb
The arduino playground has a library: here
A library is also available: here
A further fast libray is available here with explanation here
Also a library by Henning Karlsen
The display driver is a PCD8544 chip, and it runs at 3.3V so you will need a 3.3V supply handy. Logic levels must be 3.3V to prevent damage so you must use some kind of level shifter (such as a 4050) or some resistors. It is possible to use a number of different lines to hook up the LCD. Normally it is 5 lines, but a configuration with 4 or even 3 lines is possible The Nokia 5110 LCD has 5 control lines; the interface is of the type SPI.
For a good understanding of how to hook up the Nokia LCD, it is good to understand that it is an SPI device.
Apart from power and ground (and power to the LED backlight if there is one) There are four basic signal lines to an SPI device. They are
- MOSI (Master Out Slave In) also known as SIMO and SDI; DI, DIN, SI: because it is Serial Data In. It lets the master send data to slave.
- MISO (Master In Slave Out) aka SDO; DO, DOUT, SO which allows the slave to send data to the master. It isn’t always there.
- SS (Slave Select) also known as SCE, nCS, CS, CSB, CSN, nSS, STE which switches sending between master and slave.
- SCLK which is the clock pulse.
The Nokia5110 LCD has no MISO signal, but it has a:
- D/C which selects between data and commands being sent.
- RST (Reset)
- Vcc which needs 3.3V
As long as you are using the Nokia LCD stand alone you are rather flexible in choosing what pins to use, however, if you want to use it in combination with another SPI device on the hardware SPI bus, you must use the proper SPI pins and you cannot use the MISO for any of the Nokia LCD pins as it has no MISO
The proper connection would be:
MOSI -> MISO (D12)
SCLK -> SCK (D13)
SS -> an available pin on Arduino, other than D11, traditionally D10 or D8 are used
D/C -> an available pin on Arduino, other than D11
RST -> an available pin on Arduino, other than D11, or an auto reset
Mostly, when no other SPI devices are used, the chip select can be connected to the GND, so 4 control lines remain. As said, it is possible to use only 3 control lines, by connecting the Nokia reset pin to the Arduino reset. This works only when the serial monitor is used, not with a standalone Arduino.
Another possibility is to generate a reset pulse on power up automatically, with a RC combination, to save one control line to the Arduino. This solution doesnt seem to be reliable though. The proper functioning seems to also depend on the capacitor across the 3.3V supply. Using only 4 or 3 lines of course only makes sense if your library allows that, otherwise the pins may not be connected but will be in use by your program. The Device can tolerate a Vcc of 5 Volt, but it works best at 3.3Volt. When using it with a 5 Volt device, it is best to either have a level adapter or resistors between the two devices.
Example of connection with resistors and 4 control lines