AS923 LoRa GPS Tracking with MatchX MatchBox Gateway and RAK811 LoRa GPS Tracker Board

Earlier this month, I installed Match MatchBox LoRa outdoor gateway close to the roof, and showed how easy it was easies to setup with MatchX Cloud. Basically, you just register to the cloud, enter the serial number, and the gateway is automatically based on your location. I’m in South East Asia, so the gateway was configured with AS923.

I’ve now had time to play with the gateway using Rak Wireless RAK811 LoRa tracker board, and eventually managed to get the tracker location to show up on a map. It was my first experience with LoRaWAN, and I had to learn a lot, and overcome many issues from outdated software development tools, different data formats, and some interoperability issues between all components involved. I’ll document all that in this review, and hopefully it will help others.

RAK811 LoRa GPS Tracker Unboxing

Before going into LoRa configuration, I’ll show what I got with RAK811 node.

Rakwireless-Package
Click to Enlarge

It comes with an “IoT Made Easy” package with links to documentation and software.

RAK811 LoRa GPS Tracker Kit
RAK811 LoRa GPS Tracker Kit – Click to Enlarge

We’ll get the board, a GPS antenna with a long cable, a LoRa antenna, a micro USB cable, a cable for the battery, and a plastic bag with some jumpers and Dupont cables.

RAK811 LoRa Module
Click to Enlarge

One side of the board comes with RAK811 LoRa module, the 2-pin header for the battery, and male headers for I/Os. The jumper on th top right is used to select boot mode, but more on that later.

RAK811 Tracker uBlox GPS module
Click to Enlarge

The other side includes u-blox MAX-7Q GPS module, a micro USB port, and the reset button. We also have two SMA connectors for the antennas.

RAK811 Tracker Hardware Setup

Th kit does not include any battery due to airline / customs regulations, so I bought a 18650 battery and battery holder locally…

18650 Battery Holder

.. and soldered it to the provided wires and connector, before inserting it into the board.

RAK811-LoRa-GPS-Tracker-Battery
Click to Enlarge

You’ll also need to connect the GPS and LoRa antennas. I had to spend some time to find out, as there’s no marking on the board, and no mention whatsoever in the documentation. I eventually found which SMA connector was for which antenna in the Aliexpress page…

Time to connect the micro USB to USB cable between the port and my computer to find out more, and configure the board.

RAK811 LoRa Tracker Info, Development Tools, and Firmware

I’m normally using Ubuntu 16.04, so here’s the kernel output when I insert device in computer:


It’s a typical serial device. We can connect to /dev/ttyUSB0 using minicom or other serial terminal program with 115200 bps 8N1  configuration. Then press the reset button or short the reset and GND pins with a jumper, remove it,  to reboot the board:


EU868 was not exactly what I was expecting, since I was told the board would be configured with AS923. But it turns out it’s not an issue, and the user is the one suppose to configure the tracker accordingly.

The pre-installed firmware was a little old (1.0.2), while the latest release on Github was v1.1.3 which adds support for AT commands. The documentation explains how to build the firmware with CooCox CoIDE or Arm Keil both of which are only available for Windows. Some people managed to built it with a Makefile in Linux, and submitted a pull request, but it was not approved, and now conflicts with other code. Let’s keep things as simple as possible, and fire a VirtualBox sessions with Windows 7.

The first step is to download CooCox CoIDE, an Arm GNU Embedded Toolchain, and get the code from github to open the project, modify it for AS923 as per the documentation, and build it in CoIDE. It seems easy enough, but the first roadblock was to download CooCox CoIDE itself, I only found an older version, and the build would then failed. The documentation – at the time of writing – is also outdated since it was before AT commands method was introduced. Anyway, eventually Rak provided a link to a newer version of CooCox CoIDE, and I managed to build the firmware.  We only found this solution near the end of the review, so instead I flashed the binary release: rak811_tracker_classA.bin.

You have three options to flash the firmware from Keil or CoIDE via STLink J-Link debugger, or via USB using STMicro Flash Loader Demonstrator. The latter seems easier since it does not require extra hardware. I tried to download it from the link on Rak Wireless documentation page, but it was slow and unreliable, so a better option is to get it directly from STMicro website.

RAK811 Serial Boot UpgradeFirst we need to move the jumper to short BOOT0 and VCC to enter serial boot mode as shown above, and below with RAK811 tracker pinout diagram.

RAK811 Tracker Pinout DiagramPress the reset button to restart the board, and we’re now ready to use Flash Loader Demonstrator.

STMicro-Flash-Loader-Demonstrator

First select the Port Name, in my case COM9, and click Next, you should be told the board is detected. If not, you may have forgotten to place the jumper correctly and/or reboot the board.

Click Next again, and select STM32L1_Cat2-128K from the list.Flash-Loader-Demonstrator-STM32L1_Cat2-128K

Press Next button again to select the firmware file we’ve just downloaded “rak811_tracker_classA.bin”.Flash-RAK811-Tracker-Firmware

Leave all other settings unchanged, and click Next button to start downloading data to the board, and flash the firmware.
RAK811-Firmware-Progress
It should only take a few seconds. Once everything is done, you’ll be greeted with a “Download operation finished successfully” message.RAK811-Tracker-Firmware-Success

Now move the jumper back in position with BOOT0 and GND shorted, connect the serial terminal, and press the reset button.

Configuring RAK811 Tracker with OTAA or ABP join method.

That’s the output from the terminal:


and nothing else. That’s because we are supposed to input the AT command for configuration as briefly explained in Github:

AT command list:
at+region=EU868/US915/AS923/AU915/IN865/KR920 // Set device region

at+dev_eui=xxxxxxxxxxxxxxxx // Set device dev_eui
at+app_eui=xxxxxxxxxxxxxxxx // Set device app_eui
at+app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Set device app_key

at+dev_addr=xxxxxxxx // Set device dev_addr
at+nwks_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Set device nwks_key
at+apps_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Set device apps_key

at+join_mode=otaa/abp // Set the device to join otaa or abp

Before we go further we should try to understand about the two methods:

  • Over-the-Air Activation (OTAA) is the preferred and most secure way to connect. Devices perform a join-procedure with the network, during which a dynamic DevAddr is assigned and security keys are negotiated with the device.
  • Activation by Personalization (ABP) hardcodes the DevAddr parameter as well as the security keys in the device. This means activating a device by personalization (ABP). This strategy might seem simpler, because you skip the join procedure, but it has some downsides related to security.

OTAA requires three parameters some identifiers, other security keys:

  • DevEUI – 64 bit end-device identifier, EUI-64 (unique)
  • AppEUI – 64 bit application identifier, EUI-64 (unique)
  • AppKey – 128-bit application key

OTAA joint method then automatically generates DevAddr, NwksKey, and AppsKey (notice the extra “s”), but those parameters need to be specified in ABP join mode:

  • DevAddr – 32 bit device address (non-unique)
  • NwkSKey – 128-bit network session key used for interaction between the Node and the Network
  • AppSKey– 128-bit application session key used for encryption and decryption of the payload

OTAA appears to be the best method, so let’s go that way.


The first three line defines the parameters discussed above, and the last two set the region, and join mode. It looks like you can make any number up as long as they are 64-bit or 128-bit in length as specified previsouly. I initially had troubles pasting the  AT commands in minicom, and I’ve been told they must be pasted one line at a time with “/r/n” (new line) at the end. I tried various terminals, and Tera Term worked for me after changing the settings to send (and receive) CR+LF line new-line in Setup->Terminal

Tera-term-New-Line-Config

Whichever terminal you use, the trick is to add a new line after each command.

The at+join_mode command must be the last one, as once I send that command, others are ignored…

Adding a LoRa Application & Device to MatchX Cloud

