Universal Tracker¶
The Universal Tracker is available for the SODAQ ONE, SARA AFF and SARA SFF.
With this software you will turn your board into a low power tracker.
Requirements¶
- SODAQ SARA AFF
- Antenna
- SIM
- Battery (Required R412M)
The Universal Tracker will work with any compatible simcard / network operator.
Getting started¶
If you don't have the boardfiles yet, follow the steps on the Getting started page.
Connect the antenna to the board.
Connect the device with the USB cable to your computer.
T-Mobile NL
If you use T-Mobile NB-IoT do not put your simcard in your device.
We don't want it to register itself.
Any other network
All other networks don't require a IMEI registration.
It's safe to put your simcard in your device.
Github¶
Download the latest version of the Universal Tracker from our GitHub.
- Unzip.
- Open
Sodaq_Universal_Tracker.ino
with the Arduino IDE. - Check if under tools the board and port are correct.
- Upload the code to your board.
Bootmenu settings¶
The default code is uploaded to your board. It's time now to set the correct settings.
When the device is powered or has been reset, there is a 5 second bootup delay. After the 5 second delay the bootmenu is shown.
Note
The command ntype
is blocking.
When the ntype=0
the software won't boot, but instead it will reshow the bootmenu.
It's recommended to update all other settings first.
Open the Serial Monitor.
In the bottom check if NL and CR
is enabled.
To update for example the fix interval to 1 minute, send fi=1
. So without any spaces.
AllThingsTalk endpoint IP and port:
IP: 40.68.172.187 ip=40.68.172.187
Port: 8891 prt=8891
LED colors¶
On the board there are two LEDs, one will indicate when the battery is charged. Off when Full/not charging.
The other LED will change color depending on the state of the device.
- RGB LED
- Yellow LED (Charge indicator)
The RGB LED will always turn on on bootup.
The LED will be RED during bootup, after bootup when there is a successful GPS fix, it will be green for a short period.
When in the menu the LED is turned off, led=0, the RGB LED will never lit again.
If the LED is enabled, led=1, you will see the following colors:
- Yellow, motion trigger. Only when movement detection is enabled.
- Blue, periodic message.
Dashboard¶
We now have a sending device.
You can either send the data to your own server or make use of one of the following examples.
AllThingsTalk¶
- Create or login to AllThingsTalk Maker.
- Claim your device.
Note
If you don't have an Activation Code, contact SODAQ.
Provide us your IMEI and tell you need it for the "Tracker Application".
We will then Generate an Activation Code for you.
If you already have an Activation Code, but it wasn't created for the Tracker, then you can modify it to be used with the tracker application.
Assets¶
Check if you have the same Asset names.
Voltage
Create a New Asset.
Give it the name v
.
Choose Integer
as type.
Create the asset.
Click on the asset name to edit the title.
Do the same for the following assets:
- ttf
- timestamp
- t
- speed
- sat
GPS
Add a new asset, type: Object
, Name g
.
In the advanced tab, paste the following json code:
{
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
}
}
Hit Save, you can edit the Title later.
ABCL¶
In the ABCL we tell AllThingsTalk how to decode the data we have send to actual asset values.
Go to -> Settings -> Payload Formats -> Check the checkbox -> Use the decoder below.
{
"sense": [
{
"asset": "timestamp",
"value": {
"byte": 0,
"bytelength": 4,
"signed": false,
"byteorder": "little",
"type": "integer"
}
},
{
"asset": "v",
"value": {
"byte": 4,
"bytelength": 1,
"signed": false,
"calculation": "val * 10 + 3000",
"type": "integer"
}
},
{
"asset": "t",
"value": {
"byte": 5,
"bytelength": 1,
"signed": true,
"type": "integer"
}
},
{
"asset": "g",
"value": {
"latitude": {
"byte": 6,
"bytelength": 4,
"signed": true,
"byteorder": "little",
"calculation": "val / 10000000",
"type": "integer"
},
"longitude": {
"byte": 10,
"bytelength": 4,
"signed": true,
"byteorder": "little",
"calculation": "val / 10000000",
"type": "integer"
},
"altitude": {
"byte": 14,
"bytelength": 2,
"signed": true,
"byteorder": "little",
"type": "integer"
}
}
},
{
"asset": "speed",
"value": {
"byte": 16,
"bytelength": 2,
"signed": false,
"byteorder": "little",
"type": "integer"
}
},
{
"asset": "sat",
"value": {
"byte": 19,
"bytelength": 1,
"signed": false,
"type": "integer"
}
},
{
"asset": "ttf",
"value": {
"byte": 20,
"bytelength": 1,
"signed": false,
"type": "integer"
}
}
]
}
ThingsBoard¶
Follow this tutorial to setup your SODAQ Board with Universal Tracker code on ThingsBoard.
https://thingsboard.io/docs/user-guide/integrations/sodaq/
Downlink¶
Example 1¶
We will send the following values in the downlink:
– Fix interval 23 minutes
– No Alternative fix interval
– GPS timeout of 120 seconds
Al values need to converted to hex, adjusted to correct length and converted to little endian.
Fix interval of 23 minutes
23 to hex = 17
Length correction: 00 17
Change to little endian: 17 00
No alternative fix interval:
00 00
00 00 00 00
00 00 00 00
GPS:
120 to hex = 78
Reserved Byte: 00
Combine the values:
1700 0000 00000000 00000000 78 00
1700000000000000000000007800
If the queue the hex in your LoRaWAN network, the next time a message from the device is send it will sent the first queued message.
Example 2¶
We will send the following values in the downlink:
– Fix interval 30 minutes
– Fix Interval of 1 hour between 9.00 and 15:30
– GPS timeout of 120 seconds
Al values need to converted to hex, adjusted to correct length and converted to little endian.
Fix interval of 30 minutes
30 to hex = 1E
Length correction: 00 1E
Change to little endian: 1E 00
Alternative fix interval of 1 hour (60 minutes):
60 to hex = 3C
Length correction: 00 3C
Change to little endian: 3C 00
The EPOCH timer is in seconds.
From 9:00 can be encoded like:
(9*3600)+(0*60) = 32400 + 0 = 32400
32400 to hex = 7E 90
Length correction: 00 00 7E 90
Change to little endian: 90 7E 00 00
To 15:30 can be encoded like:
(15*3600)+(30*60) = 54000 + 1800 = 55800
55800 to hex = D9 F8
Length correction: 00 00 D9 F8
Change to little endian: F8 D9 00 00
GPS:
120 to hex = 78
Reserved Byte: 00
Combine the values:
1E00 3C00 907E0000 F8D90000 78 00
1E003C00907E0000F8D900007800
If the queue the hex in your LoRaWAN network, the next time a message from the device is send it will sent the first queued message.