You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/04.pro/shields/portenta-vision-shield/tutorials/things-network-openmv/content.md
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,13 @@ software:
16
16
17
17
This tutorial explains how to connect your Portenta H7 to The Things Network (TTN) using the Vision Shield's LoRa® Connectivity feature. A data communication channel will be enabled between the H7 and a TTN application that will be configured on your TTN console.
18
18
19
-
***In order to connect your Portenta to the TTN make sure you are within the range (max. 10 Km) from an available LoRa® Gateway. Indoor gateways will have a much shorter range. It is recommended that you check LoRa® Gateway availability on [The Things Network map](https://www.thethingsnetwork.org/map) before you try this tutorial.***
19
+
***In order to connect your Portenta to the TTN, make sure you are within the range (max. 10 Km) from an available LoRa® Gateway. Indoor gateways will have a much shorter range. It is recommended that you check LoRa® Gateway availability on [The Things Network map](https://www.thethingsnetwork.org/map) before you try this tutorial.***
20
20
21
21
## You Will Learn
22
22
23
-
- About LoRaWAN® and The Things Network,
24
-
- About creating a TTN application,
25
-
- How to establish a connection between the H7 and the TTN,
23
+
- About LoRaWAN® and The Things Network
24
+
- About creating a TTN application
25
+
- How to establish a connection between the H7 and the TTN
26
26
27
27
## Required Hardware and Software
28
28
@@ -36,21 +36,21 @@ This tutorial explains how to connect your Portenta H7 to The Things Network (TT
36
36
37
37
## Instructions
38
38
39
-
The Portenta Vision Shield - LoRa® can be connected to the TTN and can transmit data to other devices connected to this network through a secure channel. This channel is nothing but an application on the TTN network dedicated for your board. In this tutorial, you will be guided through a step-by-step process of setting up your Portenta board and the Vision Shield - LoRa® to communicate with a TTN application using OpenMV and MicroPython. As stated before, to be able to follow this guide, to be under coverage of one of the TTN gateways. You can check for [the coverage](https://www.thethingsnetwork.org/map) now if you have not done so yet.
39
+
The Portenta Vision Shield - LoRa® can be connected to TTN and can transmit data to other devices connected to this network through a secure channel. This channel is nothing but an application on the TTN network dedicated for your board. In this tutorial, you will be guided through a step-by-step process of setting up your Portenta board and the Vision Shield - LoRa® to communicate with a TTN application using OpenMV and MicroPython. As stated before, to be able to follow this guide, you need to be under coverage of one of the TTN gateways. You can check for [the coverage](https://www.thethingsnetwork.org/map) now, if you have not done so yet.
40
40
41
41
### 1. Setting up the Environment
42
42
43
-
Start by going [here](https://console.cloud.thethings.network/). First choose your region. Next, sign in with your The Things Network account, or create a new one on the login page.
43
+
Start by going [here](https://console.cloud.thethings.network/). First choose your region. Next, sign in with your The Things Network account or create a new one on the login page.
44
44
45
45

46
46
47
47
### 2. Creating an App on TTN
48
48
49
-
Once you have created an account with TTN, you need to create a TTN [application](https://www.thethingsnetwork.org/docs/applications/). An application provides a way to aggregate data from different devices, and then use these data with other 3rd party integrations. After signing in, click on **Create an application**, or **Go to applications** if you already have one created.
49
+
Once you have created an account with TTN, you need to create a TTN [application](https://www.thethingsnetwork.org/docs/applications/). An application provides a way to aggregate data from different devices and then use these data with other 3rd party integrations. After signing in, click on **Create an application** or **Go to applications** if you already have created one.
50
50
51
51

52
52
53
-
Here you'll have a list of all your applications. Now create your first app by pressing the **Create an application** button.
53
+
Here you will have a list of all your applications. Now create your first app by pressing the **Create an application** button.
54
54
55
55
You have now to fill only the first two fields:
56
56
@@ -65,32 +65,32 @@ After completing these two fields, press the "Create application" button located
65
65
66
66
Let's take a closer look at these sections:
67
67
68
-
-**Application Overview**: in order to use this app, you'll need the Application ID and a device specific AppKey. An EUI is a globally unique identifier for networks, gateways applications and devices. The EUIs are used to identify all parts of the LoRaWAN® inside the backend server.
69
-
-**End devices**: here you can see and manage all the associated devices (e.g. your Portenta H7 with Vision Shield LoRa, Arduino MKR WAN 1300 or MKR WAN 1310), or proceed with the registration of a new one. Registering a new device lets you generate an AppEUI and an AppKey.
70
-
-**Collaborators**: here you can see and manage all the app collaborators. To integrate with other collaborative platforms or to manage access rights to the app with other TTN registered profiles.
71
-
-**API keys**: here you can create an API key, it's the most sensible information. It is basically the key to gain access to your app, so keep it safe.
68
+
-**Application Overview**: in order to use this app, you will need the Application ID and a device specific AppKey. An EUI is a globally unique identifier for networks, gateways applications and devices. The EUIs are used to identify all parts of the LoRaWAN® inside the backend server.
69
+
-**End devices**: here you can see and manage all the associated devices (e.g. your Portenta H7 with Vision Shield LoRa, Arduino MKR WAN 1300 or MKR WAN 1310) or proceed with the registration of a new one. Registering a new device lets you generate an AppEUI and an AppKey.
70
+
-**Collaborators**: here you can see and manage all the app collaborators, to integrate with other collaborative platforms or to manage access rights to the app with other TTN registered profiles.
71
+
-**API keys**: here you can create an API key; it is the most sensible information. It is basically the key to gain access to your app, so keep it safe.
72
72
73
73
### 3. Updating the Modems Firmware
74
74
75
-
To be able to use the LoRa® functionality, we need to first update the modems firmware through the Arduino IDE. Connect the Portenta and Vision shield to your computer and open the Arduino IDE. The LoRa® module on the Vision Shield can be accessed by using the [MKRWAN library](https://github.com/arduino-libraries/MKRWAN)(if you can't find it in your examples list, you can go to **Tools > Library Manager** and type "MKRWAN library" to install it). This library provides all the APIS to communicate with LoRa® and LoRaWAN® networks and can be installed from the library manager. Select the **Portenta H7 (M7 core)** board in the Arduino IDE, like shown below.
75
+
To be able to use the LoRa® functionality, you need to first update the modems firmware through the Arduino IDE. Connect the Portenta H7 and Vision Shield to your computer and open the Arduino IDE. The LoRa® module on the Vision Shield can be accessed by using the [MKRWAN library](https://github.com/arduino-libraries/MKRWAN)(if you cannot find it in your examples list, you can go to **Tools > Library Manager** and type "MKRWAN library" to install it). This library provides all the APIS to communicate with LoRa® and LoRaWAN® networks and can be installed from the library manager. Select the **Portenta H7 (M7 core)** board in the Arduino IDE, like shown below.
76
76
77
77

78
78
79
-
The code you need to upload and run is from the **MKRWAN** library, and its name is **MKRWANFWUpdate_standalone**. With the Portenta M7 selected, upload the **MKRWANFWUpdate_standalone** sketch.
79
+
The code you need to upload and run is from the **MKRWAN** library and its name is **MKRWANFWUpdate_standalone**. With the Portenta M7 selected, upload the **MKRWANFWUpdate_standalone** sketch.
80
80
81
81

82
82
83
-
After uploading the sketch, open the serial monitor to confirm that the firmware has been updated. If the upload was successful it will print the progress in the serial monitor.
83
+
After uploading the sketch, open the Serial Monitor to confirm that the firmware has been updated. If the upload is successful, it will print the progress in the Serial Monitor.
84
84
85
85

86
86
87
-
If it all went correctly, you should see the same text in your serial monitor as on the image above.
87
+
If it all went correctly, you should see the same text in your Serial Monitor as on the image above.
88
88
89
89
### 4. Configuring the Vision Shield
90
90
91
-
It's now time to connect your Portenta H7 and LoRa® Vision Shield to TTN. You'll need to upload code to the board using [OpenMV](https://openmv.io/pages/download)
91
+
It is now time to connect your Portenta H7 and Vision Shield - LoRa® to TTN. You will need to upload code to the board using [OpenMV](https://openmv.io/pages/download)
92
92
93
-
Plug the Portenta Vision Shield - LoRa® to the Portenta H7 and them to your PC through the USB port. If the Portenta board does not show up on OpenMV, try double-pressing the reset button on the Portenta. And now update to the latest firmware in OpenMV.
93
+
Plug the Portenta Vision Shield - LoRa® to the Portenta H7 and them to your PC through the USB port. If the Portenta board does not show up on OpenMV, try double-pressing the reset button on the Portenta. Now update to the latest firmware in OpenMV.
94
94
95
95
The only line you may need to change before uploading the code is the one that sets the frequency. Set the frequency code according to your country if needed. You can find more information about frequency by country at [this TTN link](https://www.thethingsnetwork.org/docs/lorawan/frequency-plans.html).
96
96
@@ -101,7 +101,7 @@ The only line you may need to change before uploading the code is the one that s
The `lora.join_OTAA()` or `lora.join_ABP()` functions connect your vision shield to the things network (TTN), using either Over-The-Air-Activation (OTAA) or Activating-By-Personalization (ABP) protocols. We just need to enter our `appEui` and `appKey`. The timeout decides how long the board will try and connect before stopping.
104
+
The `lora.join_OTAA()` or `lora.join_ABP()` functions connect your Portenta Vision Shield to The Things Network (TTN), using either Over-The-Air-Activation (OTAA) or Activating-By-Personalization (ABP) protocols. You just need to enter our `appEui` and `appKey`. The timeout decides how long the board will try and connect before stopping.
We can then send data to our TTN application with `lora.send_data()`, in here we can decide what data we want to send to our TTN application.
113
+
You can then send data to your TTN application with `lora.send_data()`, in here you can decide what data you want to send to your TTN application.
114
114
115
115
```python
116
116
try:
@@ -120,7 +120,7 @@ try:
120
120
print("Message wasn't confirmed")
121
121
```
122
122
123
-
Now we need to read the downlink message. Using the `lora.available()` function we check if there is data received on the board. If there is data on the board that has been received, we can use the `lora.receive_data()` function to take that data and put it into a local variable. Making it easier to print in the OpenMV IDE serial terminal. Using `lora.poll()` we can make sure that the LoRa® module is ready before we run the loop again.
123
+
Now you need to read the downlink message. Using the `lora.available()` function, you can check if data are received on the board. If there are data on the board that has been received, you can use the `lora.receive_data()` function to take that data and put them into a local variable, making it easier to print in the OpenMV IDE serial terminal. Using `lora.poll()`, you can make sure that the LoRa® module is ready before you run the loop again.
124
124
125
125
```python
126
126
# Read downlink messages
@@ -136,21 +136,21 @@ while (True):
136
136
137
137
**Hint: The Complete Sketch can be found in the Conclusions**
138
138
139
-
Then, once the upload is completed open the Serial Terminal where you can now see firmware info, device EUI, data rate and join status.
139
+
Then, once the upload is completed, open the Serial Terminal where you can now see firmware info, device EUI, data rate and join status.
140
140
141
-
In order to select the way in which the board is going to connect with TTN (OTAA or ABP) we need to configure it on the TTN portal. We will see which option we should select in the following steps.
141
+
In order to select the way in which the board is going to connect with TTN (OTAA or ABP) we need to configure it on the TTN portal. You will see which option you should select in the following steps.
142
142
143
143
### 5. Registering the Portenta on TTN
144
144
145
-
Before your Portenta H7 can start communicating with the TTN you need to [register](https://www.thethingsnetwork.org/docs/devices/registration.html) the board with an application. Go back to the TTN portal and scroll to **End devices** section on your Application dashboard, then click **Add end device**.
145
+
Before your Portenta H7 can start communicating with the TTN, you need to [register](https://www.thethingsnetwork.org/docs/devices/registration.html) the board with an application. Go back to the TTN portal and scroll to **End devices** section on your Application dashboard, then click **Add end device**.
146
146
147
147

148
148
149
-
On the registration page, first we have to fill in information about our board. Select brand Arduino SA, and Portenta Vision Shield - LoRa® as the model. Hardware and firmware versions will automatically be set the newest ones. Then set your preferred region.
149
+
On the registration page, first you have to fill in information about your board. Select brand Arduino SA and Portenta Vision Shield - LoRa® as the model. Hardware and firmware versions will automatically be set to the newest ones. Then set your preferred region.
150
150
151
151

152
152
153
-
In the second step of registering the device, fill in **End device ID** and **EUI**. You can click the generate button next to the AppKey field to generate an app key for this device. Similarly, you can press the button next to the AppEUI field to make it all zeros, or enter your own AppEUI.
153
+
In the second step of registering the device, fill in **End device ID** and **EUI**. You can click the generate button next to the AppKey field to generate an app key for this device. Similarly, you can press the button next to the AppEUI field to make it all zeros or enter your own AppEUI.
154
154
155
155
**Note**: The Device ID must be lowercase and without spaces. The **DevEUI** can be copied from the terminal in OpenMV. You can run the following script to obtain it.
156
156
@@ -167,11 +167,11 @@ After pressing the Register button, your board will show up on the **Device Over
167
167
168
168
### 6. Connecting to TTN
169
169
170
-
Once your board has been registered you can send information to TTN. Let's go back to the sketch to fill in the appEui and appKey. The sketch we use here will use OTA connection.
170
+
Once your board has been registered, you can send information to TTN. Let's go back to the sketch to fill in the appEui and appKey. The sketch you use here will leverage OTA connection.
171
171
172
172
You can read more into OTA vs ABP activation mode at [this link](https://www.thethingsnetwork.org/docs/devices/registration.html)
173
173
174
-
Once your board has been registered you can send information to TTN. Let's proceed in OpenMV. In the sketch the application EUI and the app key needs to be filled in. Find the EUI and the App key from TTN **Device Overview** page.
174
+
Once your board has been registered, you can send information to TTN. Let's proceed in OpenMV. In the sketch the application EUI and the app key needs to be filled in. Find the EUI and the App key from TTN **Device Overview** page.
175
175
176
176
If this process is done successfully, you will see this message:
177
177
@@ -180,7 +180,7 @@ Message confirmed.
180
180
```
181
181
182
182
## Conclusion
183
-
If you receive this message, you have managed to configure the Portenta H7 and the Vision Shield - LoRa® on the TTN. We have retrieved the device EUI, used it to register the device in the TTN console, and programmed the board using the data provided by TTN. Now, we can send data over the LoRa® network which can be viewed from anywhere in the world (as long as we have an Internet connection and our device is in range from a TTN gateway).
183
+
If you receive this message, you have managed to configure the Portenta H7 and the Portenta Vision Shield - LoRa® to TTN. You have retrieved the device EUI, used it to register the device in the TTN console and programmed the board using the data provided by TTN. Now, you can send data over LoRa® network, which can be viewed from anywhere in the world (as long as you have an Internet connection and your device is in range from a TTN gateway).
184
184
185
185
### Complete Sketch
186
186
@@ -233,11 +233,11 @@ while (True):
233
233
234
234
### Next Steps
235
235
236
-
- Experiment your Vision Shield's capabilities with OpenMV and the examples from the dedicated library for Arduino. You can continue with [this tutorial](https://www.arduino.cc/pro/tutorials/portenta-h7/por-openmv-bt) from the Arduino Pro site.
236
+
- Experiment your Vision Shield's capabilities with OpenMV and the examples from the dedicated library for Arduino. You can continue with [this tutorial](https://docs.arduino.cc/tutorials/portenta-vision-shield/blob-detection) from the Arduino DOCS site.
237
237
- Combine LoRaWAN® protocol with an OpenMV example to develop your own IoT application. Take advantage of the Vision Shield's camera to detect, filter, classify images, read QR codes or more.
238
238
239
239
## Troubleshooting
240
240
241
-
The most common issue is that the device cannot connect to a TTN gateway. Again, it is a good idea to check if we have coverage in the area we are conducting this tutorial, by checking out [this map](https://www.thethingsnetwork.org/map).
241
+
The most common issue is that the device cannot connect to a TTN gateway. Again, it is a good idea to check if you have coverage in the area you are conducting this tutorial, by checking out [this map](https://www.thethingsnetwork.org/map).
242
242
243
-
If we are within good range of a gateway, we should also try to move our device and antenna to a window, and even hold it out the window and move it around. This has proven successful on numerous accounts, as the signal can travel less obstructed.
243
+
If you are within a good range from a gateway, you should also try to move your device and antenna to a window and even hold it out the window and move it around. This has proven successful on numerous accounts, as the signal can travel less obstructed.
0 commit comments