TTN LoRaWAN Tracker Advice

212 views
Skip to first unread message

John Laidler

unread,
Aug 12, 2020, 1:15:45 PM8/12/20
to UKHAS
I've built a LoRaWAN tracker to the design found here: https://www.thethingsnetwork.org/labs/story/lorawan-gsp-tracker
but it won't work!  I've even gone back to the original code without the improvements for altitude suggested by Marcel (PC4L) so it is as close to original as possible.

On running the serial monitor in the IDE this is the error message which appears.

Starting

FAILURE

C:\Users\rjohn\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53 

The LMIC library I'm using is the latest 3.2.0 version. 

From a bit of Googling it might be something to do with pin mapping but what is wrong is beyond me.  I've double checked and it is all wired correctly.

Any suggestions would be very welcome. When I say it doesn't work it isn't transmitting anything or nothing I can see with an SDR.  I did find another project on GitHub but it used very different pin mapping so to avoid re-wiring everything I would like to try and get this one to work.
John

John Laidler

unread,
Aug 12, 2020, 2:12:03 PM8/12/20
to uk...@googlegroups.com
Further to the above I've loaded an example sketch (ttn-otaa) found on the LMIC repository on GitHub.  Running it gets the same error message so I guess it isn't the tracker code.  Hmmm...

--
You received this message because you are subscribed to the Google Groups "UKHAS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukhas+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukhas/21a03926-1e5e-42a8-964d-2ba15cb3f9f1n%40googlegroups.com.

Nick McCloud

unread,
Aug 12, 2020, 4:46:54 PM8/12/20
to UKHAS
It is somewhat of a challenge to fit a recent LoRaWAN library in to a Pro Mini. For values of not even fitting and if you can, by some miracle, it will heap hit stack about 5 seconds in.

This is my implementation that comes with a money back guarantee:


Please feel totally free to ask questions here or on the TTN forum, tag me there as @descartes. It is rather important that you follow the requirements I document - you HAVE to implement using the right IDE & library versions to ensure it all fits with some room for your bits. I can advise on linking in a GPS on account of me having passed the first acolyte milestone grudgingly admitted at the UKHAS conference in 2019 by making my own tracker from scratch. Apart from that, I'm still at "works many times, still finds ways of screwing up" stage.

John Laidler

unread,
Aug 12, 2020, 4:57:16 PM8/12/20
to uk...@googlegroups.com
Nick,

Very many thanks, from what I've read the 328 processor is at the limit in this application. I'll have a go at it again tomorrow using your code. I've unplugged everything tonight as we are expecting thunderstorms tonight. The last lightening strike a couple of years ago cost us a central heating boiler!

John

John Laidler

unread,
Aug 13, 2020, 7:41:07 AM8/13/20
to uk...@googlegroups.com
Nick,

Many thanks again.  I've installed the IDE and LMIC library versions you recommend, having removed the existing versions first of course.  I tried first compiling and uploading the sketch I already had. It certainly uses less memory but on trying to run it I get the same error message in the Serial console:

FAILURE
C:\Users\rjohn\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library-2.2.2\src\lmic\oslmic.c:53

So then I tried the same with your TinyThings and yet again when I run it exactly the same error message appears.  I've tried Googling for an answer and could find only one reference https://github.com/zakibakar75/arduino-lmic-as923/issues/2  which doesn't fully explain how it was solved but it sounds like it is something to do with library versions.

Would it be worth starting a new topic on the TTN Forum?

Stumped  :)

John 

Nick McCloud

unread,
Aug 13, 2020, 8:27:39 AM8/13/20
to UKHAS
It's a pins problem - you need to to put the pins you have connected to DI0 and DI1 in to the section on line 65 of settings.h

John Laidler

unread,
Aug 13, 2020, 8:31:13 AM8/13/20
to uk...@googlegroups.com
Thank you again, I'll have a look again this afternoon.  :)

Nick McCloud

unread,
Aug 13, 2020, 8:34:43 AM8/13/20
to UKHAS
settings.h is in my code base, but as you are seeing a smaller compile with yours, you may want to concentrate on that - the pins setting is towards the top of most of the examples I've seen, near the section on setting EUI's & Keys

John Laidler

unread,
Aug 13, 2020, 10:21:35 AM8/13/20
to uk...@googlegroups.com
Dog now walked I'm having a look at it now.  :)

John Laidler

unread,
Aug 13, 2020, 10:47:54 AM8/13/20
to uk...@googlegroups.com
Still not playing.  I've checked the pin definitions on the Bike Tracker sketch and they are correct.  I've also modified the ones in your setting.h file and run it with a similar result.  This is what the serial console reports:

TinyThingInABottle v0.1.4 2019-10-23

########################################

Free RAM = 625
Setup started
T setup:263 flags = 255
T setup:264 Batt_Low = -1
T setup:265 TMP_Low = -1
T setup:266 TMP_High = -1
T setup:267 TMP_Mode = 255
T setup:268 TMP_Hys = 255

FAILURE
C:\Users\rjohn\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library-2.2.2\src\lmic\oslmic.c:53

I'm a complete newbie to this programming so I'll need to read up a bit on de-bugging but I think I'll start a new topic on the TTN Forum first and see if it turns anything up.  I'm guessing the answer may be simple but the problem is finding it!

John



On Thu, 13 Aug 2020 at 13:34, Nick McCloud <ni...@descartes.co.uk> wrote:

Nick McCloud

unread,
Aug 13, 2020, 11:04:16 AM8/13/20
to UKHAS

On Thursday, 13 August 2020 at 15:47:54 UTC+1 John Laidler wrote:
Still not playing.  I've checked the pin definitions on the Bike Tracker sketch and they are correct.  I've also modified the ones in your setting.h file and run it with a similar result.  This is what the serial console reports:

I'm a complete newbie to this programming so I'll need to read up a bit on de-bugging but I think I'll start a new topic on the TTN Forum first and see if it turns anything up.  

Mostly it's me answering Arduino LMIC questions but it's always good to have others chiming in. 

Fundamentally we need to look to debug the pins - either at a physical wiring level - are they solidly connected, are they connected to the places you think they are as well as the software having the correct definitions.

When you post here or on TTN, can you post a picture - I realise it may be a bit rats-nest but hopefully we'll be able to see how things are wired up.

I can also create a quick "SPI check" to test the connections to the radio.




 

Nick McCloud

unread,
Aug 13, 2020, 11:07:29 AM8/13/20
to UKHAS
Oh, and can you tell me what the compiled size aka Sketch uses xxxxxx, and how much is left for the global variables - just in case it's failing on the memory allocation. This is on the last line of the compiler output before it starts trying to download - you can just click the tick button top left for a test compile.

Nick McCloud

unread,
Aug 13, 2020, 5:40:19 PM8/13/20
to UKHAS
For those just tuning in, progress was made on the TTN forum - a wiring diagram issue - next step is to confirm uplinks are working as required.

John Laidler

unread,
Aug 14, 2020, 3:04:20 AM8/14/20
to uk...@googlegroups.com
Nick, I'll check in an hour or so and let you know the size and remaining memory. The indoor gateway has been dispatched and should arrive today. 

--
You received this message because you are subscribed to the Google Groups "UKHAS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukhas+un...@googlegroups.com.

John Laidler

unread,
Aug 14, 2020, 5:41:40 AM8/14/20
to uk...@googlegroups.com
Nick,

This is the message after compiling:

Sketch uses 26564 bytes (86%) of program storage space. Maximum is 30720 bytes.
Global variables use 1647 bytes (80%) of dynamic memory, leaving 401 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

John

Nick McCloud

unread,
Aug 14, 2020, 6:03:05 AM8/14/20
to UKHAS
400 bytes isn't great and it may be that the source can be refactored for more local variables to give it reasonable space.

Which source did you compile? The TTN example?

John Laidler

unread,
Aug 14, 2020, 6:20:55 AM8/14/20
to uk...@googlegroups.com
I just used the code on this site, copying and pasting into a new sketch in the IDE.


I haven't tried your code yet as I was slightly confused about what version to use as there seemed to be more than one and also it uses temperature sensors which I haven't got. I'm not sure what would happen if I tried it without them.

I've got a spare mini pro board so I've ordered another LoRa module this morning and will build a second one - I need another anyway so it isn't wasted money or effort.

 

Nick McCloud

unread,
Aug 14, 2020, 8:00:40 AM8/14/20
to UKHAS
Use this, it makes hooking things up so so much easier:

Nick McCloud

unread,
Aug 14, 2020, 8:02:35 AM8/14/20
to UKHAS
I'll try the TTN labs setup so we are in parallel, but I'll be using the small mounting board to save my fingers from the soldering iron.

