Tuesday, 23 June 2015

Simple nodemcu module to drive a nokia LCD (PCD8544)

I desperately wanted to hook a Nokia5110 LCD to my ESP8266/nodemcu. I wrote a LUA module but it was slow and it was taking too much memory, mainly because the font data needs to stay in the precious RAM.

It looks like anything I do ends up taking too much memory, so the way to go is to write modules in c and then invoke them from LUA. I am very pleased with the results, so here it is for you to use: Download (just for fun the lua module and the image are also included)

You can use it this way:
  • pcd.init()
  • pcd.locate(0,0)
  • pcd.print("Hello world!")
And if you want to display images you can do it this way:
  • pcd.init() 
  • file.open("image.bin", "r") 
  • pcd.printbin(file.read()) 
  • file.close()
I already sent a pullrequest to the nodemcu guys, it may not get accepted as the pins needed are hardcoded :/ 


  1. Great electronics tips. I had been looking for information on coding. This will greatly help with a project that I am currently working on. I might need to bring a question or two, to find out more. It is great how much education tips and resources can be found over time on the internet. It makes my life much easier.

    Brian Hopkins @ Microtips USA

  2. Way cool! Next time you run into memory problems with the NodeMCU firmware give http://nodemcu-build.com a try. It allows you to easily build a firmware with only those modules enabled that you actually need.

    1. hey, I was building myself nodemcu and compiling it with the minimal requirements. I even coded my own modules that require less memory than the default ones. No luck, i moved to arduino-Esp8266 and all works like a charm :)

  3. This is awesome, I've been wanting to get into this kind of coding for a while now and have found your blog really informative. You provide some really cool tips that will definitely help me on my next project, I have also ran into memory issues in the past so I found this really helpful. Thanks for writing such a great blog!

    Raymond @ CKS Global Solutions LTD