If you own an Arduino you surely start (sooner or later) playing around with some kind of display. Maybe dot matrix displays, classical 16×2 lcds or like me an old Nokia 5110 lcd with a resolution of 84×48 pixels.
The first problem you come across is wiring the whole thing up. Like everyone else nowadays you start to google and with a chance of 99.99% you discover this great library for the Philipps PCD8544 controlled screen on the official Arduino website. This code is a very nice piece of work, but for people like me, who have very low experience with electronic devices, it is very hard to understand. Coming across a lot of websites and boards I noticed that many people have issues setting the Nokia 5110 lcd up. This fact was responsible for writing this blog post.
Let’s start wiring up the display to the Arduino. In my case the lcd came mounted on an PCB with eight header pins which can be easily connected to a common breadboard. The materials you need for assembling this project are the following
- Arduino (or Arduino-compatible board)
- Nokia 5110 display
- Jumper wires
- Current limiting resistor with at least 180 Ohm (if you want to use the displays backlight)
A link on the website of the displays retailer referred to a datasheet. Well, more precisely said it linked to the displays controller datasheet. For me as an non-professional it looked very disturbing. So after long studying and wondering where to start I analyzed the sample code on the Arduino website.
#define PIN_SCE 7 // LCD CS .... Pin 3 #define PIN_RESET 6 // LCD RST .... Pin 1 #define PIN_DC 5 // LCD Dat/Com. Pin 5 #define PIN_SDIN 4 // LCD SPIDat . Pin 6 #define PIN_SCLK 3 // LCD SPIClk . Pin 4 // LCD Gnd .... Pin 2 // LCD Vcc .... Pin 8 // LCD Vlcd ... Pin 7
Comparing the mentioned connectors with the named ones on my PCB I came across the problem that the SPIDat (the serial input connection) was not present on my board. Instead there was a pin named DN-MOSI which is just another name for the serial-in port. In the example above there are also three pin connections that are not assigned to a pin number on the Arduino because there are two possibilites to wire them up. A look in the datasheet shows that the controller is running with an Vcc of 3,3V. So the options are to connect the display to the 3,3V anlog pin or to a PWM-capable digital port with reduced voltage.
The connection of the backlit can be solved by using a 5V pin in combination with a current limiting resistor. It is up to you which port you use. Choosing an PWM-capable port has the advantage of adjusting the displays brightness simply by code. Connecting the GND should be clear. My final connection looks like this.
And here the code:
#define PIN_SCE 12 #define PIN_RESET 10 #define PIN_DC 9 #define PIN_SDIN 11 #define PIN_SCLK 13 #define PIN_LED 6
In the next part I will give you a detailed explanation of the 5110 LCD Library.