So we’ve now configured RAK811 node with the necessary parameters, so we need to go to MatchX Cloud to create an application and add a new device with the same parameters.

MatchX-Cloud-New-LoRa-ApplicationI created gps-tracking  application in order to track a bicycle location, at least that was the plan. Once you have your new application ready, you can click on “Create Node” and add a new device as shown below with DevEUI, AppEUI – and AppKey parameters.

MatchX-Cloud-Add-Node
Click to Enlarge

Leave ABP unchecked since we want to use OTAA join mode, and click on the Submit button.

First LoRaWAN Connection

Now we can press the reset button on RAK811 tracker board, and see what happens in the serial console:


Good, the device could join the network, and we have various information like temperature, battery level, and accelerometer data. We’d need to wait a little longer to get GPS coordinates once the fix is in.

Good, let’s see what we’ve got in MatchX Cloud.

MatchX LoRa Gateway RAK811 Data
Click to Enlarge

Awesome! We have some packets received every second (that’s what the firmware in RAK811 is supposed to do by default), and surely I’d be able to see RAK811 node location in the map in MatchX Cloud once the board gets GPS Fix. But not, nothing…

After studying a bit more including the documentation to setup RAK811 tracker node with The Things Network, I found out the data was sent in Cayenne Low Power Payload (LPP) format, and the gateway would not decode this type of data, so I asked MatchX whether it was possible to change that, and got the following answer:

When it comes to the data format – we are using different data encoding in a Type-Length-Value (TLV) format.
At this moment our cloud mapper is able to work only with this format. We are working on the major update of our Cloud and allowing more data parsers is on our check list, but this will still take us some time.

Connecting MatchX MatchBox LoRa Gateway to The Things Network

The good news is that Cayenne LPP will likely soon be supported, but I’d rather finished my review in a few days, rather than a few months. So since Rak wireless provided instructions to setup RAK811 with The Things Network (TTN), I decided to reconfigure the gateway to connect to TTN instead of MatchX Cloud.

MatchX MatchBox Gateway Dashboard
Click to Enlarge

We just need to go to MatchX Cloud, specifically the Gateway details page, and click on Edit Config button to change the gateway part to connect to TTN (AS1 in my case) instead of MatchX Cloud server:


Now click on Upload Config button, and the gateway configuration should be done. You’ll just want to note the MAC in the Gateway details windows, as it’s also the Gateway EUI that will be asked in TTN later on.

Setting Up The Things Network

Now let’s go to The Things Network website, sign-up for a free account, and go to the TTN Console. Click on Gateway, and register gateway.

The-Things-Network-Register-Gateway
Click to Enlarge

First tick “I’m using the legacy packer forwarder”, and paste the MAC from the gateway into “Gateway EUI” field, provide a description, select the frequency plans (Asia 920-923 MHz here), and select the router for your region.

The-Things-Network-Register-Gateway2
Click to Enlarge

You could also indicate the gateway location, but for MatchBox gateway it’s not needed as it supports GPS, and finally select the antenna placement (outdoor or indoor), and click on Register Gateway.

Now go back the TTN Console main page, and click on Application, then add application.

The Things Network New Application
Click to Enlarge

Fill an application ID, description, and handler registration of your choice, before clicking on Add application.

The-Things-Network-Application-Overview
Click to Enlarge

You should be redirected to the Application overview page, and you can now click on Devices in the top menu, and register device.

The-Things-Network-Register-Device
Click to Enlarge

Give it a Device ID, as well as the Dev EUI we’ve configured in RAK811 node, and click on Register. Now go to the Device Overview page, and you’ll find th DevEUI, AppEUI, and AppKey values.

The-Things-Network-Device-Overview
Click to Enlarge

Configure RAK811 for The Things Networks

Now we can go back to the terminal console on RAK811 tracker to reconfigure with our new values


I found I had to erase the data, and reflash the firmware with Flash Loader Demonstrator before being able to update the values with AT commands, but YMMV.  Let’s reset the board:


