Home ยป PCD8554 LCD example

PCD8554 LCD example

by shedboy71

In this example we will write some text on a PCD8554 LCD display, this is also commonly known as the Nokia 5100 LCD and is quite a common LCD which can be found in many Arduino projects. It frequently comes as an LCD which you have to wire up yourself or in this case its an actual shield that you fit to the GPIO connector. Here is the LCD shield that I purchased

PCD8544

PCD8544

Lets get going with setting this up

Installation

Download example code
[codesyntax lang=”bash”]

git clone https://github.com/adafruit/Adafruit_Nokia_LCD.git

[/codesyntax]
Configure the environment
[codesyntax lang=”bash”]

cd Adafruit_Nokia_LCD
sudo apt-get install python-dev
sudo python setup.py install
sudo apt-get install python-imaging

[/codesyntax]
Download the sunfounder github archive for the module as well, its got a good example in it

[codesyntax lang=”bash”]

git clone https://github.com/sunfounder/Sunfounder_LCD_Nokia_5110.git

[/codesyntax]

 

 

Code

Enter the following into your favourite python editor, I used Geany

[codesyntax lang=”python”]

#######################################################
#
#	This Python Script is for the PCD8544 LCD
#
#######################################################	
import math
import time

import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI

from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

SCLK = 17
DIN  = 18
DC   = 27
RST  = 23
CS   = 22

disp = LCD.PCD8544(DC, RST, SCLK, DIN, CS)
disp.begin(contrast=60)
disp.clear()
disp.display()

image = Image.new('1',(LCD.LCDWIDTH, LCD.LCDHEIGHT))
draw = ImageDraw.Draw(image)
draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255,fill=255)

font = ImageFont.load_default()
draw.text((8,17), 'HELLO WORLD', font=font)
disp.image(image)
disp.display()

print 'Press Ctrl-c to quit'

while True:
	time.sleep(1.0)

[/codesyntax]

 

Run the example above

[codesyntax lang=”bash”]

sudo python test.py

[/codesyntax]

 

 

Link
Mini Screen Module 84 * 48 PCD8544 Matrix LCD Shield with Backlight for Raspberry Pi Model B B+ B Plus

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More