How to setup Arduino Portenta H7 and OpenMV to work with Vision Shield

After days of waiting, I finally received my the Portenta Vision Shield to test out some cool vision application. Previously, I tested out some first setup of the Arduino Portenta H7 with the breakout board for Blink and Ethernet sample test on Arduino IDE.

In this post, I want to try out the OpenMV / Micropython application. So our goal here is to setup OpenMV and test out the helloworld script on OpenMV. So, let’s go!!!

Component list

Arduino Portenta H7

Arduino Portenta Vision Shield

I follow Step 1 and 2 in this guide to update OpenMV firmware for the Arduino Portenta H7. If you have any issue with uploading to Portenta on Arduino IDE, you can check out my first setup of the Arduino Portenta H7 post for any possible useful tip.

After updating bootloader and put device into boot mode (double press the blue button on the portenta), I start OpenMV > Click Connect. If successfully connect window, select Install the latest release firmware, and follow through with the firmware install process.

The window below shows the device is successfully connected to OpenMV.

So while I was at the “” example, I tried to upload this script by clicking on the green Play button. This is the result I got. Quite cool! The camera is mono color, so I did expect to get only grayscale.

UDP with Micropython on Portenta

I did a lot of coding on Python before, but I never did anything with Micropython. So I want to do this one example code myself. This example is based on the UDPSendReceiveString basic example on Arduino IDE.

1….2…3…here goes the codes I already figured out with self explanatory comments.

# Importing the neccessary libraries
import network, time, usocket

# Setup static ip address and masknet

lan = network.LAN()
lan.ifconfig(('', '', '', ''))

# Create socket and bind to port
s = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
s.bind(("", 8888))

# Loop indefinitely. Print any received datagram and send a reply
while (True):
    # Nothing else to do.
    data, addr = s.recvfrom(1024)
    print("From {}, port {}".format(addr[0], addr[1]))
    print("Content: {}".format(data))
    reply = b'reply: ' + data

To upload the code, connect the board and click the the green Play button as the first example.

I wrote another UDP sender script to test with the board, running from my PC

#!/usr/bin/env python3 
import socket 

def main():
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    ip = ""
    port = 8888

    while True:
        print("Type something and Enter")
        _input = input()
        s.sendto(str.encode(_input), (ip, port))
        resp = s.recv(1024)

if __name__ == '__main__':

Here is snapshot of the echo test.

You can find all my example codes in this repo.

Upload Script permanently with OpenMV

So apparently, clicking the green Play button doesn’t upload your codes permanently to the Arduino. I thought it works just as the Compile button on the Arduino IDE, but it is not like that.

There is one more step to do if you wish to upload your code for real to the board. It is to click on Tools > Save open script to OpenMV Cam (as
This will ask if I want to strip the comment and convert space tab. I click Yes. I don’t know why, I just don’t have a reason to click No.
Then to reset your board Tools > Reset OpenMV Cam


If you read to this point, we cover a couple simple applications for Arduino Portenta H7 + Vision shield. Going from setting up OpenMV to running first hello-world to stream grayscale camera image and echo UDP string.

There are more examples to explore in File > Examples in OpenMV. I’m a long time Python coder, so getting Python to run on microcontroller for the first time made me quite happy.

There are really much more to explore with this board. They also support CAN and Crypto chip on the Portenta H7 full version (not Lite). To use CAN, you would need the breakout board to get CAN pins. The board itself doesn’t have any CAN pin. It has dual core which we didn’t get to that yet in this article.

If you have this board or are about getting it soon, hope you will have fun.


Disclosure: The provided product links are affiliated links. As an Amazon Associate I earn a small commission from qualifying purchases.

Was the content useful?You can support author with Buy me a Coffee

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s