Arduino count up timer using the Nokia 5110 LCD


LCDs are the easiest way to display data out of your electronics project and they are widely used in electronics. The most popular ones are alphanumeric ones, just like the one we used in this project.

What if you need to display more complex data or graphics? One of the cheapest solutions to this is to use is the well known Nokia 5110 LCD display. This LCD is as cheap as $4. It has a 84 x 84 pixels screen size. The Nokia 5110 LCD display communicates with Arduino over SPI which reduces the number of pins needed to connect the LCD.

I will suggest you check these Arduino projects where we made use of LCDs before coming back to this one if you haven’t yet.

Parts needed

Not a lot is needed for this project.

Once you have all the components, use the schematic below to build the project. Note the VCC of the LCD must be connected to 3.3V. Connecting it to 5V might destroy it. Make sure you double check that before connecting your project to power.

One pin of the LCD is not connected. It is labeled as BL, the LED or LIGHT (this depends on the LCD manufacturer). This pin is for the backlight. If you intend to use the screen in the dark, feel free to connect it to 3.3V. In my case, the backlight LED is blue but might be different in yours.

Before uploading the code, we have to install two libraries. To download the first one, type “5110” in the libraries manager and select one from Adafruit. The second library is also made by Adafruit and it is called Adafruit_GFX. If you don’t know how to install those libraries, check out this tutorial. When those two libraries are installed, upload the code below to the Arduino.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(6, 5, 4, 3, 2);

int x = 0;
String text = " Hi, welcome to Tutorial45.com";
void setup() {
display.begin();
display.clearDisplay();
display.setContrast(60);
}
void loop() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK);
display.println(text.substring(x, x+13));
x++;
if(x > 42)
{
x = 0;
}
display.setTextSize(5);
display.println(millis()/1000);
display.display();
delay(300);
}

This code will show seconds based on the millis() function. It simply counts up in seconds.

And That’s all. Hope all went fine for you. Remember the comment section is just down below, in case of any question.

tchouken2

Related Posts