zondag 30 december 2012

Nokia LCD on Raspberry Pi GPIO

Using a Nokia PCD8544 LCD screen on a Raspberry Pi 

Old Nokia LCD screens, once used for playing snake, are now a great source for your DIY projects. They are widely available, cheap, graphical and easy to use thanks to all the PCD8544 libraries available on the Internet. PCD8544 is the name of the chip used to drive these displays.

Since this is a 3.3v display after all a 3.3V microcontroller (like the arduino mini and mini pro) or even the raspberry pi might be a better controller for this. These are the connections to use it with the library available from https://github.com/binerry/RaspberryPi/tree/master/libraries/c/PCD8544 . More instructions available at http://binerry.de/post/25787954149/pcd8544-library-for-raspberry-pi .
VDD => 3V3
D/C => GPIO2
VOUT => x
As long as you get these connections right there isn't much to worry about. Just double check that. On the below picture you can see how I got the small 1.5mm spaced connectors to something reasonable. You won't have to do this if you get a pcd8544 on a breakout board.

Now on a virgin raspbian wheezy image these are all the commands (in that sequence) you'll need to get the lcd working as a status screen. Open a terminal and ssh to your pi (ssh  with matchin the ip of your pi). Default password for username pi is raspberry. Now from the shell execute these commands on your raspberry. You might have to hit ENTER when apt-get prompts for it.
sudo apt-get update
sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
Now you have the wiringPi library installed from https://projects.drogon.net/raspberry-pi/wiringpi/ Continue with the installation of the PCD8544 library. To simplify the compilation I also moved the sample into the current working directory. You can skip that but you'll need to check the paths in the cc command then.
wget https://github.com/downloads/binerry/RaspberryPi/Raspberry.Pi_PCD8544.Library.zip
unzip Raspberry.Pi_PCD8544.Library.zip 
mv ./samples/pcd8544_rpi.c ./
cc -o pcd8544_rpi pcd8544_rpi.c PCD8544.c  -L/usr/local/lib -lwiringPi
And at this point you'll have the pcd8544_rpi program compiled (if you didn't get any errors). Now to execute it run the following command. Again check your wires!
sudo ./pcd8544_rpi
You should get the following message on your terminal (and a working lcd screen) if all is OK.
Raspberry Pi PCD8544 sysinfo display
This is how it looks on the screen. Oh and don't mind the mess, once I moved in definitely all these wires will be running inside a wall hidden from human vision.

Geen opmerkingen:

Een reactie plaatsen