Get notified when and where your high value assets move unexpectedly or are exposed to sudden and brusk shocks that could be the cause of damage.
In case such unexpected events occur, next to notification, you would also be able to collect additional data which can help identify what caused such event and understand the circumstances. Additional data collection could proactively detect factors which could cause damage and thus enable you to intervene before such events actually occur.
Such data collection could enable other stakeholders such as insurance companies to better identify cause and circumstances of damage and thus offer individualised insurance policies.
In this experiment the device will trigger when a high value asset (e.g. a PV Panel) is exceeding a certain vibration shock (default 8G). The device sends over a trigger state and the location of the event.
We have also created some example Rules that in this experiment trigger a Notification is sent with the timestamp & location of the event.
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
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 GuardAssets as example by clicking File > Examples > AllThingsTalk LTE-M SDK > Rapid Development Kit > GuardAssets.
- 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:
// 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";
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.
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
The sketch we have created is intended to be as close as possible to a real life low power application. So below we provide you with some insights how the device is intended to behave.
- Puts the device in deep sleep to conserve energy, when no movement is detected.
- Generates an interrupt when a shock has been detected and sends over a trigger state, timestamp and GPS location of the event.
- You can set the G-force and sensitivity for the shock detection in the sketch itself according to your needs:
- acc: value in %, 100 = 8G
- threshold: value between xx and yy ; The lower the value, the faster an interrupt will be generated
- We have used the multi coloured LED on the SARA board to indicate the status of the device.
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:
For verbose + AT commands:
Visualise and use the incoming data
If all went well you should see data coming in...