Nokia 5110 is an LCD display with lots of libraries for Arduino

I’m currently working on NodeMCU v3 (which is a modified 1.0, check out A fake NodeMCU?). I’m using Arduino 1.8.3.

To set it up with the NodeMCU you’d have to do a lot of searching for the library, it took me days to find it due to false or outdated information. Using the Arduino library I got “avr/pgmspace.h”, and trying to fix that returned more and more errors. Here’s what worked for me:

1. LCD Library. You need to go to this link. It’s a branch of the Adafruit’s library made by  . That will solve most of your problems you’d usually have with the original library, as it’s made for Arduino.

2. Using it. Now that you have the library, open Arduino-IDE, go to File -> Examples -> Adafruit PCD8544 Nokia 5110 LCD library. Open up a random example (I only had one), observe how it’s made, connect pins as shown in the commented text or modify the connections.

3. You’re done! Upload the code and look at the demo!

If you want to display your own .BMP files, then you’ll need 2 programs:
• Paint.NET
• LCD Assistant

Before using LCD Assistant, make sure you create ONLY .bmp files with Paint.NET and that their resolutions are ALWAYS a power of 2, as well as ONLY black and white (NOT GRAYSCALE!). LCD Assistant’s options should be:

  • Byte orientation: Horizontal
  • Size: (Automatic when loading image)
  • Other: Do not include size
  • Size endianness: Little
  • Pixels/byte: 8

If you did everything correct, it LCD Assistant should give you a file. Open that file with a notepad and enter the hex code into the bitmap array in the example, removing the old text. Make sure you adjust the resolution definitions, too!

Note: Careful not to overflow the controller with information. I did once, it didn’t do any damage though (and it shouldn’t). I tried using ~8 images of about 24×24 size. It just displays the default flower bmp if that happens, instead of the bmp I told it to display. Make sure you don’t pass whole arrays as parameters into functions, as that would create a temporary copy, which would double the memory it needs.

Here’s my code, it displays some memes and can “make it rain” with many different images at the same time: Meme code (it’s written overwhelmingly sloppy, you probably don’t need it).

Advertisements