LCD Display 333171 incompatible with standard PCF8574 I2C library

Customer:

I’m trying to use the 333171 with a Raspberry Pi 3 B+. I’m having communication problems using the driver from GitHub - the-raspberry-pi-guy/lcd: This repository contains all of the code for interfacing with a 16x2 Character I2C LCD Display. This accompanies my YouTube tutorial here: https://www.youtube.com/watch?v=fR5XhHYzUK0 · GitHub

When I run:

sudo i2cset -y 1 0x20 0x00 # This sets the register 0x00 to 0x00
sudo i2cget -y 1 0x20 0x00 # This reads from register 0x00

I get 0xfb back, which indicates the device is communicating and connected correctly.

However, when I try to run the demo, I get this error:

Initialized I2C device at address: 0x20
Writing command 8 to address 0x20
Traceback (most recent call last):
  File "/home/user/lcd/demo_lcd.py", line 8, in <module>
    import drivers
  File "/home/user/lcd/drivers/__init__.py", line 1, in <module>
    from .i2c_dev import Lcd, CustomCharacters
  File "/home/user/lcd/drivers/i2c_dev.py", line 90, in <module>
    lcd = Lcd(addr=0x20) # Initialize with address 0x20
           ^^^^^^^^^^^^^^
  File "/home/user/lcd/drivers/i2c_dev.py", line 43, in __init__
    self.lcd_write(0x03)
  File "/home/user/lcd/drivers/i2c_dev.py", line 64, in lcd_write
    self.lcd_write_four_bits(mode | (cmd & 0xF0))
  File "/home/user/lcd/drivers/i2c_dev.py", line 60, in lcd_write_four_bits
    self.lcd.write_cmd(data | LCD_BACKLIGHT)
  File "/home/user/lcd/drivers/i2c_dev.py", line 37, in write_cmd
    self.bus.write_byte(self.addr, cmd)
OSError: [Errno 121] Remote I/O error

Why do I keep getting this error?

Originally submitted via email support on 2 August 2024. Migrated to the forum for community visibility.

Soldered Support:

The issue is that the library you linked is designed for a standard LCD driver board, but the 333171 uses a custom I2C expander. The library you’re using expects a PCF8574 expander, but our board uses a TCA9534PWR instead.

You’ll need to modify the driver to work with our expander. As a starting point, check the init and I2C communication functions in our library:

Our official library is available at: