Monday, September 15, 2014

2x16 LCD Display on Raspberry Pi

This post show how to connect 2x16 LCD Display Module (come from another Arduino starter kit) to Raspberry Pi, and test it with Python.


How to connect 2x16 LCD Display Module to Raspberry Pi:


Visit GitHib of adafruit/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCD. There is a sample Python code to drive 2x16 CharLCD on Raspberry Pi, Adafruit_CharLCD.py.

For Raspberry Pi Model B, rev 2, change pin 21 to 27:
Search the code:
    def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 21, 22], GPIO=None):

to:
    def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 27, 22], GPIO=None):

Run it with sudo, to display welcome message of " Adafruit 16x2\n Standard LCD".

$ sudo python Adafruit_CharLCD.py

Another sample code Adafruit_CharLCD_IPclock_example.py, display datetime and the IP of your Raspberry Pi.

$ sudo python Adafruit_CharLCD_IPclock_example.py

Both sampls can be download Here.

Related:
- Web control to display on Pi connected LCD Module, with Python and bottle

No comments: