Arduino, Nokia 5110 LCD module and any picture



Probably, like all Arduino-builders, I had some kind of crazy idea in my head. I ordered all the necessary parts in China. We had to wait a very long time, but here a clone of the Arduino Uno board and the Nokia 5110 LCD display were delivered ahead of schedule . Since before that I was not familiar with electronics and programming, I decided not to waste time in vain and began to learn how to display information on this module.

First of all, I googled and got to the publication “Arduino, Nokia 5110 LCD module and Cyrillic alphabet” by Shrim . And then I realized that everything that I had planned before would not be so easy to do.

I figured out the Cyrillic alphabet, everything is simple there, I won’t copy-paste the last post, but the picture is really a problem. The task is: you need to draw a picture and fill it on the display. Faced the first problem, I went into the Arduino programming environment, I saw that there isn’t such a thing as “Insert - Images”, but you need to record a picture with a certain code in a hex calculus system . I found several editors, but it wasn’t there. The picture is not adequately displayed. I started looking for problems that could be.

The method of a bunch of experiments, attempts and trials resulted in an algorithm that I will share with you:

1) You need to get the picture itself, in black and white .bmp format with an extension of 84 x 48 pixels.
You can do this in a bunch of ways, almost every graphic editor has a “Save As” function where we specify the necessary parameters.
I did in corelDRAW . We get something similar. It is necessary to clarify that the name of the picture must be saved by the Latin keyboard layout, since the next program will not be able to open it.

image

2) If necessary, you can edit the picture in paint, oddly enough, there are several simple and interesting tools.



3) Using GLCD Tools we get the hex code of the picture.

image

4) We insert this code into the Arduino program code and fill it on the board:

//      SCK  - Pin 8
//      MOSI - Pin 9
//      DC   - Pin 10
//      RST  - Pin 11
//      CS   - Pin 12
//
#include 
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t OKO[];
float y;
uint8_t* bm;
int pacy;
void setup()
{
  myGLCD.InitLCD();
}
void loop()
{
  myGLCD.clrScr();
  myGLCD.drawBitmap(0, 0, OKO, 84, 48);
  myGLCD.update();
  delay(2000);
}


#include 
const uint8_t OKO[] PROGMEM={
//Скопированный hex-код  GLCD tools
};


image

Also popular now: