Page 1 of 1

16 x 2 LCD

Posted: Sun Jul 10, 2022 12:50 am
by Andrew1234
I have a 16x2 LCD that I want to use with a pyboard and Dave Hylands' python_lcd API that can be found here:
https://github.com/dhylands/python_lcd

My LCD display is described here:
https://wiki.52pi.com/index.php?title=Z-0234

The chip on the 'backpack' of my LDC is marked as a PCF8574T. The API expects the backpack to have an I2C address between 0x20 and 0x27. When I scan the I2C address of my device, the pyboard returns [39].

I haven't found a reference for a part labeled PCF8574T. However, I found a datasheet for the PCF8754x here:
https://www.nxp.com/docs/en/data-sheet/ ... F8574A.pdf

Table 4 of the datasheet seems to match with the API expected addresses of between 0x20 and 0x27. I suspect my device is a PCF8574A or similar, since 0x39 is an expected address as shown in Table 5.

I tried changing the DEFAULT_I2C_ADDR variable to 0x39 in the module pby_i2c_lcd.py, but this change alone doesn't seem to work.

Is it straightforward to make some changes to the API to work with the LCD display that I have?

Thanks
Andy

Re: 16 x 2 LCD

Posted: Sun Jul 10, 2022 1:54 am
by scruss
the pyboard returns [39]
which is 0x27, as expected ( 2 * 16 + 7 = 39)

Re: 16 x 2 LCD

Posted: Sun Jul 10, 2022 2:21 am
by Andrew1234
Ah, thank you, scruss. I thought the returned value was in hex. That's good news for me as far as the HW goes.
Regards
Andy

Re: 16 x 2 LCD

Posted: Sun Jul 10, 2022 8:56 am
by rkompass
Perhaps the difficulty is to select the two matching files from dhylands site.
I preferred to have one file and thus put the two into one, also removed the const() definitions and found that the memory consumption in the end was much reduced.
So if you prefer this modification put lcd_i2c8574.py onto your board and then run the other file for testing. I recommend Thonny with the file sidebar activated for that.
Good luck,
Raul

Re: 16 x 2 LCD

Posted: Sun Jul 10, 2022 11:51 pm
by Andrew1234
Thanks for sharing your modifications. This is useful to me.
Regards
Andy

Re: 16 x 2 LCD

Posted: Mon Jul 11, 2022 12:45 am
by rkompass
We had it several times here in the forum: Don't forget to turn the brightness poti up (or down, I forgot). The first time I used this display it seemed to display nothing, just because I did not know that.