Sunday 26 May 2019

Dragino LoRa Shield for Arduino


The Dragino LoRa Shield for Ardunio enables your Arduino to transmit and receive data packets wirelessly many kilometers using the LoRaWAN network for free. There is no need for wifi or 3/4/G network connections.


Arduino Dragino Shield (red) plugged into a MEGA2560 Arduino

LoRaWAN

LoRaWAN is a wireless protocol for wide area networks which uses the unlicenced 863-870 MHz frequency band in Europe. Other parts of world use other unlicenced frequencey bands.

So that many devices can all share the same frequency band the European frequency regulations impose specific duty-cycles on devices for each sub-band. These apply to each device that transmits on a certain frequency and devices have to respect these duty-cycles. Most channels used by LoRaWAN have a duty-cycle as low as 1% or even 0.1% which means in pratice you can only transmit or receive small amounts of data.


LoRaWAN is implemented using the proprietary LoRa modulation system sold by Semtech corporation.
The LoRaWAN protocols are defined by the LoRa Alliance and formalized in the LoRaWAN Specification which can be downloaded on the LoRa Alliance website.


Dragino LoRa Shield

The Dragino LoRa Shield is a LoRaWAN transceiver in a Arduino shield form factor that uses the Semtech SX1276/SX1278 chip and costs around £25.

http://www.dragino.com/products/module/item/102-lora-shield.html


The Things Network

The Things Network is a project dedicated to building a network for the Internet of Things based on LoRaWAN.

LoRaWAN Gateways connect to the The Things Network and forward received data packets from LoRaWAN Devices to The Things Network cloud service which in turn forwards them on to your Internet connected application. It can also send data packets from your application to devices.


There are plenty of gateways available to connect to - if you'd like to find a gateway in your area, check the Gateway Map. If there are no gateways available locally it is simple to setup your own and connect it to the The Things Network. 

First transmission attempt

To set up your Arduino as an The Things Network device and transmit a message you need to
  1. Regsiter with The Things Network, create an application and register your device with the application. In settings set the registered device to use ABP activiation and make a note of the Network Sesion Key, application session key and Device address.
  2. Using Arduino IDE > Library Manager - install the IBM LMIC framework library
  3. Using the Arduino IDE - use the ttn-abp example from the LMIC library. Modify the source code to use the NWKSKEY, APPSKEY and DEVADDR as noted above and flash to your arduino.
  4. Your arduino will tranmist a message "hello world" once a minute. If this message is received by a Things Network Gateway you can see it appear in the data tab as shown below. 

Test packets received



The details of one of the test packets is shown below. You can see it was received by two Gateways which are about about 1km and 1.5km away. This seemed impressive given then the Arduino was indoors.  

Test packet details