Guard and track your assets with the LTE-M RDK.

Guard your valuable assets, get immediate notification when they move without your consent and keep track in real time about their exact location.

Guard your valuable assets, get immediate notification when they move without your consent and keep track in real time about their exact location.

Networks based on the LTE-M protocol enable real time bi-directional communication which provides next to exact location of your assets the ability to instruct changes in the behaviour of the IoT device.

This experiment showcases how to “digitally” lock/unlock your valuable things.

When you lock or unlock the object, an object state will be updated and a notification including the location will be sent over using a rule.

When the monitored object is in lock status and starts moving an alarm asset is send over and a rule will send a notification, at the same time the GPS location will be sent every 60 seconds from the device to Maker until the object is unlocked.

Make sure you have good GPS coverage. Indoors can be a problem in certain cases. If no, GPS fix could be established "zero coordinates" will be published.

Assemble the hardware

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

  • Sodaq SARA AFF
  • SIM Card

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

  • Insert the SIM card into the SIM card slot on the SARA AFF board
  • Use the provided USB cable to connect Sodaq SARA AFF (USB port next to the SIM slot) to your computer
    Hardware schema

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 GuardAndTrackAssets as example by clicking File > Examples > AllThingsTalk LTE-M SDK > Rapid Development Kit > GuardAndTrackAssets.
  • Open the keys.h tab. In this tab we have to provide some keys to ensure that the device is authenticated and has the correct settings (APN) for the cellular network of choice but also on the AllThingsTalk Maker platform.
  • Enter your keys; we tried to make it really simple:
    In the Maker application, and specific for the LTE-M Rapid Development Kit you have previously created, go to Settings > Authentication  (located in the upper right corner), and copy the DeviceID and Device Token and paste them accordingly in the Arduino IDE keys.h tab. 
  • Change the APN to "m2mc.simservices". 
  • When done, the keys.h tab should like this:
#ifndef KEYS_h

#define KEYS_h

// Enter your Allthingstalk device authentication

char* DEVICE_ID = "fgEjb8kvKZ5goFSHOnSBgiTi";

char* DEVICE_TOKEN = "maker:4NyvLLGa4Vf4m0lqFzNFnRZEjAxTH6MPfodzdUJ2";

// Enter APN of your LTE-M service provider

// See docs:

char* APN = "m2mc.simservices";

// Allthingstalk Space Endpoint (leave as is if unfamiliar)

char* SPACE_ENDPOINT = "api.allthingstalk.io";

#endif

Programming the hardware

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

  • Check again if your device is connected to your computer using the USB cable.
  • Make sure the SARA 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 LTE-M Rapid Development Kit.

Arduino Upload button

After uploading, you might need to reset the board by pressing the RESET button on the Sodaq SARA.

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

     

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 115200

Sketch details

This sketch can be used as a lock mechanism for your bicycle, motor, car, .... So below we provide you with some insights how the device is intended to behave. 

  • When you enable the actuator 'Lock' , the device comes in lock state and when there is movement an alarm is triggered and gps coordinates are sent if possible.
  • As long as the device is in lock state and an alarm was triggered it will try to send the location to AllThingsTalk Maker every minute.
  • We have used the multi coloured LED on the SARA board to indicate the status of the device.LED sequence/timeline

Enable extended debug. Get more insights on how the behaviour of the LTE-M RDK, the modem and/or network by enabling the Debug functions (verbose or verbose + AT) in the sketch. This can be done by changing adapting "att.debugPort" statement.

For Verbose debug:

att.debugPort(debugSerial,true);

 For verbose + AT commands:

att.debugPort(debugSerial,true,true);

Visualise and use the incoming data

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

 

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