I2C 20x4 LCD
Hello world example
This examples have written based on under the Ubuntu 22.04 and Linux kernel 5.15.0-46-generic
Wiring
Download fritzing
- fritzing parts ☞ h3_20x4lcd_i2c.fzz
- LCM1602 part ☞ lcm1602_iic.fzpz
- ODROID-H3 part ☞ odroid-h3.fzpz
Connection Check
If you have done the wiring well, you can see the device as the following commands.
sudo apt install i2c-tools
When you have wired the I/O expander to Pin #18(SCL) and #20(SDA).
sudo i2cdetect -y -r 1
When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).
sudo i2cdetect -y -r 2
- target
odroid@h2:~$ sudo i2cdetect -y -r 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
Install & build python packages
sudo apt install git python3-dev libi2c-dev python3-smbus
If you got this error on your Ubuntu.
E: Unable to locate package python3-smbus
Build the python3-smbus package.
git clone https://github.com/tkurbad/python3-smbus.git cd python3-smbus python3 setup.py build python3 setup.py install
Get source code
git clone https://github.com/hardkernel/i2c_20x4_lcd.git
Edit lcddriver.py if you need to change the host bus address and/or device address.