The Arduino MKR 1300 bridges the ATMEL SAMD21 with a LoRa module, allowing for remote IoT applications such as mining, farms, and off-shore rigs. In this tutorial, we will learn how to setup the Arduino IDE for use with the Arduino MKR 1300.
Include the Arduino MKR 1300 Board
The first step into using the Arduino MKR 1300 is to configure the Arduino IDE to use the MKR board. To install the MKR board navigate to the Board Manager by clicking Tools > Board: > Boards Manager. In the board manager, enter “MKR” into the search bar, select the result “Arduino SAMD Boards”, and then click install. Some users may find that the downloading and installation of the MKR boards take some time, so patience here goes a long way.
During the installation, you may also be prompted about drivers, in which case install the drivers, otherwise the MKR board may not be recognized by the computer.
Connect the Arduino and Configure the IDE
With the board installed into the Arduino IDE, it is time to connect the Arduino MRK 1300 to the computer and then configure the IDE to target it. The Arduino MKR 1300 uses a micro USB B cable to connect to a computer (same type of connector as found on most Android smartphones).
It should be stated that the Arduino MKR 1300 comes on a piece of thick anti-static foam but this MUST be removed from the MKR otherwise the MKR may behave erratically (i.e. throw errors and crash). In the IDE select Tools > Board: > Arduino MKR WAN 1300. If you are using a different MKR board then you will need to select that board instead.
Then the port needs to be selected. Assuming that the MKR board was recognized by the system it should be a COM port that has the name Arduino MKR.
Testing the Board
To test that the board is working correctly we will load the blink example built into the Arduino IDE. One of the advantages of the Arduino IDE is that code written for one board on the IDE will most likely work on all other boards on the IDE. This allows easy migration from one processor to another with minimal code changes.
To load the blink example navigate to File > Examples > 0.1Basics > Blink, make sure that the board and port are correct (these can sometimes change themselves to the last board used) and then click upload. If everything goes to plan the built-in LED on the Arduino MKR should be blinking and you should also see a similar message in your debug window as shown below.
Install the MKRWAN Library
This tutorial is concerned with the Arduino MKR 1300 WAN board which has the capability of connecting to a LoRa (long range) network which is also known as The Things Network (TTN). Learning how to communicate with the LoRa module would be difficult and complex which is why the wonderful engineers at Arduino have created a library just for this! Firstly, navigate to Sketch > Include Library > Manage Libraries, search for “MKRWAN”, and then install the library called MKRWAN.
Find Your EUI Number
To be able to connect to TTN you need to know your devices EUI number. Luckily for us, the MKRWAN library provides an example that makes finding this information easy.
To load this example navigate to File > Examples > MKRWAN > FirstConfiguration, open the serial monitor, and then upload the program. The EUI number in the example below has been blanked out as this is a unique identifier of your part and should be kept secret.