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/carriers/portenta-max-carrier/tutorials/mc-ard-lora/content.md
+29-31Lines changed: 29 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@ title: Connecting the Portenta Max Carrier to The Things Network
3
3
description: This tutorial explains how to connect your Portenta Max Carrier to the Things Network(TTN) using its onboard LoRaWAN® module.
4
4
difficulty: intermediate
5
5
tags:
6
-
- iot
7
-
- LoRa®
6
+
- IoT
7
+
- LoRaWAN®
8
8
author: Taddy Chung, José Bagur
9
9
libraries:
10
10
- name: MKRWAN
@@ -17,7 +17,7 @@ software:
17
17
18
18
## Overview
19
19
20
-
This tutorial explains how to connect your Arduino® Max Carrier, with an [Arduino® Portena H7](https://store.arduino.cc/products/portenta-h7), to The Things Network (TTN) using its onboard LoRaWAN® module. The article will focus on achieving communication between the Max Carrier and an application on TTN.
20
+
This tutorial explains how to connect your [Arduino® Max Carrier](http://store.arduino.cc/portenta-max-carrier), with an [Arduino® Portena H7](https://store.arduino.cc/products/portenta-h7) to The Things Network (TTN) using its onboard LoRaWAN® module. The article will focus on achieving communication between the Max Carrier and an application on TTN.
21
21
22
22
## Goals
23
23
@@ -28,10 +28,10 @@ This tutorial explains how to connect your Arduino® Max Carrier, with an [Ardui
- An active account in [TTN](https://www.thethingsnetwork.org/).
37
37
@@ -41,7 +41,7 @@ The Arduino® Portenta Max Carrier provides you with an unlimited range of appli
41
41
42
42

43
43
44
-
***For more in-depth information about LoRa® and LoRaWAN®, please read [The Arduino Guide to LoRa® and LoRaWAN®](https://docs.arduino.cc/learn/communication/lorawan-101).***
44
+
***For more in-depth information about LoRa® and LoRaWAN®, please read [The Arduino Guide to LoRa® and LoRaWAN®](/learn/communication/lorawan-101).***
45
45
46
46
## Connecting to TTN
47
47
@@ -65,25 +65,25 @@ Begin by attaching the Arduino® Portenta H7 board to the high-density connector
65
65
66
66

67
67
68
-
To power the CMWX1ZZABZ-078 LoRaWAN® module of the Portenta Max Carrier, you can use the **DC power jack** (with a 4.5V to 36V external DC power supply) of the Portenta Max Carrier or a **18650 3.7V Li-Ion battery**, connected to the Portenta Max Carrier battery clips; you can power the module also directly from the USB-C connector of the Portenta H7 board. **Also, do not forget to attach an 868-915 MHz antenna to the SMA connector (J9) in the Max Carrier**.
68
+
To power the CMWX1ZZABZ-078 LoRaWAN® module of the Portenta Max Carrier, you can use the **DC power jack** (with a 4.5V to 36V external DC power supply) of the Portenta Max Carrier or a **18650 3.7V Li-Ion battery**, connected to the Portenta Max Carrier battery clips; you can power the module also directly from the USB-C connector of the Portenta H7 board. **Also, do not forget to attach an 868-915 MHz antenna to the SMA connector (J9) on the Max Carrier**.
69
69
70
70

71
71
72
72
***Using the LoRaWAN® module of the Portenta Max Carrier without an antenna may damage it. Please, do not forget to connect a suitable antenna to the dedicated SMA connector (J9) on the Portenta Max Carrier.***
73
73
74
-
Now you can connect the Portenta H7 board to your computer using a USB-C cable. **Don't forget to change the position of the BOOT DIP switch** (SW1), **from BOOT SEL to BOOT**; otherwise, you will not be able to program your Portenta H7 board when attached to the Portenta Max Carrier.
74
+
Now you can connect the Portenta H7 board to your computer using a USB-C cable. **Don't forget to change the position of the BOOT DIP switch (SW1)to OFF**; otherwise, you will not be able to program your Portenta H7 board when attached to the Portenta Max Carrier.
75
75
76
76

77
77
78
78
### 2. Setting up the Software
79
79
80
-
You can use several Arduino libraries with the CMWX1ZZABZ-078 LoRaWAN® module from Murata®; we recommend the [MKRWAN library](https://github.com/arduino-libraries/MKRWAN), developed by the Arduino Team. The MKRWAN library provides you the APIs to communicate with LoRa® and LoRaWAN® networks using the CMWX1ZZABZ-078 module. You can use this library in the Arduino IDE, both [online](https://create.arduino.cc/editor) and [offline](https://www.arduino.cc/en/software).
80
+
You can use several Arduino libraries with the CMWX1ZZABZ-078 LoRaWAN® module from Murata®; we recommend the [MKRWAN library](https://github.com/arduino-libraries/MKRWAN), developed by the Arduino Team. The MKRWAN library provides you with the APIs to communicate with LoRa® and LoRaWAN® networks using the CMWX1ZZABZ-078 module. You can use this library in the Arduino IDE, both [online](https://create.arduino.cc/editor) and [offline](https://www.arduino.cc/en/software).
81
81
82
-
If you are using the online IDE, you don't need to do anything; the library is already installed and ready to be used. If you are using the offline IDE, you must install the library **manually**. Installing the library can be done quickly by navigating to **Tools > Manage Libraries...** and then in the **Library Manager** search for **MKRWAN** library by Arduino; remember to install the latest version of the libraries. You can also access the Library Manager using the left toolbar of the IDE, as shown in the image below:
82
+
If you are using the online IDE, you don't need to do anything; the library is already installed and ready to be used. If you are using the offline IDE, you must install the library **manually**. Installing the library can be done quickly by navigating to **Tools > Manage Libraries...** and then in the **Library Manager** search for **MKRWAN** library by Arduino; remember to install the latest version of the libraries. You can also access the Library Manager using the left toolbar of the IDE, as shown in the image below:
83
83
84
84

85
85
86
-
***Currently, there are two versions of the MKRWAN library. We recommend using the MKRWAN_v1 library since MKRWAN_v2 library is still in beta.***
86
+
***Currently, there are two versions of the MKRWAN library. We recommend using the MKRWAN_v1 library since MKRWAN_v2 library is still in beta phase.***
87
87
88
88
To use the MKRWAN library with the Portenta Max Carrier, you must define `PORTENTA_CARRIER` before the library inclusion, as shown below:
89
89
@@ -94,24 +94,24 @@ To use the MKRWAN library with the Portenta Max Carrier, you must define `PORTEN
94
94
95
95
#### 2.1 Updating the LoRaWAN® Module Firmware
96
96
97
-
The LoRaWAN® module firmware of the Portenta Max Carrier **must be updated** before its first use. This can be done using the example sketch `MKRWANFWUpdate_standalone` of the MKRWAN library. You can open this example by navigating to **Files > Examples MKRWAN**; before uploading the sketch into the Portenta H7 board, open the `MKRWANFWUpdate_standalone.ino` file and define `PORTENTA_CARRIER` before the library inclusion, as shown in the image below:
97
+
The LoRaWAN® module firmware of the Portenta Max Carrier **must be updated** before its first use. This can be done using the example sketch `MKRWANFWUpdate_standalone` of the MKRWAN library. You can open this example by navigating to **File > Examples > MKRWAN**. Before uploading the sketch to the Portenta H7 board, open the `MKRWANFWUpdate_standalone.ino` file and define `PORTENTA_CARRIER` before the library inclusion, as shown in the image below:
98
98
99
99

100
100
101
-
Upload the sketch, open the Serial Monitor and wait for the firmware update to finish. You should see a confirmation message when the process is done as shown in the image below:
101
+
Upload the sketch, open the Serial Monitor and wait for the firmware update to finish. You should see a confirmation message when the process is done.
102
102
103
103
104
104
### 3. Provisioning the Arduino® Portenta Max Carrier
105
105
106
-
Device provisioning is a process comparable to bank card numbering. Let's think about bank cards; bank cards numbers start with a six-digit vendor ID number that indicates who allocated and controls the card's security; the remaining digits are unique numbers associated with a specific card. Devices with LoRa® and LoRaWAN® capabilities have a similar system; the Join Server Unique Identifier (usually referred to as `JoinEUI`) is a number that manages the security and authorizes the device in a network, while the **Device Unique Identifier** (usually referred to as `DevEUI`) is a unique number that identifies the device. The `JoinEUI` and `DevEUI` numbers, are required to send information to TTN; the `JoinEUI` number is provided by the network (in this case TTN) while the `DevEUI` is provided by the manufacturer of the device's LoRa® module.
106
+
Device provisioning is a process comparable to bank card numbering. Let's think about bank cards; bank cards numbers start with a six-digit vendor ID number that indicates who allocated and controls the card's security; the remaining digits are unique numbers associated with a specific card. Devices with LoRa® and LoRaWAN® capabilities have a similar system; the **Join Server Unique Identifier** (usually referred to as `JoinEUI`) is a number that manages the security and authorizes the device in a network, while the **Device Unique Identifier** (usually referred to as `DevEUI`) is a unique number that identifies the device. The `JoinEUI` and `DevEUI` are required to send information to TTN; the `JoinEUI` number is provided by the network (in this case TTN) while the `DevEUI` is provided by the manufacturer of the device's LoRa® module.
107
107
108
108
The following sketch let's you find out what is the `DevEUI` of your Portenta Max Carrier:
109
109
110
110
```arduino
111
111
#define PORTENTA_CARRIER
112
112
#include <MKRWAN.h>
113
113
114
-
_lora_band region = US915;
114
+
auto region = US915;
115
115
116
116
LoRaModem modem(Serial1);
117
117
@@ -124,21 +124,20 @@ void setup() {
124
124
while(1) {}
125
125
}
126
126
127
-
Serial.print("Your Portenta Max Carrier DevEUI is: ");V
127
+
Serial.print("Your Portenta Max Carrier DevEUI is: ");
128
128
Serial.println(modem.deviceEUI());
129
129
}
130
130
131
-
void loop() {
132
-
}
131
+
void loop() {}
133
132
```
134
133
135
134
The only line you may need to change before uploading the code is the one that sets the frequency:
136
135
137
136
```arduino
138
-
_lora_band region = US915;
137
+
auto region = US915;
139
138
```
140
139
141
-
Set the frequency designator according to your country if needed. You can find more information about frequency plans definitions used in TTN [here](https://www.thethingsnetwork.org/docs/lorawan/frequency-plans/). After you upload the sketch into your Portenta H7 board, you should see the Portenta Max Carrier `DevEUI` in the Arduino IDE Serial Monitor as shown below:
140
+
Set the frequency designator according to your country. You can find more information about frequency plans definitions used in TTN [here](https://www.thethingsnetwork.org/docs/lorawan/frequency-plans/). After you upload the sketch to your Portenta H7 board, you should see the Portenta Max Carrier `DevEUI` in the Arduino IDE Serial Monitor as shown below:
142
141
143
142
```arduino
144
143
Your Portenta Max Carrier DevEUI is: a861XXXXXXXXXXXX
@@ -152,7 +151,7 @@ To send information to TTN, first we need to **create an application and registe
Now click in**Create an application**. You will need to add the following information:
154
+
Now click on**Create an application**. You will need to add the following information:
156
155
157
156
***Owner**: the person or organization that owns the application.
158
157
***Application ID**: a unique identifier for your application (must be lowercase and without spaces).
@@ -182,7 +181,7 @@ Leave the **Cluster settings** option unchecked. Then continue with the followin
182
181
***DevEUI**: fill it with the `DevEUI` number of your Portenta Max Carrier you found [before](#3-provisioning-the-arduino-portenta-max-carrier).
183
182
***AppEUI**: fill it with zeros or enter your own.
184
183
***AppKey**: generate one or enter your own.
185
-
***Device ID**: must be lowercase and without spaces.
184
+
***Device ID**: A custom identifier for your board, must be lowercase and without spaces.
186
185
187
186
Click on **Register end device**; this will take you to a **Device Overview** page where you will see all the information related to the device. Now, you will use some of this information with your Portenta Max Carrier to send data to TTN.
188
187
@@ -197,7 +196,7 @@ Now, let's start sending information to TTN. The following sketch enables you to
197
196
#include <MKRWAN.h>
198
197
#include "arduino_secrets.h"
199
198
200
-
_lora_band region = US915;
199
+
auto region = US915;
201
200
202
201
LoRaModem modem(Serial1);
203
202
@@ -234,12 +233,11 @@ void setup() {
234
233
235
234
delay(5000);
236
235
237
-
int err;
238
236
modem.setPort(3);
239
237
modem.beginPacket();
240
238
modem.print("HelLoRa World!");
241
-
err = modem.endPacket(true);
242
-
if (err > 0) {
239
+
int errorCode = modem.endPacket(true);
240
+
if (errorCode > 0) {
243
241
Serial.println("Data sent correctly!");
244
242
} else {
245
243
Serial.println("Error sending data...");
@@ -254,16 +252,16 @@ void loop() {
254
252
}
255
253
```
256
254
257
-
The `arduino_secrets.h` file which contains AppEUI and AppKey numbers for the TTN applications can be defined as following code. AppEUI and AppKey information is found on the End device page of the Application of TTN.
255
+
The `arduino_secrets.h` file which contains AppEUI and AppKey numbers for the TTN applications can be defined as following code. AppEUI and AppKey information is found on the End device page of the TTN Application.
If data was sent correctly to TTN, you should see the following messages in the Arduino IDE Serial Monitor:
262
+
If data was sent correctly to TTN, you should see the following messages in the Arduino IDE Serial Monitor:`Data sent correctly!`
265
263
266
-
In your device overview dashboard in TTN, you should see changes in data activity every time a new message is sent:
264
+
In your device overview dashboard on TTN, you should see changes in data activity every time a new message is sent.
267
265
268
266
## Conclusion
269
267
@@ -278,5 +276,5 @@ You have now successfully configured and used the onboard LoRaWAN® module of yo
278
276
While working on the sketch or when tried to upload the sketch, the Arduino IDE might show some errors preventing to proceed on the development. You can try the following troubleshooting tips to solve the commonly known issues:
279
277
280
278
* If the sketch upload process fails, check if your Portenta H7 is in bootloader mode. To put the Portenta H7 into Bootloader mode, double-press its RESET button and verify that the green LED is waving. After this, you can try re-uploading the sketch.
281
-
* Check the position of the BOOT DIP switch of the Portenta Max Carrier. If the Portenta H7 gets into bootloader mode immediately after power-on, including when connected via USB-C, change the position of the BOOT DIP switch from BOOT SEL to BOOT.
282
-
* If the Arduino IDE fails to compile the sketch, check if you have defined `PORTENTA_CARRIER` before MKRWAN library inclusion.
279
+
* Check the position of the BOOT DIP switch of the Portenta Max Carrier. If the Portenta H7 gets into bootloader mode immediately after power-on, including when connected via USB-C, change the position of the BOOT DIP switch to OFF.
280
+
* If the Arduino IDE fails to compile the sketch, check if you have defined `PORTENTA_CARRIER` before the MKRWAN library inclusion.
0 commit comments