Nokia 5110 LCD (PCD8544)
Recently I bought a couple of Nokia 5110 LCD’s which are not only very cheap but also very good for starters to get used to working with graphic displays. These displays are available in two flavours: one with blue backlight and the other with white. See figures below.
So, I decided to program it to my best possible. I found a library by André Wussow. However, this library uses bit-banging technique to send the data to the LCD. After lot of experimentation with the timings, I achieved only a frame rate as low as 4 fps. This is unacceptable for me. So, I modified the library to support hardware SPI in addition to the fall-back bit-banging method. I added some new functions, improved most of the functions, added installation scripts, etc. as we will later see that with hardware SPI frame rates are achieved up to 345 fps at a 2MHz SPI communication rate.
- Raspberry Pi I Model B
- Nokia 5110 LCD Module
- 5v regulated power supply
- 8 wires
For the SPI configuration, I used the following pin connections as shown in the diagram below.
Note that I have used DC pin and RST pin to the GPIO pins only as obvious. After all the necessary connections, the whole setup looked like the following figure below.
Although the hardware part was easy, the software part needed a considerable portion of labour as the bit-banging tweaking was really painful with almost no benefit.
- WiringPi (the GPIO library)
- LibPCD8544 (the LCD driver-cum-API)
- Libbff (for handling bitframe files)
- Libdither (for dithering images and videos)
- OpenCV (>2.3.1) (for opening images and videos) (recommended)
I took 2 samples of dithered bit-frame videos (one with 882 frames and the other with 3524 frames) which were converted using OpenCV library and dithered using libdither library.
Since, I used an SPI frequency of 2 MHz, a simple calculation reveals that theoretically the frame rate can go up to 496 fps. With libPCD8544 driver and API, I was able to play the videos at least at a frame rate of 345 fps.
3-D Wire-frame Rendering
Next I went one step further. I installed a 3-D mesh library meshlib and used it to open 3-D models and render their wire-frames using software and displaying rotating animations of them on the LCD module. See the figures below.