odroid-h2:application_note:i2c_20x4_lcd

I2C 20x4 LCD

H2+

H2

XU4-ShiftShield

Download fritzing
- LCM1602 part ☞ lcm1602_iic.fzpz
- ODROID-H2 part ☞ odroid-h2.fzpz
- ODROID-H2+ part ☞ odroid-h2plus.fzpz
- fritzing parts(H2) ☞ 20x4lcd_i2c.fzz
- fritzing parts(H2+) ☞ h2plus_20x4lcd_i2c.fzz
- fritzing parts(Shift_Shield) ☞ shift_shiled_20x4lcd_i2c.fzz

If you have done the wiring well, you can see the device as the following commands.

sudo apt install i2c-tools
  • If you're using an older kernel than 4.18, tap the “Old kernel version”.

kernel 4.18 or higher

When you have wired the I/O expander to Pin #18(SCL) and #20(SDA).

sudo i2cdetect -y -r 2

When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).

sudo i2cdetect -y -r 3
target
odroid@h2:~$ sudo i2cdetect -y -r 2
     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: -- -- -- -- -- -- -- --  

Old kernel version

When you have wired the I/O expander to Pin #18(SCL) and #20(SDA).

sudo i2cdetect -y -r 5

When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).

sudo i2cdetect -y -r 6
target
odroid@h2:~$ sudo i2cdetect -y -r 5
     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: -- -- -- -- -- -- -- --  

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 5

When you have wired the I/O expander to Pin #13(SCL) and #15(SDA).

sudo i2cdetect -y -r 6
  • Kernel 4.18 must access the I2C channel #6 via /dev/i2c-2.
target
odroid@h2:~$ sudo i2cdetect -y -r 2
     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: -- -- -- -- -- -- -- --  
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
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.

sudo python3 hello_world.py I2CBUS ADDRESS
  • If you're using an older kernel than 4.18, tap the “Old kernel version”.

kernel 4.18 or higher

sudo python3 hello_world.py 2 27

Or

sudo python3 hello_world.py 3 27

Old kernel version

sudo python3 hello_world.py 5 27

Or

sudo python3 hello_world.py 6 27

odroid-wiringpi version is 3.15.2 or later.

apt install autoconf git libtool libwiringpi-dev
git clone https://github.com/hardkernel/wiringPi.git
cd wiringPi/example
./autogen.sh
./configure
make
sudo i2c-lcd I2C-BUS ADDRESS

kernel 4.18 or higher

sudo i2c-lcd 2 27

Or

sudo i2c-lcd 3 27

Old kernel version

sudo i2c-lcd 5 27

Or

sudo i2c-lcd 6 27

H2+

H2

Thanks to djjproject

source : https://github.com/djjproject/odroidh2_i2c_lcd

sudo apt install git python3-dev libi2c-dev python3-smbus
sudo apt install python3-psutil lm-sensors hdparm
git clone https://github.com/djjproject/odroidh2_i2c_lcd.git

You may need to change to the I2C bus and Ethernet port name you are using.

Ethernet : https://github.com/djjproject/odroidh2_i2c_lcd/blob/master/hello_world.py#L8
I2C bus : https://github.com/djjproject/odroidh2_i2c_lcd/blob/master/lcddriver.py#L9

sudo python3 hello_world.py
  • odroid-h2/application_note/i2c_20x4_lcd.txt
  • Last modified: 2024/01/24 17:40
  • by steve.jeong