Using the Portenta Vision Shield Ethernet with OpenMV

Learn how to connect to the Internet using the Vision Shield Ethernet, Portenta H7 and OpenMV


With the Ethernet version of the Arduino Portenta Vision Shield it is possible to connect the board to the Internet using an Ethernet cable. In this tutorial we will go through useful scenarios for using Ethernet and how to connect the board to the Internet with OpenMV.


  • Learn how to use the Portenta H7 and Vision Shield Ethernet with a Ethernet cable

Hardware & Software Needed

If you want to know about the ethernet connection please go to the Arduino IDE ethernet tutorial


Connecting the Board

Connect the Portenta Vision Shield Ethernet to the Portenta H7. Now connect the USB-C cable to the Portenta H7 and your computer. Lastly connect the Ethernet cable to the Portenta Vision Shield's Ethernet port and your router or modem.

Programming the Board

After everything is connected, connect the board to OpenMV to install the latest firmware. Once it is connected, we can open the example we are going to upload. In OpenMV go to: File > Examples > Arduino > Portenta H7 > Ethernet >

Where to find the example in OpenMV
Where to find the example in OpenMV

Next we will look at some of the code in the example script.

Testing It Out

Now lets take a look at some important parts of the code.

First we are making use of some micropython libraries, network and usocket.

1import network, usocket

The script will make the board connect to a website and set a port for later use. This line in the code decides what website it connects to. The example uses "", but feel free to change it and experiment with different websites.

1PORT = 80
2HOST = ""


usocket.getaddrinfo(HOST, PORT)[0][4]
function will translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. Then we can create a socket object with
usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
. We can combine these variables we have created, allowing us to connect the socket to our desired address.

1addr = usocket.getaddrinfo(HOST, PORT)[0][4]
4client = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)

This will print the websites content in the serial terminal in OpenMV. The argument inside the

call determines the maximum amount of data to be received at once.


After the board has printed all of the websites content it will automatically disconnect with a simple

call. Now lets take a look at what the output should look like if everything went correctly.

Sketch Result

After uploading the sketch, open the serial terminal. The board will connect to a website. Then print the websites content in the serial terminal. If everything went correctly your serial terminal should look like the image below.

Serial monitor showing the result of the sketch
Serial monitor showing the result of the sketch

After the connection has been made, the html code of the website entered into the sketch will be printed in the serial monitor.


This tutorial showed how to connect the Portenta H7 with a Vision Shield Ethernet to the Internet, with an example script in the OpenMV. The sketch allowed the board to connect to a website and print it's content. The Portenta H7 and Vision Shield can also be used with the Arduino IDE, have a look at the Arduino IDE Ethernet tutorial if you want to see a similar example.

Next Steps

Now that you know the basics of how to establish a connection to the Internet with Ethernet, you can try to create more advanced scripts with this connection. An Ethernet connection allows you to send HTTP methods to another device, communicate with another device, API, or even another Portenta. A good next step would be to take a look at the other examples listed under Ethernet in OpenMV, or take a look at the library documentation.

Tutorial Toolbox

Contribute to Arduino

Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request.

Missing something?

Check out our store and get what you need to follow this tutorial.

Suggest Changes

The content on is facilitated through a public GitHub repository. You can read more on how to contribute in the contribution policy.