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
+101-6Lines changed: 101 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ You can use several Arduino libraries with the CMWX1ZZABZ-078 LoRaWAN® module f
81
81
82
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
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.***
87
87
@@ -144,30 +144,125 @@ Now, let's use the `DevEUI` number from your Portenta Max Carrier to create an a
144
144
145
145
### 3. Creating an Application in TTN
146
146
147
-
To send information to TTN, first we need to create an application and register a device with it. Navigate to TTN portal and sign in; after signing in, clik on **Create an application**. If you already created an aplication, clik on **Go to applications**.
147
+
To send information to TTN, first we need to **create an application and register a device with it**. Navigate to TTN portal and sign in; after signing in, click on **Create an application**. If you already created an application, click on **Go to applications**.
Now click in **Create an application**. You will need to add the following information:
150
152
151
153
***Owner**: the person or organization that owns the application.
152
154
***Application ID**: a unique identifier for your application (must be lowercase and without spaces).
153
155
154
-
Complete both fields and click on **Create application**. Now you will be redirected to the application dashboard that shows information of the newly created application. Now, scroll to **End devices** in the left toolbar and then click on **Add end device**; a registration page for end devices will open.
156
+
Complete both fields and click on **Create application**. Now you will be redirected to the application dashboard that shows information of the newly created application.
157
+
158
+

159
+
160
+
Now, scroll to **End devices** in the left toolbar and then click on **Add end device**; a registration page for end devices will open.
155
161
156
-
On the registration page click on **Manually**, now you will have to add the following information for your Portenta Max Carrier:
162
+

163
+
164
+
On the registration page click on **Manually**; you will have to add the following information for your Portenta Max Carrier:
157
165
158
166
***Frequency plan**: choose a region according to your country.
159
167
***LoRaWAN version**: 1.0.2.
160
168
***Regional Parameters version**: 1.0.2.
161
169
***Activation mode**: Over the air activation (OTAA).
162
-
***DevEUI**: fill it with the `DevEUI` number of your Portenta Max Carier.
170
+
***DevEUI**: fill it with the `DevEUI` number of your Portenta Max Carier you found before.
163
171
***AppEUI**: fill it with zeros or enter your own.
164
172
***AppKey**: generate one or enter your own.
165
173
***Device ID**: must be lowercase and without spaces.
166
174
167
-
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. We are going to use some of this information with your Portenta Max Carrier.
175
+
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.
168
176
169
177
### 4. Sending a Message to an Application in TTN
170
178
179
+
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:
180
+
181
+
```arduino
182
+
#define PORTENTA_CARRIER
183
+
#include <MKRWAN.h>
184
+
185
+
_lora_band region = US915;
186
+
187
+
LoRaModem modem(Serial1);
188
+
189
+
String appEui;
190
+
String appKey;
191
+
192
+
void setup() {
193
+
Serial.begin(115200);
194
+
while (!Serial);
195
+
Serial.println(F("LoRaWAN + Portenta Max Carrier (OTAA)"));
196
+
197
+
if (!modem.begin(region)) {
198
+
Serial.println(F("- Failed to start module!"));
199
+
while (1) {}
200
+
};
201
+
202
+
Serial.print(F("- Your module version is: "));
203
+
Serial.println(modem.version());
204
+
205
+
if (modem.version() != ARDUINO_FW_VERSION) {
206
+
Serial.println(F("- Please make sure that the latest module firmware is installed."));
207
+
Serial.println(F("- To perform a firmware update, use the 'MKRWANFWUpdate_standalone.ino' example sketch."));
208
+
}
209
+
210
+
Serial.print(F("- Your device EUI is: "));
211
+
Serial.println(modem.deviceEUI());
212
+
213
+
// To use predfined setting for OTAA or use a custom setting
0 commit comments