John Laidler

unread,
Aug 14, 2020, 8:07:36 AM8/14/20
to uk...@googlegroups.com
Is that the right one? The mini pro has 12 holes down each side that adapter only has 8.  Or am I misunderstanding how it is supposed to be used?  (Probably am!)

John Laidler

unread,
Aug 14, 2020, 8:20:41 AM8/14/20
to uk...@googlegroups.com
Thank you. The LoRa module has been dispatched so should arrive tomorrow. If it does I'll make up another over the weekend.

I've had the current one running for a couple of hours, using power from the USB cable and it hasn't fallen over yet.  The only snag is I am not sure it is transmitting anything although it was reassuring to see the correct coordinates appearing when the GPS had a fix. The third line down is spot on, we are roughly 50N 4W although where the altitude is I'm not sure.  It should be around 80.  I wonder what the unknown event might be?  

12:30:37.696 -> Packet queued
12:30:41.095 -> 183384351: EV_TXCOMPLETE (includes waiting for RX windows)
12:31:01.164 -> $GPRMC,113038.00,A,5022.46658,N,00401.56260,W,0.961,,140820,,,A*65
12:31:01.164 -> $GPVTG,,T,,,N,3.763,K,A*21
12:31:01.164 -> $GPGGA,113101.00,5022.47044,N,00401.60177,W,1,03,3.80,70.9,M,50.3,M,,*79
12:31:01.268 -> $GPGSA,A,2,11,01,28,,,,,,,,,,3.93,3.80,1.00*0B
12:31:01.302 -> $GPGSV,4,1,13,01,48,267,26,03,11,207,,08,72,149,,10,33,052,*75
12:31:01.370 -> $GPGSV,4,2,13,11,76,287,21,16,01,174,,20,01,045,,21,38,078,*73
12:31:01.438 -> $GPGSV,4,3,13,22,33,204,17,23,07,042,,27,37,132,,28,22,318,24*7B
12:31:01.507 -> $GPGSV,4,4,13,32,24,101,*4C
12:31:01.541 -> $GPGLL,5022.47044,N,00401.60177,W,113101.00,A,A*7C
12:31:02.059 -> $GPRMC,113102.00,A,5022.47020,N,00401.60120,W,1.781,,140820,,,A*66
12:31:02.162 -> $GPVTG,,T,,M,1.781184697713: Unknown event
12:31:02.196 -> Packet queued
12:31:06.408 -> 184960322: EV_TXCOMPLETE (includes waiting for RX windows)


Nick McCloud

unread,
Aug 14, 2020, 8:22:57 AM8/14/20
to UKHAS
It's for the RF96 (or RFM95W as that's what I have in stock) LoRa board.

I personally would put the pins on the Pro Mini, pins on this little PCB and use Dupont cables to connect the two, so much easier in the first instance to setup / test / debug.

I can send you a TinyThing PCB to miniaturise it down once you have a design that suits:

TinyThingRadio.jpg

It's 25mm x 32mm, the liquorice all sort is a helical aerial but the PCB can take a uFl connector.

TinyThing with GPS.jpg




Nick McCloud

unread,
Aug 14, 2020, 8:28:40 AM8/14/20
to UKHAS
The unknown event is from the LMIC stack - the TTN code is from Dec 2017 & the LMIC stack we are using is from Oct 2018 so there will be things the newer stack are trying to tell us that the user code can't interpret - we can get that debugged shortly.

John Laidler

unread,
Aug 14, 2020, 8:32:31 AM8/14/20
to uk...@googlegroups.com
Now I understand! I'll order some this afternoon.

John Laidler

unread,
Aug 14, 2020, 2:00:25 PM8/14/20
to uk...@googlegroups.com
Further update, I've setup the indoor gateway which took a trip to the local Parcel Force depot to collect as their van never got here. As I suspected it isn't detecting anything from the tracker so it looks like a code issue. 

John Laidler

unread,
Aug 14, 2020, 2:04:22 PM8/14/20
to uk...@googlegroups.com
It's a tiny little thing. 
IMG_20200814_190055.jpg

John Laidler

unread,
Aug 15, 2020, 12:18:44 PM8/15/20
to uk...@googlegroups.com
Latest update is that I've discovered the tracker is working - but it is transmitting on US frequencies!
Reply all
Reply to author
Forward
0 new messages