Connecting EV3 to Openmv h7 camera

Does anyone know how to communicate an OpenMV camera to LEGO EV3 MINDSTORMS using I2C communication?

The robot me and my team built has to follow a line. For that we used a light array sensor for MINDSTORMS. And on the line can be obstacles (like a brick or a bottle) of about 3 cm and I’m trying to detect it with the camera, and once it’s detected I want it to go around it and continue following the line. An at the end of that parkour, it will enter a white field with a black corner and multiple silver balls. I need the camera to detect the silver balls and push it towards the black corner.

I have all of the necessary codes for both the robot and camera. I’ve tried to follow multiple tutorials of I2C communication for the LEGO, but I’m not exactly sure how to connect it for both hard- and software. I do have a code for the OpenMV camera, but I’m not 100% sure if my code for the I2C communication of the camera is correct. I will put the code of the OpenMV camera below.

from pyb import I2C, Servo

I2C_SLAVE_ADDR = 0x12

i2c = I2C(2, I2C.SLAVE, addr=I2C_SLAVE_ADDR) # Use the correct I2C bus index

servo = Servo(1) # Assuming servo is connected to servo channel 1

instruction = [0, 0, 0]

while True:
try:
instruction = list(i2c.recv(3))
i2c.send(instruction[0])
if instruction[0] == 2:
servo.angle(instruction[1])
except OSError:
pass

Hi, there are plenty of projects where folks figured this out themselves: ofdl-robotics-tw/EV3-OpenMV-Stuff: An OpenMV software, hardware example for LEGO Mindstroms EV3 (support SPIKE/RI). (github.com)

It looks like that example above is for UART.

I’d reach out to Anton: Home – Antons Mindstorms

He got all this stuff working.

Thank you for the link, but I’m programming the EV3 with the LEGO MINDSTOROMS software, not micropython. Is there maybe a way to program the EV3 brick with the LEGO MINDSTOROMS software?

That’s not a topic I can help with. The EV3 system isn’t our product. I pointed you to Anton, who successfully connected the two systems. You should follow his tutorials. They likely include how to program the EV3 system.

Ok, I’ll then do that. Thank you for the links