# OpenMV I2C

**URL:** <https://forums.openmv.io/t/openmv-i2c/605>\
**Category:** OpenMV Boards\
**Created:** [March 7, 2018, 9:57pm UTC](https://forums.openmv.io/t/openmv-i2c/605 "2018-03-07T21:57:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![belmazry](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@belmazry](https://forums.openmv.io/u/belmazry)\
**Post date:** [March 7, 2018, 9:57pm UTC](https://forums.openmv.io/t/openmv-i2c/605/1 "2018-03-07T21:57:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 7, 2018, 10:47pm UTC](https://forums.openmv.io/t/openmv-i2c/605/2 "2018-03-07T22:47:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mbbackus](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mbbackus](https://forums.openmv.io/u/mbbackus)\
**Post date:** [March 15, 2018, 8:52am UTC](https://forums.openmv.io/t/openmv-i2c/605/3 "2018-03-15T08:52:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 15, 2018, 4:17pm UTC](https://forums.openmv.io/t/openmv-i2c/605/4 "2018-03-15T16:17:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mbbackus](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mbbackus](https://forums.openmv.io/u/mbbackus)\
**Post date:** [March 15, 2018, 6:25pm UTC](https://forums.openmv.io/t/openmv-i2c/605/5 "2018-03-15T18:25:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 15, 2018, 9:57pm UTC](https://forums.openmv.io/t/openmv-i2c/605/6 "2018-03-15T21:57:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![daveseidman](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@daveseidman](https://forums.openmv.io/u/daveseidman)\
**Post date:** [March 6, 2019, 11:11am UTC](https://forums.openmv.io/t/openmv-i2c/605/7 "2019-03-06T11:11:43Z")

</div>

First off, thanks to all the great hardware, documentation, and posts to this forum!

I’m new to the OpenMV, micropython, arduino, etc. but had to figure out communication between the OpenMV 7 and Teensy 3.2. I cobbled together a simple demo from the various posts here and over at the arduino forums:

[![](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/c/c2ee823c14200e2628d40961c22588dc8f2663fa.jpeg "I2C communication: openMV 7 - teensy 3.2") ](https://www.youtube.com/watch?v=JdIg0KkNodM)

Hoping it helps anyone that was having similar difficulties, I haven’t tried setting the OpenMV as the slave but from what I’m reading on this forum it seems like that’s not a great idea if you’re doing any sort of image processing.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 6, 2019, 4:31pm UTC](https://forums.openmv.io/t/openmv-i2c/605/8 "2019-03-06T16:31:27Z")

</div>

Thanks for the video tip!
