Nokia 5110 retro display games
Build it step by step
0 of 6 doneWire the display
Connect the 3V3, GND and five signal lines through 10 kΩ resistors.
Draw text
Use the Adafruit PCD8544 "pcdtest" example and set the contrast.
Add the backlight
Wire the backlight pin through 330 Ω and check which level turns it on.
Add buttons
Wire the five buttons to the pins in the table.
Upload Snake
Steer to the food dot and watch the snake grow.
Measure the current
Put the meter in the 3V3 line to see the tiny draw with the backlight off.
How do you build a nokia 5110 retro display games?
The old Nokia phone screen shows Snake and text with very low power, driven from a 5 V Nano. You need Arduino Nano, Nokia 5110 LCD (PCD8544), Tactile push button 6 mm × 5, Resistor 10 kΩ × 5, Resistor 330 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- DisplaysBuy
- SwitchesBuy
- PassivesBuyResistor 10 kΩ × 5
- PassivesBuyResistor 330 Ω × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 5110 VCC | Nano 3V3 | Display runs at 3.3 V |
| 5110 GND | Nano GND | Ground |
| Nano D8 | 10 kΩ resistor then 5110 CLK | Clock (series resistor protects the 3.3 V input) |
| Nano D9 | 10 kΩ resistor then 5110 DIN | Data |
| Nano D10 | 10 kΩ resistor then 5110 DC | Data or command |
| Nano D11 | 10 kΩ resistor then 5110 CE | Chip select |
| Nano D12 | 10 kΩ resistor then 5110 RST | Reset |
| Nano D3 | 330 Ω resistor then 5110 BL | Backlight (check your module, some are active low) |
| Up, down, left, right buttons | Nano D4, D5, D6, D7 and GND | Game controls |
| Backlight button | Nano D2 and GND | Toggles the backlight |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "Adafruit PCD8544 Nokia 5110 LCD library" and "Adafruit GFX Library". The display is a 3.3 V part, so it is powered from the Nano's 3V3 pin and its signal lines pass through 10 kΩ series resistors, a common low-cost arrangement that relies on the chip's input protection. For a fully rated design use a proper level shifter. Adjust setContrast (40 to 70) until the pixels look right.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 lcd(8, 9, 10, 11, 12); // CLK, DIN, DC, CE, RST
const byte UP = 4, DOWN = 5, LEFT = 6, RIGHT = 7, LIGHT = 2, BL = 3;
const byte W = 21, H = 12, CELL = 4; // 84 x 48 pixels in 4-pixel cells
byte sx[60], sy[60];
byte len, dx, dy, fx, fy;
bool light = false;
void newFood() { fx = random(W); fy = random(H); }
void reset() {
len = 3; dx = 1; dy = 0;
for (byte i = 0; i < len; i++) { sx[i] = 10 - i; sy[i] = 6; }
newFood();
}
void setup() {
for (byte p = 4; p <= 7; p++) pinMode(p, INPUT_PULLUP);
pinMode(LIGHT, INPUT_PULLUP);
pinMode(BL, OUTPUT);
lcd.begin();
lcd.setContrast(55);
randomSeed(analogRead(A0));
reset();
}
void loop() {
if (!digitalRead(LIGHT)) { light = !light; digitalWrite(BL, light); delay(250); }
if (!digitalRead(UP) && dy == 0) { dx = 0; dy = -1; }
if (!digitalRead(DOWN) && dy == 0) { dx = 0; dy = 1; }
if (!digitalRead(LEFT) && dx == 0) { dx = -1; dy = 0; }
if (!digitalRead(RIGHT) && dx == 0) { dx = 1; dy = 0; }
for (byte i = len - 1; i > 0; i--) { sx[i] = sx[i - 1]; sy[i] = sy[i - 1]; }
sx[0] += dx; sy[0] += dy;
bool dead = sx[0] >= W || sy[0] >= H; // unsigned wrap catches the left and top walls
for (byte i = 1; i < len; i++) if (sx[i] == sx[0] && sy[i] == sy[0]) dead = true;
if (dead) {
lcd.clearDisplay(); lcd.setTextSize(1); lcd.setTextColor(BLACK);
lcd.setCursor(10, 14); lcd.print("Game over");
lcd.setCursor(10, 26); lcd.print("Score "); lcd.print(len - 3);
lcd.display(); delay(2500); reset(); return;
}
if (sx[0] == fx && sy[0] == fy && len < 60) { sx[len] = sx[len - 1]; sy[len] = sy[len - 1]; len++; newFood(); }
lcd.clearDisplay();
lcd.fillRect(fx * CELL + 1, fy * CELL + 1, 2, 2, BLACK);
for (byte i = 0; i < len; i++) lcd.fillRect(sx[i] * CELL, sy[i] * CELL, CELL - 1, CELL - 1, BLACK);
lcd.display();
delay(150);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Power on | Snake appears and moves right |
| Press buttons | Snake turns, but never straight back on itself |
| Eat the food | Snake grows by one and a new dot appears |
| Hit a wall | Game over with the score |
If it does not work
Blank screen
Raise or lower the contrast, and check RST and CE.
Garbled pixels
Check the order of CLK, DIN and DC.
Backlight never lights
Some modules are active low. Invert the BL write.
Snake does not turn
Check button wiring to ground and the pin numbers.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the nokia 5110 retro display games?
Arduino Nano, Nokia 5110 LCD (PCD8544), Tactile push button 6 mm × 5, Resistor 10 kΩ × 5, Resistor 330 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the nokia 5110 retro display games take to build?
About 90 minutes for a beginner maker, in 6 steps.
How do I know the nokia 5110 retro display games works?
Power on: Snake appears and moves right. Press buttons: Snake turns, but never straight back on itself. Eat the food: Snake grows by one and a new dot appears.
Blank screen: what should I check?
Raise or lower the contrast, and check RST and CE.
Garbled pixels: what should I check?
Check the order of CLK, DIN and DC.
Backlight never lights: what should I check?
Some modules are active low. Invert the BL write.
Snake does not turn: what should I check?
Check button wiring to ground and the pin numbers.
