LoRaWAN The Things Network


Has anybody looked at connecting to The Things Network, TTN, via LoRaWAN. There is a RFM9x library available for 915MHz LoRa modules, but connection to the LoRaWAN TTN gateways is needed.

We are looking to use the IMP004m modules for high-altitude ballooning, where they will be out of range of WiFi, but can transmit limited data via LoRa during flight.


RFM9x don’t do LoRAWAN, they do LoRA. LoRAWAN is another protocol stack on top of LoRA, which is not implemented in the HopeRF chips; the actual LoRAWAN gateways are specialized radios with multiple receivers running concurrently.

For LoRAWAN nodes there are other options, like the Microchip modules, see https://developer.electricimp.com/libraries/hardware/rn2xxx

Note that the library there uses the RN2xxx in LoRA (not LoRAWAN) mode, but you could pretty easily make the driver work in LoRAWAN mode.


Thanks for the feedback Hugo. Please bear with me as I try to sort through the technology. I tested the SparkFun LoRa Gateway - 1-Channel (ESP32) https://www.sparkfun.com/products/15006, and was able to connect to The Things Network. It uses the RFM95W module. I picked up an RFM95W module from Adafruit https://www.adafruit.com/product/3072, and figured I could do the same thing with the IMP004m, perhaps using the RFM9x library https://github.com/electricimp/RFM9x/tree/develp. I think your point is that there is an additional protocol stack on top of the basic LoRa communication.

Moving to LoRa gives us a huge power savings, and if we can use LoRaWAN, we can leverage off of other gateways and The Things Network for more robust tracking. Here’s a story about balloon tracking with LoRaWAN: https://www.thethingsnetwork.org/labs/story/tracking-a-stratospheric-balloon-with-iot.

Do you still advise looking at the Microchip modules or can we work with the RFM95W? Perhaps there are other options.


Ah, yes, there the LoRAWAN stack will be running on the ESP32 (dumb radio, stack on “host”); the Microchip modules I linked have the stack on the radio chip.

Technically, if there was a stack on squirrel you could do the same with an imp, but there isn’t one; it may be possible to port one (the C code used in the Sparkfun demos is https://github.com/mcci-catena/arduino-lmic/tree/master/src/lmic ), but assuming you’re not making thousands of balloons, it may just be much easier to use the Microchip module - or any other module with the stack integrated.

eg see the ones here: https://www.loriot.io/modems.html


As always Hugo, your comments are very helpful. I think I’ll leave porting the lmic code to Squirrel to someone else.

The loriot.io list is a great overview of the LoRa modem technology. The Microchip module looks like a nice way to go.


I’m back, with RN2903 hardware running. Unfortunately, I can’t get the RN2xxx https://developer.electricimp.com/libraries/hardware/rn2xxx library working.

From the scope image, you can see the reset on the bottom trace start up the Rx and Tx lines, and the RN2903 sends out a burst of characters on the center trace.

The _uartReceive callback doesn’t respond, so no characters are ever received, and the handler times out. Any ideas?


I might have solved the problem. There was a conflict with another uart.configure elsewhere in the code. Communication with the RN2903 may be working now. I’ll let you know.


Ah yes, the latest pin configuration takes precedence (eg if you configure a uart, then reconfigure the RX pin as a GPIO, it will no longer receive anything)


In my case, I’m trying to detect the presence of different serial devices on my IMP004m (uartBCAW), either a GPS (9600 baud) or the RN2903 (57600 baud). The GPS requires no setup, it just blasts out data every second.

As you guessed, I was configuring the port for the GPS while trying to initialize the RN2903, which changed the baud rate to the wrong value. Once I disabled the GPS configure, the RN2903 lit up.

My overall solution to having the Imp detect either device is to put the GPS configuration in the loraInitHandler. If it comes back with an error, that means the RN2903 is not connected and I configure for the GPS.

Perhaps this discussion will be helpful to someone.