OpenMV H7 communication with arduino mega

I have an OpenMV H7, I try to connect with arduino mega. I also tried the UART, SPI and I2C communications. It was not work. I would like to achieve that, if the camera detects a color or anything, for example, it should send a signal/message to the arduino. And the arduino must handle the sent data within a condition.

Arduino example: if(data == 1){ Serial.println(“camera found color”}

Can you send programs about them?

I look forward to hearing from you soon. I hope you can help me.

Bendeguz Eigner

Hi, please use our RPC interface library for this. It works very well. I have mentioned this numerous times in forum posts and it have examples in our IDE.

The library works perfectly for I2C/SPI/UART/CAN to an Arduino.

See the example folder in the IDE: Examples->RPC Library->Remote Control

Can I use it micropython and arduino programming as well?

which program do I choose? What communication should I use?

Use the popular features example.

Select the same example on the OpenMV Cam for a demo.

Finally for which protocol:

If you have a Mega then use Serial1/2/3 and connect the camera to the Arduino via a UART. If you have a UNO (or any other board where the UART is also the programming port) then I recommend SPI. I2C requires external pull up resistors.

I would like to program the camera in the openmv ide (in micropython), like the color tracking. So I do not want to program it in arduino ide, only get data from micropython

I made a simple draw what I want.

You want the camera to send data to the Arduino. Okay, question, what is the Arduino doing? Can the OpenMV Cam replace that? It will make your life easier. We have robust I/O.

The camera must recognize 3 different letters and 3 different colors, I want the camera to send information about them (openmv ide) to the arduino. They must be distinguished, so a different number or data must be sent.

But the main point is that I program the camera in openmv ide


Okay, so, the RPC library typically forces a device to wait for a response from the other.

So, you have the following options:

  1. Send results from the OpenMV Cam out it’s UART to the Arduino. You will need to write the code to parse the serial data yourself. We will not be able to help you with that on the Arduino. However, this will let the OpenMV Cam run at it’s fastest frame rate.

  2. Have the OpenMV Cam be the RPC master. It will send data to the Arduino via requests to it. However, this will be quite slow since it will have to wait for a response from the Arduino.

It sounds like you want Option 1. So, to send data via the UART see the PYB.UART() class in the documentation and this will send data via pins 4/5 on the OpenMV Cam. Make sure to have a shared ground between the devices.

Okay, i tried the uart program on the openmv ide. Examples-interface library-arduino uart slave (or similar). In the code there was the arduino code also. The serial communication was very good. But when I want to use it in condition, it was not work.
Anyway, sorry for my misunderstanding and clumsiness.

By the way I connected gnd, 5v,rx and tx that you said

Hi, you have to save the scrip to the camera for it to run it after it’s disconnected from the IDE.

Tools → Save Script to OpenMV Cam

Then make sure to safety remove the OpenMV Cam’s flash drive.

I did that always when I tried the communication, so the program was always at the SD card.

What program do I select for communicate with arduino mega?

Hi, you just need to select the two popular features examples.

Then match the interface for both of them.

program not do anything

Hi, you need to make sure you connect the UARTs up to each other correctly. Use the hardware UART on the camera, use Hardware Serial 1/2/3 on the Arduino Mega. Make sure you have a shared ground, RX->TX and TX->RX so that data can flow.

If you actually want help you cannot just post screen shots and say it didn’t work. I will not continue to comment anymore if that’s your level of effort.

sorry for that.
I upload the “popular_features_as_the_controller_device_example” to the arduino mega 2560 pro
and i upload and save the program to the cam SD “”
I open the arduino serial monitor and nothing happens. in the arduino code, there are prints, but it does not print nothing. Can you help me? I need to communicate the arduino and openmv cam because a robotics competition.