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
{{ message }}
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
This tutorial explains how to connect your Portenta H7 to The Things Network (TTN) using the 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.
4
+
This tutorial explains how to connect your Portenta H7 to The Things Network (TTN) using the 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.
5
5
6
-
[note]
7
-
8
-
**Note:** In order to connect your Portenta to the TTN you need to ensure that you are within range (10 Km) from an available Lora Gateway. It is recommended that you check Lora Gateway availability on [The Things Network map](https://www.thethingsnetwork.org/map) before you try this tutorial.
9
-
10
-
[/note]
6
+
***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.***
11
7
12
8
### You Will Learn
13
9
14
-
-About LoRaWAN® and The Things Network,
15
-
-About creating a TTN application,
16
-
-How to establish a connection between the H7 and the TTN,
10
+
- About LoRaWAN® and The Things Network,
11
+
- About creating a TTN application,
12
+
- How to establish a connection between the H7 and the TTN,
-[1x Dipole Pentaband antenna](https://store.arduino.cc/antenna) or a UFL Antenna of the H7
19
+
- Arduino [offline](https://www.arduino.cc/en/main/software) IDE or Arduino ([Web Editor](https://create.arduino.cc/)
20
+
- USB C cable (either USB A to USB C or USB C to USB C)
21
+
- An [account](https://account.thethingsnetwork.org/users/login) with The Things Network
26
22
27
23
## Connecting to the TTN
28
24
29
25
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 applicaiton 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. 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.
30
26
31
-
### 1. Setting up the Environment
27
+
### 1. Setting up the Environment
32
28
33
29
Start by pointing your browser to www.thethingsnetwork.org and use the Sign Up button to setup an account. Next, then fill all the required fields to complete a new registration (if you already have a TTN account, skip this step and continue by signing in).
34
30
35
31

36
32
37
33
### 2. Creating an app on TTN
38
34
39
-
Once you have created an account with TTN, you need to create a TTN [application](https://www.thethingsnetwork.org/docs/applications/). This(?) application provides a way to aggregate data from different devices, and then use these data with other online / offline tools. Go to your [console](https://console.thethingsnetwork.org), and click on **Applications**
35
+
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. Go to your [console](https://console.thethingsnetwork.org), and click on **Applications**
40
36
41
37

42
38
@@ -46,8 +42,8 @@ Here you'll have a list of all your applications. Now create your first app by p
46
42
47
43
You have now to fill only the first two fields:
48
44
49
-
* The first one is the **ID** of your app: this must be lowercase and without spaces.
50
-
* The second one is a **Description** of your app, and there's no restrictions on formatting
45
+
- The first one is the **ID** of your app: this must be lowercase and without spaces.
46
+
- The second one is a **Description** of your app, and there's no restrictions on formatting
51
47
52
48

53
49
@@ -57,46 +53,42 @@ After completing these two fields, press on the "Add application" button located
57
53
58
54
Let's take a closer look at these sections:
59
55
60
-
***Application Overview** and Application EUIS: in order to use this app, you'll need the Application ID and its EUIs. 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.
61
-
***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 new one.
62
-
***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.
63
-
***Access keys**: it's the most sensible information. It is basically the key to gain access to your app, so keep it safe.
56
+
-**Application Overview** and Application EUIS: in order to use this app, you'll need the Application ID and its EUIs. 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.
57
+
-**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 new one.
58
+
-**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.
59
+
-**Access keys**: it's the most sensible information. It is basically the key to gain access to your app, so keep it safe.
64
60
65
61
### 3. Configuring the Vision Shield
66
62
67
63
It's now time to connect your Portenta H7 and Lora Vision Shield to TTN. You'll need to upload code to the board, so as you probably already know, there are two options:
68
64
69
-
* Use the [Arduino Web Editor](https://create.arduino.cc/editor)
70
-
* Use the [Arduino IDE](https://www.arduino.cc/en/software), (this is the option this guide will follow)
65
+
- Use the [Arduino Web Editor](https://create.arduino.cc/editor)
66
+
- Use the [Arduino IDE](https://www.arduino.cc/en/software), (this is the option this guide will follow)
71
67
72
68
Plug the Portenta Vision Shield - LoRa to the Portenta H7 and them to your PC through the USB port. Be sure to have selected the right board "Arduino Portenta H7 (M7 core)" and the right port.
73
69
74
70

75
71
76
-
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. The first code you need to upload and run is from the **MKRWAN** library, and its name is _FirstConfiguration_.
72
+
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. The first code you need to upload and run is from the **MKRWAN** library, and its name is **FirstConfiguration**.
77
73
78
74

79
75
80
76
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).
81
77
82
78
```cpp
83
-
... // change this to your regional band (eg. US915, AS923, ...)
79
+
// change this to your regional band (eg. US915, AS923, ...)
84
80
if (!modem.begin(EU868)) { ...
85
81
```
86
-
87
-
[note]
88
-
89
-
**Note:** Consider that in Australia the boards connect correctly to TTN gateways on AS923 frequencies; AU915 frequencies requires the selection of sub band 2, not yet implemented in the firmware.
90
-
91
-
[/note]
82
+
***Consider that in Australia the boards connect correctly to TTN gateways on AS923 frequencies; AU915 frequencies requires the selection of sub band 2, not yet implemented in the firmware.***
92
83
93
84
Once you have added to the sketch the frequency according to your country, you can upload it to the board. Then, once the upload is completed open the Serial Monitor. The following details will show:
94
85
95
-
```cpp
86
+
```text
96
87
Your module version is: ARD-078 1.2.1
97
88
Your device EUI is: a8xxxxxxxxxxxxxx
98
89
Are you connecting via OTAA (1) or ABP (2)?
99
90
```
91
+
100
92
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.
101
93
102
94
### 4. Registring the Portenta on TTN
@@ -106,7 +98,7 @@ Before your Portenta H7 can start communicating with the TTN you need to [regist
106
98

107
99
108
100
On the registration page, fill in **Device ID** and **EUI**.
109
-
**Note**: The Device ID must be lowercase and without spaces. The **EUI** should be copied from the Serial Monitor.```
101
+
**Note**: The Device ID must be lowercase and without spaces. The **EUI** should be copied from the Serial Monitor.
110
102
111
103

112
104
@@ -118,13 +110,13 @@ After pressing the Register button, your board will show up on the **Device Over
118
110
119
111
Once your board has been registered you can send information to TTN. Let's come back to the Serial Monitor and proceed. It will ask for:
120
112
121
-
* activation mode (that, in this case, is OTAA as you can see in the screenshot above),
122
-
* the Application EUI
123
-
* the App Key.
113
+
- Activation mode (that, in this case, is OTAA as you can see in the screenshot above),
114
+
- The Application EUI
115
+
- The App Key.
124
116
125
117
Lets start by making a connection through the OTAA. Enter "1" in the Serial Monitor input box and press ENTER. Then, find the EUI and the App key from TTN **Device Overview** page. You can read more into OTA vs ABP activation mode at [this link](https://www.thethingsnetwork.org/docs/devices/registration.html)
126
118
127
-
```cpp
119
+
```text
128
120
Your module version is: ARD-078 1.1.9
129
121
Your device EUI is: a8xxxxxxxxxxxx0a
130
122
Are you connecting via OTAA (1) or ABP (2)?
@@ -134,7 +126,7 @@ Enter your APP KEY
134
126
135
127
Next, introduce the **APP EUI** and the **APP KEY** in the Serial Monitor. If this process is done successfully, you will see this message:
136
128
137
-
```cpp
129
+
```text
138
130
Message sent correctly!
139
131
```
140
132
@@ -145,9 +137,9 @@ If you recieve this message, you have managed to configure the Portenta H7 and t
145
137
146
138
### Next Steps
147
139
148
-
-Try sending uplink and downlink messages between Portenta and your TTN application with _LoraSendAndReceive_ sketch from the MKRWAN library.
149
-
-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.
150
-
-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.
140
+
- Try sending uplink and downlink messages between Portenta and your TTN application with **LoraSendAndReceive** sketch from the MKRWAN library.
141
+
- 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.
142
+
- 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.
151
143
152
144
## Troubleshooting
153
145
@@ -156,5 +148,5 @@ The most common issue is that the device cannot connect to a TTN gateway. Again,
156
148
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.
157
149
158
150
**Authors:** Lenard George, Ignacio Herrera
159
-
**Reviewed by:** Jose Garcia, Linnea Åkerberg [02.02.2021]
160
-
**Last revision:**Lenard George [27.3.2020]
151
+
**Reviewed by:** Jose Garcia, Linnea Åkerberg [2021-02-02]
0 commit comments