Display Real Time Data on 2x16 LCD

This project is to display real time data (such as a system clock, uptime or any output that changes real time) on a 2x16 LCD using Raspberry Pi's GPIO pins and python code. Connection diagram is Below,





Details on wiring is below,

Pin #1 of the LCD goes to ground (black wire)
Pin #2 of the LCD goes to +5V (red wire)
Pin #3 (Vo) connects to the middle of the potentiometer (orange wire)
Pin #4 (RS) connects to the Cobber #25 (yellow wire)
Pin #5 (RW) goes to ground (black wire)
Pin #6 (EN) connects to cobber #24 (green wire)
Skip LCD Pins #7, #8, #9 and #10
Pin #11 (D4) connects to cobber #23 (blue wire)
Pin #12 (D5) connects to cobber #17 (violet wire)
Pin #13 (D6) connects to cobber #21 (gray wire)
Pin #14 (D7) connects to cobber #22 (white wire)
Pin #15 (LED +) goes to +5V (red wire)
Pin #16 (LED -) goes to ground (black wire)

This guide is based on Debian's "Wheezy" release for Raspberry Pi. The following items must be installed in order to utilize the Raspberry Pi's GPIO pins.

Add the latest dev packages for Python (2.x)

Upgrade distribute (required for RPi.GPIO 0.3.1a)



Install rpi.gpio (0.3.1a) or later

Create a folder named and cd to lcddatareal


Download Python Scripts from Downloads section, stored as Adafruit_CharLCD.py and Adafruit_CharLCD_IPclock_example.py

Execute Adafruit_CharLCD.py

If above command displayed some text our wiring is done correctly.

Execute Adafruit_CharLCD_IPclock_example.py

Note: If you want to have the latest scripts download directly from Adafruit repository as explained below,
Run the following commands from an appropriate location ex. ("/home/pi")

If you're using a Version 2 Raspberry Pi, pin #21 has been replaced with pin #27 so edit Adafruit_CharLCD.py and change:

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):

you can use nano Adafruit_CharLCD.py to edit

Note: It is important to do above step as Adafruit_CharLCD_IPclock_example.py is dependant on Adafruit_CharLCD.py

Source : http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi

Most of the tutorials explained in this site are not my own work. Wherever applicable I have included the source links as a credit to the author.