OpenMV I2C

Discussion related to "under the hood" OpenMV topics.
belmazry
Posts: 2
Joined: Wed Mar 07, 2018 4:48 pm

OpenMV I2C

Postby belmazry » Wed Mar 07, 2018 4:57 pm

Hi,

I am trying to connect my OpenMV Cam M7 to the Raspberry-Pi 3 via I2C. However, it simply does not detect the device. What would you recommend for me to do?
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV I2C

Postby kwagyeman » Wed Mar 07, 2018 5:47 pm

Hi, the OpenMV does poorly as an I2C slave or SPI slave. Please use async serial instead. This works great with the OpenMV Cam M7.

The reason it works poorly as an I2C slave is that you have to literally be in a system call to feed the I2C hardware data for a master device to get anything other than zeros. I.e. you have to have the camera basically waiting for the I2C master to tell it what to do before it can go do something. You can have the camera generating results on the fly. Serial is much easier for the camera to run by itself and look at the serial buffer to check if it needs to send some data to another device after each frame.
Nyamekye,
mbbackus
Posts: 2
Joined: Thu Mar 15, 2018 4:48 am

Re: OpenMV I2C

Postby mbbackus » Thu Mar 15, 2018 4:52 am

Has any progress been made on getting the OpenMV to connect to Arduinos via spi and/or i2c. I'd like to use an Arduino, and I want to reserve my tx and rx pins for another purpose. I tried the sample code, but I wasn't able to get it to work. As far as I could tell, I had followed all the instructions correctly.
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV I2C

Postby kwagyeman » Thu Mar 15, 2018 12:17 pm

Hi, please see the Pixy Emulation -> I2C emulation script.

This example shows off how to get I2C working.

As mentioned above, making the OpenMV Cam an I2C slaves doesn't work very well since the camera has to be waiting for an I2C request to service it. This means you have to make the camera I2C triggered. The same issue applies for the camera being a SPI slave.
Nyamekye,
mbbackus
Posts: 2
Joined: Thu Mar 15, 2018 4:48 am

Re: OpenMV I2C

Postby mbbackus » Thu Mar 15, 2018 2:25 pm

I see that Mindsensors has used the OpenMV design as a jumping off point for their NXTcam5. I know they use i2c. Do they have a workaround, or does their implementation suffer from the same problems you have already mentioned? Also, any idea why I'm not able to get anything to happen with spi? I followed your example, but nothing shows up on the Arduino side. I don't even know where to start troubleshooting.
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV I2C

Postby kwagyeman » Thu Mar 15, 2018 5:57 pm

Hi, the OpenMV Cam is kinda meant to be a master system and not a slave.

Mmm, okay, what do you need exactly? Maybe I can write some code for you quickly.

You should however, also look at the Pixy CMUcam5 Arduino library for the Arduino code I designed the Pixy emulation code to talk to. On the Arduino side you have to constantly poll the OpenMV Cam until you get a response. It's not like a normal I2C device.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests