Arduino MKR WAN 1300 LoRA: First Steps
MKR WAN 1300 is a powerful board that combines the functionality of the MKR Zero and LoRa / LoRaWANTM connectivity. It is the ideal solution for makers wanting to design IoT projects with minimal previous experience in networking having a low power device.
Arduino MKR WAN 1300 has been designed to offer a practical and cost effective solution for makers seeking to add Lo-Ra connectivity to their projects with minimal previous experience in networking.
The design includes the ability to power the board using two 1.5V AA or AAA batteries or external 5V. Switching from one source to the other is done automatically. A good 32 bit computational power similar to the MKR ZERO board, the usual rich set of I/O interfaces, low power Lo-Ra communication and the ease of use of the Arduino Software (IDE) for code development and programming. All these features make this board the preferred choice for the emerging IoT battery-powered projects in a compact form factor. The USB port can be used to supply power (5V) to the board. The Arduino MKR WAN 1300 is able to run with or without the batteries connected and has limited power consumption.
Setup your environment
Make sure you have an updated version of Arduino IDE installed. You could run these examples on the Arduino Web Editor also, but the screenshots are from the desktop client.
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.
Batteries, Pins and board LEDs
➥ Battery capacity: The connected batteries must have a nominal voltage of 1.5V
➥ Battery connector: If you want to connect a battery pack (2x AA or AAA) to your MKR WAN 1300 use the screw terminal block.
➥ Polarity: as reported on the silk in the bottom of the board, positive pin is the closest to the USB connector
➥ Vin: This pin can be used to power the board with a regulated 5V source. If the power is fed through this pin, the USB power source is disconnected.
This is the only way you can supply 5v (range is 5V to maximum 6V) to the board not using USB. This pin is an INPUT.
➥ 5V: This pin outputs 5V from the the board when powered from the USB connector or from the VIN pin of
It is unregulated and the voltage is taken directly from the inputs.
➥ VCC: This pin outputs 3.3V through the on-board voltage regulator. This voltage is 3.3V if USB or VIN is
used and equal to the series
of the two batteries when they are used.
➥ LED ON: This LED is connected to the 5V input from either USB or VIN. It is not connected to the battery power. This means that it lits up when power
is from USB or VIN, but stays off when the board is running on battery power. This maximizes the usage of the energy stored in the battery.
It is therefore normal to have the board properly running on battery power without the LED ON being lit.
➥ Onboard LED: On MKR WAN 1300 the onboard LED is connected to D6 and not D13 as on the other boards. Blink example or other sketcthes that
uses pin 13 for on board LED may need to be changed to work properly