How to connect and display a Halloween face on a open source Raspberry pi and a Nokia 5110 LCD scree
Hey friends makers,
how are you today?
I don't know if some of you remember that phone. It was the nokia 5110 with a nice LCD screen where you could play ''Snake'' on it. A game that became really famous back ih the day with the nokia cellphones. They were a little pbit expensive but you can now find them for a really grood price on the market and make crazy DIY things with them with electronics, embedded boards like the raspberry pi and the arduino and more.
But today we'll stay focus on the Raspberry pi, this LCD and of course allowing because it's halloween soon. So ''Trick or treat''??? :-))).
The purpose of this tutorial is to teach how to draw a halloween pumpkin head with a open-source like graphic software like GIMP or Photoshop for those of that got it even it's not free and open-source.
Here is the drawing i made and that I save with a ''Jpeg extension''.
So, to start the project, you need the following hardware:
A Raspberry pi
A 5110 Nokia LCD screen
A smartphone charger with a Micro USB head
A micro SD card, to load your operating system on it (Raspbian for the Raspbery pi)
You need now to wire the Nokia 5110 LCD screen and the raspberry py as follow:
Raspberry pi <-------> LCD screen 5110
3.3V <-------> VCC // Positive power supply
GND <-------> GND // Negative power supply
GPIO23 <-------> DC //
GPIO24 <-------> RST // Reset
MOSI <--------> DIN // Pin for he data
SCLK <--------> CLK // Clock for the SPI communication
CS0 <--------> CS // Chip select
After installing your operating system on your Raspberry pi, connecting all your hardwares together, you need to type the following commands to initialise, update your raspberry pi, download the software and install it.
Adafruit made a godd job by making the library you can use to program the LCD. Thank you guys. We'll download it soon, don't worry.
Go to your terminal to type the following commands:
Install the GPIO library
sudo apt-get install python-pip python-dev build-essential sudo pip install RPi.GPIO
Install the Python imagine library
sudo apt-get install python-imaging
Download the LCD Library and install it
sudo apt-get install git git clone https://github.com/adafruit/Adafruit_Nokia_LCD.git cd Adafruit_Nokia_LCD sudo python setup.py install
Adafruit made a great job by making the library available that you can use to program the LCD. Thank you guys!!! ;-)
If you have a older version of Raspberry pi (Raspberry pi 1, Raspberry pi 2 A, A+...), You may need to activate the SPI on your board that used to come enabled with it.
A nice link can be find to do this manipulation jusr here: Config_SPI
We are all set now.
You can go to ''Adafruit_Nokia_LCD_library'', then ''examples'' and finally execute the file "image.py".It will show a cat. Catty Catty, lol!!!
But the purpose of this article is to put whatever we want on the Nokia 5110 LCD screen connected to our Raspberry pi. In our case, It's about displaying a Halloween pumpkin head. You can download it by right-clicking on the picture above and save it.
This done, we can go to the code made by Adafruit.
By searching in the program, you will find the following lines of code:
image = Image.open('happycat_led.ppm').convert('1')
Comment them with a pound. Then look for the following line:
image = Image.open('happycat.png').resize(LCD.LCDWIDTH, LCD.LCDHEIGHT), Image
After downloading the Halloween pumpkin head picture to the same folder as the program, rename it as you wish and add the name in the previous code line instead of ''happycat.png''..
Open you terminal and go to the repertory where you saved your adafruit file and the program you just modified and execute the file you have just modified. You should see the following head. :-)))
You can modify the drawing and share with us your montages and realisations and even leave comments for us and the community.
If you like the article, you can put a thumbs up, share it and subscribe to our social medias (Facebook, Twitter, Google+, Instagram and Youtube). If you prefer it old school, you can subscribe to our newsletter at the bottom page on our website.
Hope you feel stronger now and redy to make more hack.
See you very soon for new articles and tutorials.