# Arduino MKR WAN 1300/1310

Arduino MKR WAN 1300/1310 is the fastest start with LoRa and the Internet of Things. It’s the perfect introduction to IoT for your organization, and is also used in education. Arduino MKR WAN 1300/1310 uses its LoRa connectivity to connect to the internet from anywhere in the world where there is LoRa coverage.

{% hint style="info" %}
When ordering the Arduino MKR WAN 1300/1310 make sure that an antenna is included in the order since it's not delivered with the board
{% endhint %}

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FuorSjwhHAULAh9pdK6eI%2FMKRWAN1300WANT_01.iso_1000x750.webp?alt=media&#x26;token=f56a47fc-9f1d-4453-9b8c-4cdd87ff81a5" alt="" width="188"><figcaption></figcaption></figure>

## 1. Setup your Arduino MKR WAN 13X0

> To connect the Arduino MKR WAN 13X0 to the computer you must use a USB cable.

### Setup your Arduino environment

* Download the [Arduino IDE](https://www.arduino.cc/en/Main/Software) and follow the installer. We'll use it later on to program the Arduino MKR WAN 13X0.
* &#x20;Connect your Arduino MKR WAN 13X0 to your computer.
* From the Tools menu, under Board, under Arduino SAMD boards (32-bits ARM Cortex M0+), select Arduino MKR WAN 1300 or 1310.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FKIjuJCOZHYqSoJhyJoUP%2FAfbeelding1.png?alt=media&#x26;token=80c26d6c-36b3-4b41-bb29-601f9e7099a7" alt=""><figcaption></figcaption></figure>

* &#x20;If the board is not available go to Tool menu, under Board select Board Manager and search for the Arduino SAMD boards (32-bits ARM Cortex M0+).  Click install to install the board.
* Also from the Tools menu, under Port, make sure the correct COM port is selected. If you have multiple options, select the one stating Arduino MKR WAN 13X0. If nonee of your ports is labelled that way, disconnect your Arduino MKR WAN 13X0, reopen the menu, check which COM port disappeared, reconnect the Arduino MKR WAN 13X0 and choose the previously identified COM port.

### Test your Arduino MKR WAN 13X0 device

We will now test whether the Arduino MKR WAN 13X0 device is working by letting a LED blink.

* In the Arduino IDE go to File, under Examples, under 01. Basics, select Blink
* From the Sketch menu, click Upload or select the big arrow on the left of the Arduio IDE to send the software to the Arduino MKR WAN 13X0. If all went well it will say Uploading complete in the bottom of the Arduino IDE and the LED on the Arduino MKR WAN 13X0 board will blink!

![](https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FkfdGOUu1eT9r4TP5aYnb%2FAfbeelding2.png?alt=media\&token=ae658977-a7b4-416c-a5d8-50808b774f98) ![](https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2F4PsoMpOiXGs45YWt5d0E%2FAfbeelding3.png?alt=media\&token=a0387415-fd7d-4b27-beec-a74cfc759a22)

### Test the LoRa module on the Arduino MKR WAN 13X0

The LoRa connectivity on your Arduino MKR WAN 13X0 device is managed by the Murata CMWX1ZZABZ module. With the following steps we check whether this module works correctly.

* In the Arduino IDE select from the sketch menu, under Include Library select Manage Libraries. Search for MKRWAN and select the 1.1.0 version.

![](https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2F81Ef2LezhelhzBkTj1ZC%2FAfbeelding4.png?alt=media\&token=46c16578-2a30-4caa-a9e0-039f713c8ecb) ![](https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FxtUVRJAU9JTRm2Vv9T1S%2FAfbeelding5.png?alt=media\&token=cf1b7257-8132-47f4-a64c-a7f6f503d9f6)

* After the library is downloaded go to File, under Examples, under MKRWAN select FirstConfiguration.
* Upload the sketch to the Arduio MKR WAN 13X0
* Meanwhile, from the **Tools** menu, open the Serial Monitor. Here we will find the unique Device EUI. **Store the value in a text file**. You'll need it when adding the device to KPN Things.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FBFtq6956MLQeEw4HCWKo%2FAfbeelding6.png?alt=media&#x26;token=64fee0ec-35b2-4324-907d-b3ed7cea76b2" alt=""><figcaption></figcaption></figure>

* If your device has not the latest firmware version you can load the MKRWANFWUpdate\_standalone.ino sketch via File, under Examples, MKRWAN to update the device firmware.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FamFrGBkI6ekR6pTEUwBS%2FAfbeelding7.png?alt=media&#x26;token=74af21e7-640e-49e6-9414-90fda985a784" alt=""><figcaption></figcaption></figure>

## 2. Register your Arduino MKR WAN 13X0 to KPN Things

### Add device

Open the [KPN Things Portal](https://portal.kpnthings.com). Go to the **All Devices** page and click on **Add new Device**.

<div data-full-width="true"><figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2Fv0dwK2vreYGlY5VmGJna%2FAfbeelding8.png?alt=media&#x26;token=4578b28a-cb86-4d1c-859f-d77635b6321c" alt=""><figcaption></figcaption></figure></div>

1. Select the **Own LoRa device (**&#x70;reset connectivit&#x79;**)** device type&#x20;

   <figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FGTDIEsWKkgUuda8jDnNh%2FAfbeelding9.png?alt=media&#x26;token=e5dded69-cfe2-4f44-8b82-6e0eb3437ee1" alt=""><figcaption></figcaption></figure>
2. **Enter a name** for your Arduino MKR WAN 13X0 device
3. Click **Add Device** to continue

### Provide network information

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2Fg6l4H8yZBC4FqNH8JeFP%2FAfbeelding10.png?alt=media&#x26;token=e980d587-42fd-41c8-82f0-0690abe45371" alt=""><figcaption></figcaption></figure>

1. **DevEUI**: the value you retrieved from the LoRa module in the step [#test-your-arduino-mkr-wan-13x0-device](#test-your-arduino-mkr-wan-13x0-device "mention")
2. **AppEUI:** you can use the following value: `0059AC00000FFFFF`
3. **AppKey**: Every device should have its own unique AppKey, since it is the root security key of your device. You can generate a unique AppKey here: <https://www.loratools.nl/#/keys>
4. Click **Add Network Info** to save the network information and then **Finish** to continue.

{% hint style="info" %}
Store these three values somewhere, because you will be needing them to program your device later on.
{% endhint %}

### Check your newly created Device

You are now on the Device Detail Page. In the LoRa tab you will see the **network status**. This can temporarily be *Pending creation*, but if you refresh the page it should switch to *Active*. This means your device is correctly registered to the network.

If the network status sticks to *Pending creation*, you could try to delete the Device and and provision again (Restart at step [#add-device](#add-device "mention"))

If the Network Status ended up in **Failed**, something has gone wrong. Most likely the DevEUI is already registered through another application or account. Please make sure you remove the device registration from the other application or account and re-add the device in the Things Portal.

## 3. Program your device to send a LoRa message

### Download the ThingsML library

* From the **Sketch** menu in your Arduino IDE click on Include Library, **Manage Libraries...**

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FubczCNHWuVZw1u6mSFYU%2FAfbeelding11.png?alt=media&#x26;token=6c1451b4-c48c-4eec-a7a8-f309f4a00b34" alt=""><figcaption></figcaption></figure>

* Now, in the **Library Manager**, search for ThingsML and click **Install**. When the installation is finished, click **on the Library manager icon to close the left window**.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FItw3MTAvcwkyXyDlQfaE%2FAfbeelding12.png?alt=media&#x26;token=ac96b97f-b2bf-4591-820a-bd11869101f1" alt=""><figcaption></figcaption></figure>

### Make a sketch

From the **File** menu, click on **Examples**.

* Now find **ThingsML**, then select Arduino, **MKR\_WAN\_1300,** and within that choose **Arduino\_mkr\_wan\_1300\_example.**

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FLj4E4G0orUNObMT6UAOE%2FAfbeelding13.png?alt=media&#x26;token=25a3aa13-8cdc-41e2-af1d-49769c9e6d69" alt=""><figcaption></figcaption></figure>

* A sketch will open. Now update the values for the variables `AppEUI`, and `AppKey` in the code with the values you entered earlier in the Portal. The `DevEUI` is automatically filled in on the background.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2F23k5u6iXouUjOIxsKAEz%2FAfbeelding14.png?alt=media&#x26;token=a17c7eac-74f5-4eb3-a820-d44382735975" alt=""><figcaption></figcaption></figure>

### Run the sketch

**Upload** the sketch to your Arduino MKR WAN 13X0 and open the **Serial Monitor**. You will see your module version and if your device is successfully connected and joined the network. At some point you will see the following:

```
Your module version is: ARD-078 1.2.3
Your device EUI is: a8610a………….
Connected!
Sending message...
Message sent correctly!
Sending message...
Message sent correctly!
```

If you see something else instead of `connected` , move closer to your window or walk out into the garden to improve reception from the LoRa network. Then disconnect and reconnect the Arduino MKR WAN 13X0 to your computer. You probably need some more coverage to be able to join the network.

After joining, your Arduino MKR WAN 13X0 will send a message every 300 seconds containing a fixed temperature “measurement” in ThingsML format. Read more about [ThingsML](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/connect-devices/broken-reference).

## 4. Check incoming data in the Portal

Now your Arduino MKR WAN 13X0 has joined and is sending data, you could visit the **LoRa Data** tab on your **Device Detail Page** in the Portal. You should see your Join request and Join accept appear like in the screenshot below and at this point you will see more data as well.

<figure><img src="https://1453626848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl6RrePMSAjRvOgcHjMBZ%2Fuploads%2FggkPa70ejX5AwxFNuZ6F%2FAfbeelding15.png?alt=media&#x26;token=fedf6850-61e0-4a9a-8106-dbc157983507" alt=""><figcaption></figcaption></figure>

You now successfully connected your Arduino MKR WAN 1300/1310.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kpnthings.com/kpn-things/getting-started/tutorials/connect-devices/arduino-mkr-wan-1300-1310.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
