I've bought myself a Nokia 5110 LCD display on eBay, with the intention of visualizing my RPi data. Here's how I got it working.
The Nokia LCD is just an old-ish (few scratches on the front) mobile display, but what is special about it, is that it is really good in presenting data. This little 84Ã—84 pixel monochrome screen is backlit and very easy to use. Eight pins on the circuit board under the screen are well described on the front, so there is no problem with connecting it to the RPi pins. The pins are:
1-RST - Reset
2-CE - Chip Enable
3-DC - Data/Command
4-DIN - Serial Input
5-CLK - Clock Input
6-VCC - Power
7-BL - LED Backlight
8-GND - Ground
The board is fully assembled and soldered, so no soldering knowledge is needed. It's just plug'n'play.
To get it working with the the Raspberry Pi you have to connect the LCD pins to correct pins on your Pi:
LCD --> RPi RST --> pin 18 (GPIO24) CE --> pin 24 (SPI_CE0) DC --> pin 16 (GPIO23) DIN --> pin 19 (SPI_MOSI) CLK --> pin 23 (SPI_SCLK) VCC --> pin 1 (3v3) LED --> pin 12 (GPIO18) to allow varying the brightness GND --> whichever GND pin is convenient
If you are not sure which pin is where, have a look at this useful Pinout page, created by Gadgetoid.
For the purpose of my testing, I've connected it like this:
Note: If you want to reproduce this assembly, check carefully the pin order, it may be different, as the pins on the LCD boards differ!
And here is the LCD sitting on a breadboard connected to my RPi. It's quite messy, but works for now.
To use the PCD8544 display we need to install some software and load a kernel module. For this I've used *wiringpi2 *from drogon.net
git clone git://git.drogon.net/wiringPi cd wiringPi ./build
Once *wiringpi *is installed, it is possible to test it with the following command:
with the output of something like this:
Now, install the python binding of wiringpi:
sudo apt-get install python-dev python-imaging python-imaging-tk python-pip sudo pip install wiringpi wiringpi2
The program we will use require spidev to be activated. The kernel module should then be activated.
To do so, comment the line
by adding a heading
# in the file
/etc/modprobe.d/raspi-blacklist.conf, so it reads
then reboot the Raspberry Pi to activate this module.
Finally, we install spidev python library:
sudo pip install spidev
The prerequisite are now installed. In next chapter we will see how to install the python library in charge of driving the LCD and how to use it.
Once the drivers and modules were installed, it's time for the base to control the LCD.
The library written Richard Hull's can be directly installed on the Raspberry Pi.
To install it, execute the following commands:
git clone https://github.com/XavierBerger/pcd8544.git cd pcd8544 ./setup.py clean build sudo ./setup.py install
You can now test the installation with the proposed examples:
cd examples sudo ./pi_logo.py
If installation works properly, you should see the following screen:
If you don't see anything, or only the backlight is on, try reconnecting the pins (I myself did few mistakes with wiring before I got it working!). If that doesn't help, type:
and try again. If that fails, restart your Pi.
You can try to execute other examples to see what the library is capable to do with this LCD.
So, the display works, now it's time for some programming! I will post my adventures with the screen here in the nearest future.
I was playing with displaying custom characters on the screen, and I've found a nice online tool where you can create your own glyphs to be displayed on your LCD screen. Just go here: PCD8544 Glyph Editor. The output is a sequence of bytes in hexadecimal "C" format that can be pasted into your python code. It is used in one of the examples under
~/pcd8544/examples/ directory, called