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 :/