Arduino library · Displays

Adafruit PCD8544 Nokia 5110 LCD library: an example that runs

Yes. You can use the Adafruit PCD8544 Nokia 5110 LCD library online in Mokxi with nothing to install, and the sketch runs in your browser against the simulated part (Nokia 5110 display, PCD8544). The example below, "Text and a circle on a Nokia 5110 LCD", runs on the Arduino Uno R3.

Built in on Mokxi: #include <Adafruit_PCD8544.h> and it builds, with nothing to install. Free, and no account needed.

What Adafruit PCD8544 Nokia 5110 LCD library does

The Nokia 5110 84x48 LCD. That is what Adafruit PCD8544 Nokia 5110 LCD library covers. The sketch below uses it on the Arduino Uno: “Text and a circle on a Nokia 5110 LCD”.

The Nokia 5110 the way the tutorials drive it.

setContrast(v) is Vop, the LCD voltage: 0x21, 0x80 | v, 0x20. The part shows nothing below about 20 and darkens from there, so a sketch that never sets it sees a blank glass, as on the bench. begin() sets the contrast it is given, 40 by default, and bias 4.

The calls follow release 2.0.3 of the library, so a sketch written here builds on a real board too. The example is the one Mokxi's own tests build and run, so what is printed here is what runs.

Library Manager nameAdafruit PCD8544 Nokia 5110 LCD library
AuthorAdafruit
Include#include <Adafruit_PCD8544.h>
Boardsevery board Mokxi compiles for but ATtiny85
In the simulatorSimulated: it runs against the part the way it does on the bench.
Parts it drivesNokia 5110 display, PCD8544

Install it

It builds on every board Mokxi compiles for but ATtiny85.

In Mokxi it is built in: #include <Adafruit_PCD8544.h> and the sketch compiles, with no download, no zip and no Library Manager.

On a real board, install "Adafruit PCD8544 Nokia 5110 LCD library" by Adafruit from the Arduino IDE’s Library Manager (Sketch, Include Library, Manage Libraries), or add Adafruit PCD8544 Nokia 5110 LCD library to lib_deps in PlatformIO. Mokxi follows the calls of release 2.0.3, so a sketch written here builds there too.

The calls you will use

In the order a sketch meets them.

Adafruit_PCD8544 display(7, 6, 5, 4, 3)

Makes display, the Adafruit_PCD8544 object the calls below are made on.

display.begin()

Starts it up and returns true if it started, false if it did not. Call it once in setup().

display.setContrast(50)

Sets the contrast to the value you pass in. Arguments: value.

display.clearDisplay()

Clears the display.

display.display()

Sends what has been drawn to the screen. Nothing appears until you call it.

Example: Text and a circle on a Nokia 5110 LCD

On the Arduino Uno R3. It runs in the browser exactly as printed.

sketch.ino · Arduino Uno R3
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

// CLK, DIN, DC, CE, RST: any five pins.
Adafruit_PCD8544 display(7, 6, 5, 4, 3);
#define BACKLIGHT 8

void setup() {
  Serial.begin(9600);
  pinMode(BACKLIGHT, OUTPUT);
  digitalWrite(BACKLIGHT, HIGH);
  display.begin();
  display.setContrast(50);   // nothing shows below about 20
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(BLACK);
  display.setCursor(0, 0);
  display.println("Nokia 5110");
  display.drawCircle(60, 30, 12, BLACK);
  display.fillRect(6, 24, 24, 16, BLACK);
  display.display();
  Serial.println("drawn");
}

void loop() {}

Wiring

  • Arduino Uno R3 3 to Nokia 5110 display, PCD8544 RST
  • Arduino Uno R3 4 to Nokia 5110 display, PCD8544 CE
  • Arduino Uno R3 5 to Nokia 5110 display, PCD8544 DC
  • Arduino Uno R3 6 to Nokia 5110 display, PCD8544 DIN
  • Arduino Uno R3 7 to Nokia 5110 display, PCD8544 CLK
  • Arduino Uno R3 8 to Nokia 5110 display, PCD8544 LIGHT
  • Arduino Uno R3 5V to Nokia 5110 display, PCD8544 VCC
  • Arduino Uno R3 GND to Nokia 5110 display, PCD8544 GND

Open it in the editor, wired and ready to run

Try Adafruit PCD8544 Nokia 5110 LCD library without installing anything

Open the example, change the sketch, and keep your version in a free account.