16 x 2 LCD

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Andrew1234
Posts: 20
Joined: Sat Oct 16, 2021 3:58 pm

16 x 2 LCD

Post by Andrew1234 » Sun Jul 10, 2022 12:50 am

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

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: 16 x 2 LCD

Post by scruss » Sun Jul 10, 2022 1:54 am

the pyboard returns [39]
which is 0x27, as expected ( 2 * 16 + 7 = 39)

Andrew1234
Posts: 20
Joined: Sat Oct 16, 2021 3:58 pm

Re: 16 x 2 LCD

Post by Andrew1234 » Sun Jul 10, 2022 2:21 am

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

rkompass
Posts: 66
Joined: Fri Sep 17, 2021 8:25 pm

Re: 16 x 2 LCD

Post by rkompass » Sun Jul 10, 2022 8:56 am

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
Attachments
lcd_i2c8574.zip
(2.49 KiB) Downloaded 1213 times

Andrew1234
Posts: 20
Joined: Sat Oct 16, 2021 3:58 pm

Re: 16 x 2 LCD

Post by Andrew1234 » Sun Jul 10, 2022 11:51 pm

Thanks for sharing your modifications. This is useful to me.
Regards
Andy

rkompass
Posts: 66
Joined: Fri Sep 17, 2021 8:25 pm

Re: 16 x 2 LCD

Post by rkompass » Mon Jul 11, 2022 12:45 am

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.

Post Reply