Pine64 has been mentionning LoRa on their monthly community update (in February, for example) for a few months now and it is now becoming a reality : TL, founder of Pine64 sent an engineering sample of the future Pine64 LoRa gateway to a few people from the community (myself included), and I received mine in the beginning of April.
Since then, the whole « Lora » project has been named PineDIO (Pine + Radio), and Pine64 and RAK officially announced their collaboration for developping opensource LoRa hardware and software!
The Pine64 Lora Gateway is based on the Pine A64-LTS SBC. This is a relatively under-powered board by current standards (quad-core ARM Cortex A53 @1.1Ghz, 2GB RAM) but it should be more than powerful enough to run a LoRa/LoRaWAN gateway. The relatively low-power CPU has also the big advantage that it doesn’t heat a lot, which will be appreciated by people who want to run an outdoor gateway!
The LoRa contentrator is a RAKWireless module : the RAK2287. It’s a mini-PCIe based on the SX1301 digital baseband chip. The RAK2287 is fitted on an adaptator board to connect the mini-PCIe module onto the Pine A64-LTS board via the « PI-2 bus connector ».
The RAK2287 module has 2 antenna connectors : one for the LoRa radio (it was shipped with the gateway) and one for the GPS radio (not shipped, I use a amplified one to get a better signal from the inside oh my house).
The gateway was also shipped with the WiFi addon and its antenna. The whole hardware is installed into a nice white plastic box.
My first steps with the gateway – Linux distributions
After the initial discovery of the hardware, all I wanted to do is start a Linux system and see how to access the LoRa hardware from there.
Unfortunately, it didn’t went as smoothly as I thought is would be : the support from the distributions for this board is not as wide as for other hardware from Pine64 like the PinePhone or the PinebookPro. This is a bit surprising as the PinePhone is based on the same CPU than the A64-LTS…
I focused mainly on Armbian because it looks like most of the software support from RAK (https://github.com/RAKWireless/rak_common_for_gateway) targets the RaspberryPi and Debian based distributions.
I had many frustrations with newer versions of Armbian (based on kernel 5.10 and 5.11) : filesystem issue on builds from late 2020, and network (wired and WiFi) issues on newer builds. There are workarounds documented on their forums but I couldn’t manage to get them working. Finally, I decided to stick with an older release based on kernel 5.9, and everything went smoothly. I hope someone will find the time and energy to fix these issues, as the Pine A64-LTS is supposed to be a widely used board (in SOPine boards and cluster, and now in the LoRa gateway). So, if you don’t want to spend time fixing network issues, I recommend you use Armbian 20.11.3 « buster » based on kernel 5.9.14.
Ok, now I have a running Linux, I need to figure out how the hardware is connected to the board so that I can enable the corresponding drivers. It took me some time to figure that out from the schematic, so here’s the result of my researches:
|RAK2287 module||PI-2 connector||PINE A64-LTS|
|SX1302 SPI||Pin 19 = MOSI / PC0|
Pin 21 = MISO/PC1
Pin23 = CLK/PC2
Pin24 = CS/PC3
|SX1302 RESET||Pin 11 = GPIO17/PC7||GPIO71 (/sys/class/gpio/gpio71)|
|GPS UART||Pin 8 = TX|
Pin 10 = RX
|GPS RESET||Pin 33 = GPIO13/PC5||GPIO69 (/sys/class/gpio/gpio69)|
|GPS Standby||Pin 35 = GPIO19/PC9||GPIO73 (/sys/class/gpio/gpio73)|
Now, we can run armbian-config to enable the SPI0 and UART2 devices. You can even listen to UART2 to read the NMEA frames from the GPS receiver.
A LoRa gateway needs to be able to receive LoRa/LoRaWAN messages using its LoRa concentrator and to forward them to a LoRa application server. For that, you need software that will drive the hardware (LoRa radio, GPS,…) to receive the LoRa frames from the air and that will process and send them to the application server. Fortunately, RAK is very open source friendly and provides all this software online, on Github : https://github.com/RAKWireless/rak_common_for_gateway.
This repo contains code and scripts for multiple platforms and hardwares. The platform « RAK7248 no LTE (RAK2287 + raspberry pi) » is the one that is the most similar to the Pine64 hardware. And, as we (me and other users from the community chat, wiki and forum) found out, it’s quite easy to adapt to run on the Pine A64-LTS board. You just need to modify a few files to specify the correct SPI and UART devices.
User RTP (Right To Privacy), who also have a Pine64Lora Gateway, forked the repo from RAK and modified the necessary file, so that you can just run the installation script and that’s it! You have a LoRa gateway!
The Things Network and Chirpstack
The Things Network (TTN) is a public LoRaWAN network based on open-source techology. Everyone is free to use the network (by connecting to TTN gateways setup by other users) and/or to setup and connect their own gateway to the network to extend the coverage. I like the philosophy of this project : good technology, open-source friendly, very innovative, and no money involved unless you need « professional » support and integration.
Connecting to TTN was easier than I expected : the installation script from RAK pre-configures the packet forwarder to connect to TTN. All you have to do is add your gateway on the TTN Console.
As you can see on the picture below, I used my good old Pycom Lopy4 board as a LoRaWAN node to test the gateway.
Chirstack is an open source LoRaWan network server stack. You can use this project to self-host your own LoRaWAN stack and infrastructure (gateway -> application server -> integrations and application). And the good thing is that RAK provides a script that easily install the whole Chirpstack software on the gateway directly. You just need to run the gateway-config utility to switch to/from TTN/Chirpstack
That it for my first experiments with the Pine64 LoRa Gateway. I’ll probably experiment more, and build actual applications using this hardware in the future.
All in all, I would say that the Pine64 LoRa gateway nearly ready to be used an actual gateway : all the software needed to start a LoRa gateway and connect it to major LoRaWAN network exists and works! We probably need a bit of polishing so that people who’ll buy the gateway can easily setup the software and run their gateway in a matter of minutes!
I would say I’m pretty excited by the collaboration between Pine64 and RAK, and I can’t wait to see what amazing hardwares, softwares, devices and applications will come up from this collaboration!