Connecting Diagram
Click to enlarge.
This is a summery of pin connection
Beaglebone Black Pin |
LCD Pin |
P9_7 (+5V Output) | One outer lead of the potentiometer, LCD pin 2 (VDD) and LCD pin 15 (LED+) |
P8_2 (Ground) | Other outer lead of the potentiometer, LCD pin 1 (VSS), LCD pin 5 (R/W) and LCD pin 16 (LED-) |
— | Middle lead of the potentiometer to LCD pin 3 (V0/contrast). |
P8_8 | LCD pin 4 (RS) |
P8_10 | LCD pin 6 (E/clock enable) |
P8_18 | LCD pin 11 (DB4) |
P8_16 | LCD pin 12 (DB5) |
P8_14 | LCD pin 13 (DB6) |
P8_12 | LCD pin 14 (DB7) |
Programming
First connect your Beaglebone BLack to a network using RJ45 cable (or use a 3G HSDPA medem).
Start the Beaglebone BLack. (Either by OS in eMMC or from micro SD card)
Now Open a terminal (Ctrl + Alt + T)
ssh in to your your Beaglebone BLack. Type and hit enter the following command.
ssh 192.168.7.2 -l root
Now you will get the console of your Beaglebone BLack. Now you need to Install the followings into your Beaglebone BLack.
- Python language (Normally new images come with Python)
- Adafruit Character LCD Library
This is how you can install Adafruit Character LCD Library in Command Line
cd ~
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
cd Adafruit_Python_CharLCD
sudo python setup.py install
We need to open a new nano file. Type the following command in Beaglebone prompt and hit enter in .
nano charLCD.py
Next type or Copy the following code into the charLCD.py.
import math
import time
import Adafruit_CharLCD as Disp
# Configure the BeagleBone Black as follows:
disp_rs = ‘P8_8’
disp_en = ‘P8_10’
disp_d4 = ‘P8_18’
disp_d5 = ‘P8_16’
disp_d6 = ‘P8_14’
disp_d7 = ‘P8_12’
disp_illuminate = ‘P8_7’
# No. of columns and rows of LCD. Following means that the LCD is an 16 X 2
disp_cols = 16
disp_rows = 2
# Initialization of the LCD
LCD = Disp.Adafruit_CharLCD(disp_rs, disp_en, disp_d4, disp_d5, disp_d6, disp_d7,
disp_cols, disp_rows, disp_illuminate)
#Display Hello World message
LCD.message(‘Hello world!’)
# If you need you can print two line message LCD.message(‘Hello\nworld!’)
# Wait 5 seconds
time.sleep(5.0)
# Clear the LCD screen.
LCD.clear()
Then save the file, close it and run by typing the following command then hit enter.
python charLCD.py
download the python code here.