Home Code Raspberry PI LCD plate

Raspberry PI LCD plate

by shedboy71

In this example we will add an LCD plate to our Raspberry PI, you could of course add an LCD and connect it up manually but this was an easier method which I wanted to investigate. Here i s a picture of the plate I purchased and used

raspberry pi rgb keypad lcd

raspberry pi rgb keypad lcd

Here are the instructions required to setup your Raspberry PI, there are various commands that need to be run

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

Now as an optional step you can try and scan for your LCD, it should show up at 0x20

scan for LCD

sudo i2cdetect -y 1 (Raspberry PI version 2)

i2cdetect lcd

i2cdetect lcd

Now the folks at adafruit have done a lot of work regarding creating a python library

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus python-pip git
sudo pip install RPi.GPIO
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
cd Adafruit_Python_CharLCD
sudo python setup.py install

To test run the following which will run the example that was written by Adafruit

cd examples
sudo python char_lcd_plate.py

You should explore the basic examples to look at the code and see how everything works but here is a very simple example. This demonstrates how simple it is to write text to an LCD

Our first basic example, the good old hello world. type the following using your favourite text editor and save as test.py. I used Geany.



# As basic as it gets : Hello world
import Adafruit_CharLCD as LCD
lcd = LCD.Adafruit_CharLCDPlate()
# Show some basic colors.
lcd.message('HELLO WORLD')

Run the above by typing the following on the command line

sudo python test.py



The LCD plate comes in at about $17 to $20
Raspberry pi Raspberry Pi 1602 LCD screen buttons RGB

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