Support for I2C LCD 4x20 displays

Sure. I’ll get back to you when I get a chance to try it.

This works;

# I2C Scanner Basic - By: Scott Murchison - Fri Jul 19 2019
# simple program to scan I2C bus for connected devices


from machine import I2C, Pin

i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))

print('Scanning i2c bus...')
devices = i2c.scan()

if len(devices) == 0:
  print("No i2c devices found !")
else:
  print('i2c devices found:',len(devices))

for device in devices:
  print("Decimal address: ",device)
  print("Hex address: ",hex(device))

Here is the output;

Scanning i2c bus…
i2c devices found: 1
Decimal address: 39
Hex address: 0x27
MicroPython v1.9.4-4570-g939334a54-dirty on 2019-07-18; OPENMV4 with STM32H743
Type “help()” for more information.

Okay, our pyb must have issues with the I2C driver on the H7.

Ibrahim, can you look into this?

In the meantime, if you want to try to change the calls from using pyb to machine in the example program you may be able to get it working. Us fixing the bug is going to take a while.

Thanks for responding. I was trying to change the calls this morning, but I ran into some other problems. In his pyb_i2c_lcd_test program, I changed

from pyb import I2C

to

from machine import I2C, Pin

and

i2c = I2C(2, I2C.MASTER)

to

i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))

but in the called module pyb_i2c_lcd, it fails at this line because i2c has no attribute for send.

self.i2c.send(0, self.i2c_addr)

For now, I haven’t had enough experience with Python to get this all working. All I want to be able to do is send strings to a 20x4 lcd. It’s frustrating, but I thank you anyways for trying to help.

Can you just buy an LCD that supports serial? That’s works fine with the H7 right now. You just TX the string you want to send at like 9600 baud to it and then it displays it.

I suppose I could, but I have a bunch of i2c LCDs laying around, so it seemed like a reasonable idea to use them. I know that it seems excessive, but I have plenty of Arduinos too. I could send my strings to the Arduino and let it handle the display. That would offload some of the work I need the OpenMV board to do, such as panning around while live viewing a scene looking for an April tag.

I think I read some posts about connecting the OpenMV to an Arduino. What do you suggest as the best method? serial, SPI, I2C

Use async serial, and then use an Arduino mega since it has multiple serial ports. Or, use software serial with your Arduino. You want to avoid using the main serial UART with the camera.

I agree. All I would be doing is sending strings one way to the display.

If it works and you found the device what is the issue ?

Also machine i2c doesn’t have a send function:

http://docs.openmv.io/library/machine.I2C.html

I see pyb I2C scan is not working, okay I’ll check it. In the meantime I think you can use the machine module, btw pyb is obsolete and sooner or later it’s going to be removed.

This is an old issue and I am now building my robot, so I want to check to see if OpenMV supports a 2 line or 4 line I2C LCD display. I have a solution whereby the OpenMV camera sends serial data to an Arduino and the Arduino takes care of the display, but a more elegant option would be to connect the LCD to the OpenMV directly. Just wondering if this was ever fixed.

I don’t have any LCDs to test with, but it should work. Give it a try and let me know.

I use these LCD displays. They are pretty cheap and available from many websites. IIC I2C TWI 2004 204 20X4 Blue Serial Character LCD Module Display Arduino kit | eBay