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
+53-62Lines changed: 53 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Connecting the Portenta Max Carrier to The Things Network
3
-
description: This tutorial explains how to connect your Portenta Max Carrier to the Things Network(TTN) using the carrier's LoRaWAN® module.
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
6
- iot
@@ -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 LoRaWAN® connectivity feature. 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, 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
@@ -32,20 +32,22 @@ This tutorial explains how to connect your Arduino® Max Carrier, with an [Ardui
32
32
- 868-915 MHz antenna with SMA connector.
33
33
- USB-C cable (either USB-A to USB-C or USB-C to USB-C).
34
34
-[Arduino IDE 2.0](https://www.arduino.cc/en/software).
- An active account in [TTN](https://www.thethingsnetwork.org/).
37
37
38
38
## The Arduino® Portenta Max Carrier LoRaWAN® Module
39
39
40
-
The Arduino® Portenta Max Carrier provides you with an unlimited range of applications, from robotics and medical devices to industrial or automotive applications; the Max Carrier possibilities are endless. One feature that boosts Portenta's Max Carrier possibilities is its onboard LoRaWAN® communications module, the [CMWX1ZZABZ-078](https://www.murata.com/products/connectivitymodule/lpwa/overview/lineup/type-abz-078) from Murata®. LoRaWAN® is a Low Power Wide Area Network (LPWAN) designed to connect low power devices to the Internet. It was developed to meet and fulfill Internet of Things (IoT) devices' requirements, such as low-power consumption and low data throughput.
40
+
The Arduino® Portenta Max Carrier provides you with an unlimited range of applications, from robotics and medical devices to industrial or automotive applications; the Max Carrier possibilities are endless. One feature that boosts Portenta's Max Carrier possibilities is its **onboard LoRaWAN® module**, the [CMWX1ZZABZ-078](https://www.murata.com/products/connectivitymodule/lpwa/overview/lineup/type-abz-078) from Murata®. LoRaWAN® is a Low Power Wide Area Network (LPWAN) designed to connect low power devices to the Internet. It was developed to meet and fulfill Internet of Things (IoT) devices' requirements, such as low-power consumption and low data throughput.
41
41
42
42

43
43
44
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).***
45
45
46
46
## Connecting to TTN
47
47
48
-
Let's start sending data to TTN using the Portenta Max Carrier LoRaWAN® module. As stated before, to do this, you will need a TTN account and to be in the range of a public TTN gateway. You can check the [world map](https://www.thethingsnetwork.org/map) of public gateways connected to TTN and see if your region already has a gateway installed. If not, consider installing one!
48
+
Let's start sending data to TTN using the Portenta Max Carrier LoRaWAN® module. To do this, you will need a TTN account and to be in the range of a public TTN gateway. You can check the [world map](https://www.thethingsnetwork.org/map) of public gateways connected to TTN and see if your region already has a gateway installed. If not, consider installing one!
49
+
50
+
***Check out [this](https://www.thethingsnetwork.org/docs/gateways/) article from TTN, where you can find how to buy or build your gateway to extend TTN coverage in your region.***
49
51
50
52
To connect your Portenta Max Carrier to TTN, we must follow these steps:
51
53
@@ -57,20 +59,19 @@ To connect your Portenta Max Carrier to TTN, we must follow these steps:
57
59
58
60
Let's start!
59
61
60
-
61
62
### 1. Setting up the Hardware
62
63
63
64
Begin by attaching the Arduino® Portenta H7 board to the high-density connectors of the Arduino® Portenta Max Carrier, as shown in the image below:
64
65
65
66

66
67
67
-
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 a LoRa® 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) in the Max Carrier**.
68
69
69
70

70
71
71
-
***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 Max Carrier board.***
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.***
72
73
73
-
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 BOO**T; otherwise, you are not going to be able to program your Portenta H7 board when attached to the 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), **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
75
75
76

76
77
@@ -137,7 +138,11 @@ The only line you may need to change before uploading the code is the one that s
137
138
_lora_band region = US915;
138
139
```
139
140
140
-
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 Serial Monitor as shown below:
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:
142
+
143
+
```arduino
144
+
Your Portenta Max Carrier DevEUI is: a861XXXXXXXXXXXX
145
+
```
141
146
142
147
Now, let's use the `DevEUI` number from your Portenta Max Carrier to create an application in TTN.
143
148
@@ -160,94 +165,84 @@ Now, scroll to **End devices** in the left toolbar and then click on **Add end d
160
165
161
166

162
167
163
-
On the registration page click on **Manually**; you will have to add the following information for your Portenta Max Carrier:
168
+
On the registration page, click on **Manually**; you will have to add the following information for your Portenta Max Carrier:
164
169
165
170
***Frequency plan**: choose a region according to your country.
166
171
***LoRaWAN® version**: 1.0.2.
167
172
***Regional Parameters version**: 1.0.2.
173
+
174
+
Click on Show advanced activation, **LoRaWAN class and cluster settings** and choose:
175
+
168
176
***Activation mode**: Over the air activation (OTAA).
169
-
***DevEUI**: fill it with the `DevEUI` number of your Portenta Max Carier you found before.
177
+
***Additional LoRaWAN class capabilities**: None (class A only).
178
+
***Network defaults**: Use network's default MAC settings.
179
+
180
+
Leave the **Cluster settings** option unchecked. Then continue with the following information:
181
+
182
+
***DevEUI**: fill it with the `DevEUI` number of your Portenta Max Carrier you found [before](#3-provisioning-the-arduino-portenta-max-carrier).
170
183
***AppEUI**: fill it with zeros or enter your own.
171
184
***AppKey**: generate one or enter your own.
172
185
***Device ID**: must be lowercase and without spaces.
173
186
174
-
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. You are going to use some of this information with your Portenta Max Carrier to send information to TTN.
187
+
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
+
189
+

175
190
176
-
### 4. Sending a Message to an Application in TTN
191
+
### 4. Sending Data to an Application in TTN
177
192
178
-
Now, let's start sending information to TTN. The following sketch let's you send information to TTN using your Portenta Max Carrier LoRaWAN® module; Over the Air (OTAA) device activation method is used to join TTN:
193
+
Now, let's start sending information to TTN. The following sketch enables you to join and send data to TTN using the Over the Air (OTAA) device activation method. You will need to define your TTN application's AppEUI and AppKey numbers in the `arduino_secrets.h` file before uploading the code:
179
194
180
195
```arduino
181
196
#define PORTENTA_CARRIER
182
197
#include <MKRWAN.h>
183
198
#include "arduino_secrets.h"
184
199
200
+
_lora_band region = US915;
201
+
185
202
LoRaModem modem(Serial1);
186
203
187
204
void setup() {
188
205
Serial.begin(115200);
189
206
while (!Serial);
190
-
Serial.println(F("LoRa + Portenta Max Carrier (OTAA)"));
207
+
Serial.println(F("Portenta Max Carrier LoRaWAN Example (OTAA)"));
191
208
192
-
// change this to your regional band (eg. US915, AS923, ...)
193
-
if (!modem.begin(US915)) {
194
-
Serial.println(F("Failed to start module"));
209
+
if (!modem.begin(region)) {
210
+
Serial.println(F("Failed to start the module..."));
195
211
while (1) {}
196
212
};
197
213
198
-
Serial.print(F("Your module version is: "));
214
+
Serial.print(F("Your Portenta Max Carrier module version is: "));
199
215
Serial.println(modem.version());
200
216
201
217
if (modem.version() != ARDUINO_FW_VERSION) {
202
-
Serial.println(F("Please make sure that the latest modem firmware is installed."));
203
-
Serial.println(F("To update the firmware upload the 'MKRWANFWUpdate_standalone.ino' sketch."));
218
+
Serial.println(F("Please make sure that the modem's firmware is updated."));
219
+
Serial.println(F("To update the module's firmware, open and upload the 'MKRWANFWUpdate_standalone.ino' sketch."));
204
220
}
205
221
206
-
Serial.print(F("Your device EUI is: "));
222
+
Serial.print(F("Your Portenta Max Carrier DevEUI is: "));
207
223
Serial.println(modem.deviceEUI());
208
224
209
-
// To Use Predfined Setting for OTAA or use Custom Setting
Serial.println("Something went wrong; are you indoor? Move near a window and retry");
231
+
Serial.println("Something went wrong; are you indoor? Move near a window and retry...");
236
232
while (1) {}
237
233
}
238
234
239
235
delay(5000);
240
236
241
-
// Sending Packet Off
242
237
int err;
243
238
modem.setPort(3);
244
239
modem.beginPacket();
245
-
modem.print("HeLoRA world!");
240
+
modem.print("HelLoRa World!");
246
241
err = modem.endPacket(true);
247
242
if (err > 0) {
248
-
Serial.println("Message sent correctly!");
243
+
Serial.println("Data sent correctly!");
249
244
} else {
250
-
Serial.println("Error sending message :(");
245
+
Serial.println("Error sending data...");
251
246
}
252
247
}
253
248
@@ -258,27 +253,23 @@ void loop() {
258
253
modem.poll();
259
254
}
260
255
```
256
+
If data was sent correctly to TTN, you should see the following messages in the Arduino IDE Serial Monitor:
257
+
258
+
In your device overview dashboard in TTN, you should see changes in data activity every time a new message is sent:
261
259
262
260
## Conclusion
263
261
264
-
You have now successfully configured the Portenta Max Carrier with Portenta H7 to power up and use its onboard CMWX1ZZABZ-078 LoRaWAN® communications module. You have learned how to properly setup The Things Network (TTN) and establish a communication using its LoRaWAN® connectivity.
262
+
You have now successfully configured and used the onboard LoRaWAN® module of your Portenta Max Carrier. You also have learned how to correctly setup a TTN application and enable LoRaWAN® connectivity between a TTN application and the Portenta Max Carrier.
265
263
266
264
### Next Steps
267
265
268
-
- Scale up the usage of Portenta Max Carrier by using its additional peripherals and turning into an interesting industrial grade projects, taking the advantage of LoRaWAN® connectivity.
269
-
- You can read more about LoRa and LoRaWAN, and get a deeper understanding of how you can adapt your higher grade projects into real world solver [here](https://docs.arduino.cc/learn/communication/lorawan-101).
270
-
266
+
- Scale up the usage of Portenta Max Carrier by using its additional peripherals and turning them into interesting industrial-grade projects, taking advantage of LoRaWAN® connectivity.
267
+
271
268
## Troubleshooting
272
269
273
-
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.
274
-
275
-
- If the sketch upload process fails, please put the Portenta H7 into Bootloader mode. To put the Portenta H7 into Bootloader mode, it is required to double-press the RESET button found on the Portenta H7 and verify that the Green LED is waving. After this you can try re-uploading the sketch and it will be successfully solved.
276
-
277
-
- If the Portenta H7 gets into Bootloader mode immediately after power on, including when connected via USB-C to a device, please make sure to check the DIP Switch found on the Portenta Max Carrier board. The DIP Switch must be configured to a device address to be powered on. The DIP Switch will allow to configure BOOT_SEL to configure the address. You will be able to upload and run the code without any issue after this.
270
+
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:
278
271
279
-
- If the Arduino IDE fails to compile the sketch, please make sure to have defined for Portenta Max Carrier settings. The following one-line code should be defined above all the sketch that have been written. With this, there should not be any issue compiling sketches designed for Portenta Max Carrier boards.
280
-
281
-
```cpp
282
-
#definePORTENTA_CARRIER
283
-
```
272
+
* 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.
273
+
* 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.
274
+
* If the Arduino IDE fails to compile the sketch, check if you have defined `PORTENTA_CARRIER` before MKRWAN library inclusion.
0 commit comments