Skip to content

Commit b48a0bc

Browse files
canchebagurmarqdevx
authored andcommitted
Update tutorial content
1 parent b48ab63 commit b48a0bc

File tree

5 files changed

+53
-62
lines changed

5 files changed

+53
-62
lines changed

content/hardware/04.pro/carriers/portenta-max-carrier/tutorials/mc-ard-lora/content.md

Lines changed: 53 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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.
44
difficulty: intermediate
55
tags:
66
- iot
@@ -17,7 +17,7 @@ software:
1717

1818
## Overview
1919

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.
2121

2222
## Goals
2323

@@ -32,20 +32,22 @@ This tutorial explains how to connect your Arduino® Max Carrier, with an [Ardui
3232
- 868-915 MHz antenna with SMA connector.
3333
- USB-C cable (either USB-A to USB-C or USB-C to USB-C).
3434
- [Arduino IDE 2.0](https://www.arduino.cc/en/software).
35-
- [MKRWAN library](https://github.com/arduino-libraries/MKRWAN).
35+
- [Arduino MKRWAN library](https://github.com/arduino-libraries/MKRWAN).
3636
- An active account in [TTN](https://www.thethingsnetwork.org/).
3737

3838
## The Arduino® Portenta Max Carrier LoRaWAN® Module
3939

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.
4141

4242
![CMWX1ZZABZ-078 LoRaWAN® module in the Portenta Max Carrier.](assets/mc_ard_ttn_module.png)
4343

4444
***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).***
4545

4646
## Connecting to TTN
4747

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.***
4951

5052
To connect your Portenta Max Carrier to TTN, we must follow these steps:
5153

@@ -57,20 +59,19 @@ To connect your Portenta Max Carrier to TTN, we must follow these steps:
5759

5860
Let's start!
5961

60-
6162
### 1. Setting up the Hardware
6263

6364
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:
6465

6566
![CMWX1ZZABZ-078 LoRaWAN® module in the Portenta Max Carrier.](assets/mc_ard_hd_ttn_connectors.png)
6667

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**.
6869

6970
![Power sources and LoRa® antenna connector in the Portenta Max Carrier.](assets/mc_ard_ttn_power.png)
7071

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.***
7273

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.
7475

7576
![Power sources and LoRa® antenna connector in the Portenta Max Carrier.](assets/mc_ard_ttn_boot_sel.png)
7677

@@ -137,7 +138,11 @@ The only line you may need to change before uploading the code is the one that s
137138
_lora_band region = US915;
138139
```
139140

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+
```
141146

142147
Now, let's use the `DevEUI` number from your Portenta Max Carrier to create an application in TTN.
143148

@@ -160,94 +165,84 @@ Now, scroll to **End devices** in the left toolbar and then click on **Add end d
160165

161166
![Registering an end device in TTN.](assets/mc_ard_ttn_console_3.png)
162167

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:
164169

165170
* **Frequency plan**: choose a region according to your country.
166171
* **LoRaWAN® version**: 1.0.2.
167172
* **Regional Parameters version**: 1.0.2.
173+
174+
Click on Show advanced activation, **LoRaWAN class and cluster settings** and choose:
175+
168176
* **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).
170183
* **AppEUI**: fill it with zeros or enter your own.
171184
* **AppKey**: generate one or enter your own.
172185
* **Device ID**: must be lowercase and without spaces.
173186

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+
![Device overview in TTN.](assets/mc_ard_ttn_console_4.png)
175190

176-
### 4. Sending a Message to an Application in TTN
191+
### 4. Sending Data to an Application in TTN
177192

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:
179194

180195
```arduino
181196
#define PORTENTA_CARRIER
182197
#include <MKRWAN.h>
183198
#include "arduino_secrets.h"
184199
200+
_lora_band region = US915;
201+
185202
LoRaModem modem(Serial1);
186203
187204
void setup() {
188205
Serial.begin(115200);
189206
while (!Serial);
190-
Serial.println(F("LoRa + Portenta Max Carrier (OTAA)"));
207+
Serial.println(F("Portenta Max Carrier LoRaWAN Example (OTAA)"));
191208
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..."));
195211
while (1) {}
196212
};
197213
198-
Serial.print(F("Your module version is: "));
214+
Serial.print(F("Your Portenta Max Carrier module version is: "));
199215
Serial.println(modem.version());
200216
201217
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."));
204220
}
205221
206-
Serial.print(F("Your device EUI is: "));
222+
Serial.print(F("Your Portenta Max Carrier DevEUI is: "));
207223
Serial.println(modem.deviceEUI());
208224
209-
// To Use Predfined Setting for OTAA or use Custom Setting
210-
int mode = 0;
211-
while (mode != 1 && mode != 2) {
212-
Serial.println(F("Use predefined appEUI & appKEY Settings? (1) Yes | (2) No"));
213-
while (!Serial.available());
214-
mode = Serial.readStringUntil('\n').toInt();
215-
}
216-
217-
if (mode == 2){
218-
Serial.println(F("Enter your APP EUI"));
219-
while (!Serial.available());
220-
appEui = Serial.readStringUntil('\n');
221-
222-
Serial.println(F("Enter your APP KEY"));
223-
while (!Serial.available());
224-
appKey = Serial.readStringUntil('\n');
225-
} else if (mode == 1){
226-
Serial.println(F("Using predefined Settings"));
227-
}
228-
229225
appKey.trim();
230226
appEui.trim();
231227
232228
int connected = modem.joinOTAA(appEui, appKey);
233229
234230
if (!connected) {
235-
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...");
236232
while (1) {}
237233
}
238234
239235
delay(5000);
240236
241-
// Sending Packet Off
242237
int err;
243238
modem.setPort(3);
244239
modem.beginPacket();
245-
modem.print("HeLoRA world!");
240+
modem.print("HelLoRa World!");
246241
err = modem.endPacket(true);
247242
if (err > 0) {
248-
Serial.println("Message sent correctly!");
243+
Serial.println("Data sent correctly!");
249244
} else {
250-
Serial.println("Error sending message :(");
245+
Serial.println("Error sending data...");
251246
}
252247
}
253248
@@ -258,27 +253,23 @@ void loop() {
258253
modem.poll();
259254
}
260255
```
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:
261259

262260
## Conclusion
263261

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.
265263

266264
### Next Steps
267265

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+
271268
## Troubleshooting
272269

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:
278271

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-
#define PORTENTA_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.
284275

0 commit comments

Comments
 (0)