Get notified when someone is tampering with one of your favourite paintings. This example shows how an NB-IoT device can be used to detect unexpected movement of an object and send out notifications to its owner.
Furthermore, it shows how you can track the object using its Geo-location when in open air.
Make sure you have good GPS coverage. Indoors can be a problem in certain cases.
In your Arduino IDE, open the example guard-your-stuff
under File > Examples > arduino-nbiot-rdk-master.
If you did the first application on the previous page, your device is ready for use, and you can continue and run the example.
If not, please complete the following step.
keys.h
file located in the arduino-nbiot-sdk-master
Library folder, by default you can find it in:DeviceID
and DeviceToken
values with the values that can be found under Device Settings > Authentication section of your device in the Maker Application. In the keys.h
file you will notice that the APN is already pre configured and should not be changed.1 | /**** |
Simply hit the upload icon in the Arduino IDE. This will save the sketch, compile it and upload it to your Arduino.
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.
You can now watch the values change in Maker.
Alternatively, you can open the Tools > Serial monitor of the Arduino IDE.
- 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
To visualise our date, we will create a pinboard. For more information on pinboards, please check how to use pinboards.
Now we will pin a control (visual representation) for our GPS asset.
For extra options to customise your controls, please check the Controls page.
We want to get notified :
1 | When motion = true |
For a simple rule like this, we can use the rules wizard.
Time to create our rule!
That’s it! When your device moves, the asset Motion will be set to True, and you now will get notified!