IAN LANG ELECTRONICS

On the right there you can see an LCD display which has been put on to an easy solder board by the very considerate people at Sparkfun and which is sold in Great Britain by the equally considerate people at Proto-pic for a very reasonable price indeed. Clicking on the picture will open a link to their webpage for it.

 

Of course if you have a Nokia 5110 or 3310 laying about the house you could just remove the screen and get hacking but it's a bit more difficult and so in the following I'm going to assume you've got a new one from Sparkfun. If you have taken the screen out of a Nokia, good for you and follow the instructions, it'll work just the same.

Using a Nokia 5110 Graphic LCD

Go Back 5110

The screen uses a PCD8544 controller and works on SPI.

Does it?

It does, yes.

Really?

Really, yes.

Oh.

 

In plain English, the PCD8544 controller is a driver which is embedded into the module to create the displays and it's the driver that does all of the processing to decide which pixel will be black and which white, and since combining black and white pixels gives us our text and graphics output it can be said to be thing that does the writing and drawing.

SPI on the other hand stands for serial peripheral interface. Now I realise that if you've never come across SPI before, that last statement is as helpful to you as throwing an anvil on a rope is to somebody who has dropped over the side of a North Sea ferry and so I intend to bang on a bit about SPI for a couple of paragraphs. Those of you who do know about SPI will doubtlessly now be groaning but you can skip those paragraphs so chin up.

 

SPI is a means of transmission between a controlling unit (the master) and a peripheral (which is known as the slave) that either receives data from or sends to the master. In this case the master is the Arduino and the slave the LCD module.

pinout

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 or Master Out Slave In which is also known as SIMO and SDI; DI, DIN, SI: because it is Serial Data In. It lets the master send data to slave.

 

MISO which is 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  which is Slave Select and is also known as SCE, nCS, CS, CSB, CSN, nSS, STE which switches sending between master and slave.

 

SCLK  which is the clock pulse. It's attached to an oscillator of regular frequency.

In a nutshell it works like this: you set the slave to receive. You send a bit of data every time the clock pulses. When you've sent all the data, you set the slave to transmit. It then knows it's got to process something and does it. It sounds hard but it isn't- it's exactly what we do with shift registers.

If you look at the pin out above of the LCD module, you'll see three of the four- there's no MISO because it does not need it. There are other pins that are used for controlling the  PCD8544  and they are:

 

D/C which selects between data and commands being sent.

RST  which is a reset

GND which is the negative terminal

VCC which is the positive and needs 3.3V

 

Right up at the top is LED which is where you attach 3.3V  and not 5V or you'll blow it up. It powers the backlight. Here is a wiring diagram from Sparkfun that shows you how to attach it to an Arduino Uno:

5110wiring

This shows the screen on a breadboard. If you want to use it on a breadboard, then you'll need to solder in some headers as the module comes unpopulated. Alternatively you could solder on some jumper wires and stick them straight to the Arduino. Despite what the drawing says don't provide 5V- it will not end well.

 

Now we need some code to drive the Arduino. Over the page is a monster which provides a demo of some of the things the module can do.

Copy and paste it to your Arduino IDE by highlighting the top section, scrolling down the page to the bottom shift & left click to highlight all, then CTRL C to copy and CTRL V to paste.

Pay attention to the pinout and all pins except the power supplies and GND (3.3V for backlight and board supply) need to go to to the Arduino board via a 10k resistor, except SCE which uses 1k.

 

More >