How To Connect LCD Display For Nokia 5110 To Arduino

Table of contents:

How To Connect LCD Display For Nokia 5110 To Arduino
How To Connect LCD Display For Nokia 5110 To Arduino

Video: How To Connect LCD Display For Nokia 5110 To Arduino

Video: How To Connect LCD Display For Nokia 5110 To Arduino
Video: Arduino Tutorial: Nokia 5110 84x48 LCD display, how to drive with Arduino 2024, December
Anonim

Let's figure out how to connect a liquid crystal monochrome display with a resolution of 84x48 pixels from Nokia 5110 to Arduino.

LCD display for Nokia 5110
LCD display for Nokia 5110

Necessary

  • - Arduino;
  • - LCD display for Nokia 5110/3310;
  • - connecting wires.

Instructions

Step 1

Let's connect the LCD screen from Nokia 5110 to Arduino according to the diagram below.

Connection diagram of Nokia 5110 LCD screen to Arduino
Connection diagram of Nokia 5110 LCD screen to Arduino

Step 2

Many libraries have been written to work with this LCD screen. I suggest using this one: https://www.rinkydinkelectronics.com/library.php?id=44 (download the LCD5110_Basic.zip file).

To install, unzip the file into the Arduino IDE / libraries / directory.

The library supports the following features.

LCD5110 (SCK, MOSI, DC, RST, CS); - announcement of the LCD screen indicating the correspondence to the pins of the Arduino;

InitLCD ([contrast]); - initialization of the 5110 display with an optional indication of contrast (0-127), the default is 70;

setContrast (contrast); - sets the contrast (0-127);

enableSleep (); - puts the screen into sleep mode;

disableSleep (); - brings the screen out of sleep mode;

clrScr (); - clears the screen;

clrRow (row, [start], [end]); - clearing the selected row number row, from position start to end;

invert (true); and invert (false); - turning on and off the inversion of the contents of the LCD screen;

print (string, x, y); - displays a string of characters with the specified coordinates; instead of x-coordinate, you can use LEFT, CENTER and RIGHT; the height of the standard font is 8 points, so the lines must be spaced at 8 points;

printNumI (num, x, y, [length], [filler]); - display an integer on the screen at a given position (x, y); length - the desired length of the number; filler - a character to fill the "voids" if the number is less than the desired length; the default is an empty space ";

printNumF (num, dec, x, y, [divider], [length], [filler]); - display a floating point number; dec - number of decimal places; divider - decimal point, dot "." by default;

setFont (name); - choose a font; the built-in fonts are named SmallFont and TinyFont; you can define your fonts in the sketch;

invertText (true); and invertText (false); - text inversion on / off;

drawBitmap (x, y, data, sx, sy); - display the picture on the screen at the x and y coordinates; data - an array containing a picture; sx and sy are the width and height of the picture.

Step 3

Let's write such a sketch. First, we include the library, then we declare an instance of the LCD5110 class with pin assignments.

In the setup () procedure, we initialize the LCD screen.

In the loop () procedure, clear the screen and write arbitrary text in a small font, under it, in a medium font, display the counter of seconds.

Sketch for displaying text on the LCD screen Nokia 5110
Sketch for displaying text on the LCD screen Nokia 5110

Step 4

Let's display a picture. To do this, let's prepare a monochrome image that we want to display on the Nokia 5110. Remember that the screen resolution is 48 by 84 pixels, and the picture should not be larger. On the page https://www.rinkydinkelectronics.com/t_imageconverter_mono.php convert the image to a bit array. Download the resulting file with the "*.c" extension and add it to the project via the menu: Sketch -> Add File … or simply place the file in the sketch directory and then reload the Arduino IDE.

Add an image file to your Arduino project
Add an image file to your Arduino project

Step 5

Now you need to declare an array with image data in the program code (in my code this is the line extern uint8_t mysymb;), and then use the drawBitmap () function to display the image in the desired place on the screen.

Displaying images on the LCD screen Nokia 5110
Displaying images on the LCD screen Nokia 5110

Step 6

Upload the sketch to Arduino. Now the text is replaced by a picture, and the counter increases its value each time.

Recommended: