Guard your stuff with the LoRaWAN RDK

Do you want to get notified when someone moves things that are precious to you?

This experiment shows how a LoRa device along with sensors can be used to detect unexpected movement of an object and send out notifications to its owner. Furthermore, this experiment shows how you can track the object using its geolocation and visualise the location in AllThingsTalk Maker.

Assemble the hardware

First step is to make sure that you have the following hardware components nearby:

  • Sodaq Mbili
  • LoRa™Bee radio module with antenna
  • USB cable
  • 3-axis digital accelerometer
  • GPS module

 Afterwards assemble the hardware as detailed or depicted on the image below :

  • Attach LoRa™ module & antenna
  • Connect 3-axis digital accelerometer to SCL/SDA (I2C socket)
  • Connect GPS module to D20/D21
  • Connect Sodaq Mbili to your computer through USB
  • Turn power switch ON

schematic_lora_guardyourstuff

Make sure you have good GPS coverage. Indoors can be a problem in certain cases.

Loading and setting up the sketch

Programs written using Arduino Software (IDE) are called sketches. These sketches are written in the text editor and are saved with the file extension .ino. In the following section we will program the hardware and send the collected sensor data to AllThingsTalk Maker:

  • Open Arduino IDE
  • Select guard-your-stuff as example by clicking File > Examples > AllThingsTalk LoRaWAN SDK > Rapid Development Kit > guard-your-stuff.
  • Open the keys.h tab. In this tab we have to provide some keys to ensure that the device is authenticated on the LoRaWAN network of choice but also on the AllThingsTalk Maker platform.
  • Enter your LoRaWAN keys. We tried to make it really simple.
    In the Maker application, and specific the LoRaWAN Rapid Development Kit you have previously created, go to Settings > Connectivity  (located in the upper right corner), scroll down and you will notice a section Keys file. Copy the code block and paste it in the Arduino IDE keys.h tab. 

Programming the hardware

We will now upload the sketch and keys to your LoRaWAN Rapid Development Kit, and when restarting the hardware data will be collected, and forwarded using the LoRaWAN network towards the AllThingsTalk platform.

  • Check again if your device is connected to your computer using the USB cable, and the Mbili board is switched on (SW2 in ON position)
  • Make sure the MBili is detected by the Arduino IDE application by verifying it is listed and selected in Tools > Port
  • Now simply click the upload button (highlighted in the image below). This will verify the sketch and libraries, compile and upload to the LoRaWAN Rapid Development Kit.

Arduino Upload button

  • When the uploading was done and successful, the collected data will be displayed in AllThingsTalk Maker

After uploading, you might need to flip the power switch on the Sodaq Mbili OFF and back ON to make sure the Mbili reboots and starts up our sketch.


 

Alternatively, you can also open the Tools > Serial monitor of the Arduino IDE. This can be very useful when debugging your own sketches.

  • Make sure you select the correct COM port to listen (under Tools > Port )
  • When the monitor is open, make sure the Baud rate is set to 57600

 

Visualise and use the incoming data

 

If all went well you should see data coming in...

Learn more how to visualise the data with Pinboards and make use of the data to automate your process or notify stakeholders using Rules.