Open Source LoRa Tracker Code

Hi everyone,

We are proudly annoucing that we have made the tracker code for the SODAQ ONE Open Source.

It has become quite a comprehensive application but still compiles nicely in the Arduino IDE (1.6.7).

After loading it to the device, you can configure it over the USB port. So no hardcoding of keys etc.
It supports both OTAA and ABP and works like a charm with the new TTN back-end.

In sleep the SODAQ ONE uses around 30 uA and when waking up it typically does a GPS fix in less than 8 seconds.

From the menu you can configure how often it does this for you.

The sketch uses 36,340 bytes of program storage space but on the SAMD21 this is only 13% :smile:
So plenty of space for you to extend it.

If have 2 beta boards left for testing, so if you live close to Hilversum and want to extensively test it and write a test report about it please contact me at janwillem-at-sodaq.com

12 Likes

Looks great!
Can you please specify in the github which Open Source license you’re publishing this under.

I’ve been developing custom wildlife monitoring solutions (GPS trackers & weighbridges) for several research organisations in Australia, and I’d be quite interested in trying this out. I’d need to pre-order some of your RN2903 boards, and I’m still waiting on my TTN gateways, but I could probably organise a MultiTech one for testing.

Hi Kean,

It is Open Source under the BSD 3 Clause:

Copyright © 2016, SODAQ
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1 Like

there should be no timeout during configuration.
It’s hard to get all data and parameters until it continues automatically.
waiting until a single “q/Q” would be appreciated.

Thanks for the licensing info.
Can I suggest adding this to a LICENSE file in the github root, or alternatively at the bottom of README.md

Thanks, good news. I don’t have the board yet but I tried compiling the sketch and I got an error:

sketch\FlashStorage.cpp: In constructor 'FlashClass::FlashClass(const void*, uint32_t)':

FlashStorage.cpp:24: error: 'NVMCTRL' was not declared in this scope

   PAGE_SIZE(pageSizes[NVMCTRL->PARAM.bit.PSZ]),

                       ^

I included the additional board files URL. IDE version is 1.6.9. What am I doing wrong?

EDIT: It seems the additional board files URL is incorrect as that document cannot be found.

hi @Jasper
I used http://downloads.sodaq.net/package_sodaq_index.json
and get the sodaq BETA board. using that it compiles (1.6.8) and loads.

Hi @ursm,

Thanks! With that URL it compiles now.

Suspicious results using Tracker @JanWillem

LoRaONE_BETA, SODAQ Tracker Vers. 1.6 (10.07.2016), compiled with Arduino IDE 1.6.8

I’ve taken the DevAddr, AppSKey & NWSKey out of the Dashboard, where I’ve created a new application and a ABP node
Receiving the transmitted data I get non readable info from Dashboard, mqtt client on RasPi and TheThingsNetwork - Microclient from Gonzalo.
So I thought, that something would be wrong with the keys and I put them into a MoteinoMEGA.
Getting data from there they were absolutely readable.

at last I started an other try fetching also the debug aoutput at the serial monitor:
Timestamp, BatteryVoltage, BoardTemperature, Lat, Long, Altitude, Speed, Course, SatelliteCount, TimeToFix
1468262185, 255, 12, 474295094, 85417334, 453, 16, 192, 4, 25 (unix timestamp = 11.07.2016 20:36:25)

Dashboard output:
29E78357FF0C362B451C765D1705C5011000C00419 20:36:24 3 -43 868.10000
What’s wrong ?
Thank’s for your time reading through my results and hopefully finding a solution

output using tracker:
Mon Jul 11 2016 18:35:13 GMT+0200 (CEST) from 70B064C/devices/0000000C5/up
{ payload: ‘wsqDV/8nCidFHLMzFwW+AQQAMgQO’,
payload_decrypted: ‘BJ\u0003’\n’E\u001c33\u0017\u0005>\u0001\u0004\u00002\u0004\u000e’ }

Hi Urs,

Did you note that the frame format is binary: https://github.com/SodaqMoja/SodaqOne-UniversalTracker ?

Hi ursm,

The debug output:

Timestamp, BatteryVoltage, BoardTemperature, Lat, Long, Altitude, Speed, Course, SatelliteCount, TimeToFix
1468262185, 255, 12, 474295094, 85417334, 453, 16, 192, 4, 25 (unix timestamp = 11.07.2016 20:36:25)

Is encoded in binary and sent as 21 bytes.

Like the tools you used show:

29E78357FF0C362B451C765D1705C5011000C00419

Take for instance the first 4 bytes:

29E78357

If you decode this from hex to decimal, you will get: 1468262185
The next byte FF = 255
The next byte 0C = 12

Nothing is wrong, it all works as designed :smile:

(note that in Arduino typically the byte order is little endian)

Which conveniently happens to be the default for multi-octet fields in LoRaWAN also :blush:
So when you decode “manually” like the first 4 bytes mentioned by JanWillem:
29E78357 you should reverse them like 5783E729 which will give you indeed 1468262185
(if you don’t like manual conversion you can cheat using Windows Calculator)

Offcourse I don’t need to explain this to @ursm and @JanWillem, but it can be handy for other readers of this subject.

And it looks like @joscha delivered a very nice solution for this just in time :blush:

1 Like

aww, thank you @Batilan!

I notice that the course information is still contained in one byte:

Course (COG) uint8 (1)

I asked about this regarding the previous release since I had no clue how the course was coded into one byte and I got the reply that is was probably a bug using only one byte for course information. So I guess if it was a bug, it has not been fixed, And if it was not a bug, does anyone know how 360 degrees course information is coded into this single byte?

Hi

What I have to change in the code to be able to use it with the RN2903 version?

Thanks.

Hi @Synapsecontrols,

The code should work without any modifications.

We have multiple versions of the Tracker Code.
See: https://support.sodaq.com/sodaq-one/tracker-software/

Let me know if you experience any issues.

Best regards,
Jan