Previously we talked about choosing displays for Arduino. At that time we had no idea that Nokia 5110 Arduino modules are made out of used Nokia 5110 like thrown away phones. After knowing the background story, we really can not suggest this thing to buy. Buying a color LCD, TFT display for Arduino is correct option. Raspberry like single board computers supports high resolution displays and we really want to keep two segments different. If you purchased a basic Arduino LCD at cheap rate then here is Nokia 5110 Arduino wiring, technical details, code. This guide will also give you idea about troubleshooting of common problems.
Nokia 5110 Arduino Wiring: Basic
At minimum you need :
- Nokia 5510LCD
- Arduino board
- Jumper Wires
- Bread Board
Connections are as follows, =
sign means you need to connect them :
---
- SCK or CLK = Pin 7 of Arduino
- MOSI or DIN = Pin 6 of Arduino
- DC = Pin 5 of Arduino
- RST = Pin 3 of Arduino
- CS or CE = Pin 4 of Arduino
- VCC = 3.3 volt of Arduino
- BL = 3.3 volt of Arduino
- GND = ground of Arduino
The above is basic minimum setup enough good for testing, but not good to run more than 10-15 minutes. You should add a 1kΩ resistor between SCE (or CE) and Arduino pin. That is what we have shown in the photographs :
Nokia 5110 Arduino Wiring: Advanced
You really need some resisters between the pins of the module and Arduino. VCC supplies the logic circuits inside the LCD and datasheet the supply should be between 2.7V and 3.3V. So it is practical to add a resistor to supply around 3.0V to the module. In a normal state, the LCD will consume about 6 or 7mA. BL is the second voltage supply and is required for the LED backlights. Those LEDs of backlights has no current limiting resistors. In this case also it is practical to add a resistor to supply around 3.0V to the BL pin of the module. 330Ω resistors should work for both of them. Check end voltage with multimeter (we have multimeter using guide for dummies).
You should add a 1kΩ resistor between SCE (or CE) and Arduino pin. The others – SCLK (or CLK), DIN, DC, and RST pins should have 10kΩ resistors. You can lower the values of 10kΩ resistors to 1kΩ resistor if does not work.
Sparkgun written to hookup using an actual level converters to switch between 5V and 3.3V. Boards like the Bi-Directional Logic Level Converter and the TXB0104 are perfect. We have not tested, does not worth effort or investment of money.
Installing Nokia 5110 Arduino Libraries And Examples
Open Arduino IDE. You can install the libraries to make it working from Arduino software user interface. Go to Sketch > Include Library > Manage Libraries. Search with Nokia 5110
on the window which will open. Install Adafruit PCD8544 Nokia 5110 LCD Library. Search with Adafruit GFX
and install Adafruit GFX Library. Search with OakOLED
and install OakOLED Library. Restart the Arduino IDE. After restart, connect Arduino with computer, go to File > Examples > Adafruit PCD8544 Nokia 5110 LCD library > pcdtest. Upload it and check whether you can see things on Nokia 5110 LCD display.
We used this example sketch for the photograph :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 void setup() { Serial.begin(9600); display.begin(); display.clearDisplay(); display.setContrast(70); display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0,0); display.println("@AbhishekCTRL"); display.setTextSize(1); display.setTextColor(BLACK); display.println(" "); display.setTextColor(WHITE, BLACK); display.setTextSize(1); display.println("#AbhishekGhosh"); display.setTextSize(1); display.setTextColor(BLACK); display.println(" "); display.setTextSize(2); display.setTextColor(BLACK); display.println("Read..."); display.display(); } void loop() { } |
Here is an informative library with some more examples :
1 | https://github.com/carlosefr/pcd8544 |
You need Bitmap converter for the LCD. For Mac, here is a DMG file which will help you to convert images to bitmap :
1 | http://www.csmithsoftware.com/LCD_Creator/LCD_Creator.dmg |
Here is a font creating tool :
1 | https://github.com/pavius/The-Dot-Factory |
Nokia 5110 Arduino Wiring : Technical Details, Troubleshooting
LCD can appear fade. This depends on how the used LCD was. It is matter of luck. Not all Nokia 5110 LCDs are the same, although they look identical. Even the connector wiring can be completely different. Philips PCD8544 is the LCD driver for this module. Nokia 5110 LCD has 5 control lines and the interface is of the type SPI.
Here is PDF of Nokia-5110-datasheet manufactured by Goldentek Display System Company in 2001. Here is PDF of Phillips PCD8544 – pcd8544.
More Examples With Nokia 5110 Arduino : Stopwatch, Display Capabilities
Install more two libraries :
1 2 | https://github.com/geneReeves/ArduinoStreaming https://github.com/thomasfredericks/Metro-Arduino-Wiring/tree/master/Metro |
Create a stopwatch library :
1 | http://www.avdweb.nl/arduino/libraries/stopwatch.html#h5-stopwatch-library |
Connect :
CE to 9;
CLK to 13;
DIN to 11;
DC to 12;
RST to 10;
and run this code, load this sketch to a timer watch.
And with the same pin connection, run this code (it is from the above website) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #include <Streaming.h> #include <Metro.h> const byte PWMDACpin = 9; // CE const byte NokiaSCLKpin = 13; //CLK const byte NokiaDNpin = 11; // DIN Pin const byte NokiaDCpin = 12;// DC Pin const byte NokiaRESETpin = 10;// RST Pin const char LCDcontrast = 55; int i; #include "Stopwatch.h" Stopwatch stopwatch(micros); Adafruit_PCD8544 nokia(NokiaSCLKpin, NokiaDNpin, NokiaDCpin, 0, NokiaRESETpin); Metro LCDinitTimer(2000); void setup(void) { Serial.begin(9600); nokia.begin(); nokia.setContrast(LCDcontrast); nokia.clearDisplay(); nokia << "Hello!\n"; // without using F nokia << F("Save RAM with the Flash library\n"); // use F to save RAM space nokia.display(); nokia.setContrast(LCDcontrast); } void loop(void) { stopwatch.start(); nokia.clearDisplay(); nokia << F("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor ") << i++; nokia.display(); if(LCDinitTimer.check()) nokia.begin(LCDcontrast); stopwatch.stop(); // test Serial << stopwatch.counter << " " << stopwatch.interval << " " << stopwatch.maxInterval(1) << "\n"; } void findBestContrast(int contrastMin, int contrastMax, int _delay) { for(int contrast=contrastMin; contrast<=contrastMax; contrast++) { nokia.clearDisplay(); nokia.setContrast(contrast); nokia << F("12345678901234"); nokia << F("12345678901234\n"); nokia << F("bla bla bla bla bla bla\n"); nokia << contrast; nokia.display(); delay(_delay); } } |