Detailed tutorial on connecting and programming the Nokia 5110 LCD. In this first part I'm only concerned with sending the bare minimum of commands so that something appears on the screen (all pixels on in this case).
Code is written from scratch, no libraries are used in this tutorial. Code is listed below.
#define RST 12
#define CE 11
#define DC 10
#define DIN 9
#define CLK 8
void LcdWriteCmd(byte cmd)
{
digitalWrite(DC, LOW); //DC pin is low for commands
digitalWrite(CE, LOW);
shiftOut(DIN, CLK, MSBFIRST, cmd); //transmit serial data
digitalWrite(CE, HIGH);
}
void setup()
{
pinMode(RST, OUTPUT);
pinMode(CE, OUTPUT);
pinMode(DC, OUTPUT);
pinMode(DIN, OUTPUT);
pinMode(CLK, OUTPUT);
digitalWrite(RST, LOW);
digitalWrite(RST, HIGH);

LcdWriteCmd(0x21); // LCD extended commands
LcdWriteCmd(0xB8); // set LCD Vop (contrast)
LcdWriteCmd(0x04); // set temp coefficent
LcdWriteCmd(0x14); // LCD bias mode 1:40
LcdWriteCmd(0x20); // LCD basic commands
LcdWriteCmd(0x09); // LCD all segments on
}
void loop()
{
}

By Julian

Youtuber, shed dweller, solar charge controller aficionado

13 thoughts on “Arduino nokia 5110 lcd tutorial #1 – connecting and initial programming”
  1. Avataaar/Circle Created with python_avatars kamus suwanto says:

    Very nice tutorial. You added code in description is what everyone like. Thank you

  2. Avataaar/Circle Created with python_avatars ham says:

    good tutorial

  3. Avataaar/Circle Created with python_avatars Sana Ne says:

    How much mA does this display consumes at its maximum?

  4. Avataaar/Circle Created with python_avatars Sheev Palpatine says:

    your code doesn't compile. I get "macro names must be identifiers"

  5. Avataaar/Circle Created with python_avatars B Gable says:

    I just had to drop a comment here. I've finally got around to working with this display. And low and behold, after viewing many YT video, this one potted up. 2013, wow, I had to watch it. Yes, we've come a long way in how things used to be done. I've watched MANY of your others videos. Great content, interesting and amusing too. And yes, I've come to realize that the data sheets are the Bible of how things work. Thanks for all the time and effect! Now on to part II

  6. Avataaar/Circle Created with python_avatars Kshitij Kolhe says:

    I had bought the lcd and had connected by looking at the goodled images of wiring diagrams. Your video has provided with a huge help in correcting my mistake. I was completely fed up of the display as it wont work, but this tutorial was just too good and was a huge help. Thanks 🙂

  7. Avataaar/Circle Created with python_avatars Ali Yousefi says:

    Hey man , thanks a lot .
    It is the best tutorial I've ever seen.
    Actually I had problem with the contrast of screen that I fixed it with your tutorial.
    Thanks a lot.
    👌👍🙏

  8. Avataaar/Circle Created with python_avatars Darius says:

    Can I use other I/O pins?

  9. Avataaar/Circle Created with python_avatars David Wanklyn says:

    Helped me to sort out my vague display with an adjustment to the contrast in a line of code. Thanks.

  10. Avataaar/Circle Created with python_avatars free electron says:

    Thanks Julian just what I needed to get going with my Nokia display and Nano.

  11. Avataaar/Circle Created with python_avatars Vaidehi Phaltankar says:

    Did u add any external library like pcd8544??

  12. Avataaar/Circle Created with python_avatars Tate Geiger says:

    "Take it to bed" lol I'm not the only one.

  13. Avataaar/Circle Created with python_avatars Žiga Lausegger says:

    Arduino projects look like a joke compared to real embedded programming.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.