It looks good, we just need to wait for the GPS fix. In the meantime, we can find out if we received the join request from the device in TTN interface, using the Data tab of the device we’ve just configured.

The-Things-Network-Device-Application-Data
Click to Enlarge

Excellent. We now need to register the device with myDevices.com, as the service will handle Cayenne LPP data decoding, and show data in a pretty way.

After you’ve signed-up to the free service,  select LoRa in the dashboard.

mydevices-device
Click to Enlarge

Then The Things Network on the left side of the interface…

Cayenne-The-Things-Network
Click to Enlarge

Now scroll down to select Cayenne LPP…

mydevices-TTN-Cayenne-LPP
Click to Enlarge

… and enter a name, your DevUI, and click on “Add Device”.

Cayenne-LPP-DevEUI-already-used
Click to Enlarge

Nooooo! . The DevEUI is already taken… Damn. So I tried a few others until I found “60c5a8fffe002011” was unsued. I added that device, but I had to repeat the steps in The Things Networks and RAK811 serial interface to reconfigure everything with my new DevEUI…

Configure Cayenne Integration in TTN

We’re not quite done yet, as we need to go back to TTN, click on Integration in the device dashboard…

The-Things-Network-Add-Integration… select Cayenne icon, input a Process ID of your choice, and select default key in the Access Key field.

The-Things-Network-Cayenne-IntegrationClick on Add integration button, go to Payload Formats, and select Cayenne LPP.

The-Things-Network-Payload-Cayenne-LPP

Click on Save, and after a few minutes, we should see a nice representation of temperature, accelerometer, and GPS data in Cayenne.

Still More Problems and a Workaround

Cayenne-No-Data
Click to Enlarge

But a few hours later, I still got an empty dashboard 🙁 What is going on?

RAK811-OTAA-Join-Fail-TTN-Messages
Click to Enlarge

I can see some packets in TTN, but the serial console shows some troubles with OTAA Join.  So appears RAK811 can send a join request to the gateway, which then forward it to The Things Netwokrs, but somehow it does not get a reply. I tried to change MatchX Gateway global_conf.json with the one provided by TTN for AS1 (Asia 1 – 920 – 923 MHz), but still no luck.

Finally, the guys at Rak Wireless helped me out via TeamViewer sessions, and found a “solution” by changing the Activation Method from OTAA to ABP join in TTN.

The-Things-Network-ABP-Activation-Method
Click to Enlarge

and pasting the relevant AT commands in RAK811 serial console.


Reset the board, and after a few seconds I started to get RSSI and SNR data in Cayenne LPP dashboard, and within a few minutes the GPS data was aso retrieve and I could see RAK8711 LoRa tracker position in mydevices.com

RAK811 Cayenne LPP Data
Click to Enlarge

That was not exactly  trouble-free experience, but I was happy to finally manage it. Rak Wireless thought the issue with OTAA might be a timing issue. MatchX on their side considerered that it could be a problem with power tables:

A potential problem can be with the power tables. When Server wants to send the message to the end node, it specifies the requested power RF level. Gateway takes this power level and subtracts the antenna gain (specified in global_config, 2.5db in our case but 0.5 is dropped and only 2db is subtracted) to compensate for used antenna. Than it looks for the entry in its LUT power table with this particular power to configure its internal amplifiers. If it can’t find the required power level the message is dropped. Our global_config is configured to be complaint with LoRa regional parameters 1.0 and we are going to update to version 1.1 somewhere in near future. TTN server may be configured differently though. We haven’t tried TTN servers for this region.

Nevertheless, I have not investigated this part yet, as I wanted to finished this review pretty quickly, since I’ll soon have to remove the gateway due to personal reasons.

Running, Driving and Walking Around

Now that I had everything up and working, I wanted to test the node outside the home to see the range I got. My first test was a 3km evening run keeping everything in place with a belt.

LORA-GPS-Tracker

But I soon found out RAK811 automatically turn itself off. It happens sometimes when running on battery, but looks a bit random. I’m not sure it’s a typical problem since I damage the board as I fell is an earlier test at home, and damaged some pins.

Nevertheless, I did not get any data that evening, but next morning, I drove the car out. I first drove a few dozen meters, and check the location of the tracker was indeed updated before losing WiFi connection (I don’t use cellular data).

RAK811-LoRa-Tracking-CarGood! The location was properly updated with reasonable accuracy (4 to 5 meters off). Then I slowly drove to  another location with WiFi about 500 meters (line of sight), and connected to check if the location was updated every minute as it should, and nothing in myDevices  dashboard. So I connected RAK811 to my laptop to check it got GPS data in the serial console, and sure enough it did. I drove back, and when I was home I could not further updated. myDevices dashboard would not be updated anymore even though some messages were received in TTN dashboard.

Later that day, I went for a walk to the local market around 500 meters away in a straight line, and kept monitoring packets in TTN.

Gateway-Traffic-Way-to-Market
Click to Enlarge

I think I left home around 10:20, and I was in an indoor shop at 10:32 according to the receipt. In an ideal world, I should have received messages every minutes, but there was a 6 minute period during which TTN did not receive any messages at all (10:25 to 10:31). The same packet loss did not occur on the way back, with just two messages lost.  Sadly, still nothing in myDevices dashboard.

The funny thing is that I’m writing those words, I could see data in myDevices today (another day) up to 17:33.

Cayenne-Data
Click to Enlarge

The time is now 20:00. RAK811 board is still running, I have not touched it, but since no new data have been received for 2 hours and a half. Locals told me we have ghosts here, so that must be why 🙂 More seriously, I suspect the problem that occurred with OTAA, maybe resurfacing with ABP randonly. So maybe its indeed a timing issue, or a problem with a specific frequency.

My first experience with LoRa / LoRaWAN was not exactly painless, and I still have much too learn. For example, I’ve yet to look at power consumption / battery life matters since I struggled so much to make it work. But at least it was a good learning experience, as I know better understand how this works, and how each part from hardware to the cloud integrates together.

If you’re interested in getting the hardwareI played with you can get MatchBox LoRa gateway on MatchX website for 350 Euros, and RAK811 LoRa tracker for about $50 shipped on Aliexpress.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard

2 Replies to “AS923 LoRa GPS Tracking with MatchX MatchBox Gateway and RAK811 LoRa GPS Tracker Board”

  1. Finally I’ll just drop a message I got from Rak Wireless a little while ago about power consumption and HW changes:

    But based on current design we will ship to you, if you want to calculate the power consumption:

    Tx current: 120mA, tramission time you can base on 100ms
    Standby current: 5.6mA
    Sleep mode: 200uA

    Here is our reply in TTN to get more insight:
    https://www.thethingsnetwork.org/forum/t/rak811-tracker-board/11006/279

    —————————————————–

    After seriously read the discussion by this thread and rak forum, we collect the suggestion and decide to optimize the rak811 tracker design as following:

    The R1/C1 pin of GPS power switch chip U5 needs to be connected to a pull-up circuit。
    Power indicator LED1 light removed. Reserve charge indicator, and two GPIO control status indicators.
    The EXTINT0 and ANTON pin of the GPS module needs to be connected to GPIO to facilitate wake-up in low power mode.
    CP2102 chip removed, add a serial adapter board accessories。
    Add GPIO to detect the power supply type of the device, battery-powered or USB-powered. It can be detected using the power chip PG pin and CHG pin.
    Directs one UART interface for users to expand to other devices。

    So they’ll change the hardware in a new revision, and power consumption should be lower.

  2. Apparently they increased the price from $29.99 (as you reported) to a whopping $99. Do you remember when you last checked the price? From the transaction history it looks like they haven’t sold anything since August…

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...