balena + Raspberry Pi + RAK2287
A Helium IoT Hotspot transfers data from nearby LoRaWAN devices and earns HNT for that traffic. This guide builds one with a Raspberry Pi and a RAK2287 concentrator on balena.
This guide covers all the steps needed to set up a Hotspot using a Raspberry Pi, a RAK concentrator (RAK2287), and the Pi HAT running on balena. This configuration can be achieved by installing the gatewayrs and packet forwarder services open-sourced by Nebra and using balenaOS and balenaCloud.
Getting startedβ
Hardwareβ
- Raspberry Pi 0/2/3/4 or balenaFin
- SD card (if using a Raspberry Pi)
- SPI-based RAK2287 LoRa concentrator and RAK2287 Pi HAT
To use the concentrator module with a Raspberry Pi HAT, you must order the variation with the SPI interface.
Softwareβ
Deploy the codeβ
Run this Hotspot with balena.io by deploying it to a balenaCloud application. You can do it in one click by using the button below:
Follow the instructions, click Add a Device, and flash an SD card with the balenaOS image
downloaded from balenaCloud. Enjoy the magic πOver-The-Airπ!
Find the repository with the source code if you would like to clone and deploy from your computer or would like to contribute.
Configure the deviceβ
Device Variablesβ
Once the device is online on balenaCloud and the services packet-forwarder and gateway-rs are
downloaded and installed, go to Device Variables.
-
Create the
VARIANTvariable for all the services with your hardware definition. During testing, a Raspberry Pi 4 with a RAK2287 LoRa concentrator was used and theVARIANTwas defined asDIY-RAK2287. ThisVARIANTis compatible with any Raspberry Pi. You can find the list of compatible hardware combinations on GitHub. -
Create the
REGION_OVERRIDEvariable for all the services with your LoRa region (e.g.EU868). You can find a list of compatible LoRa regions on GitHub.
Test the Hotspotβ
Once the Device Variables are properly set up, the Hotspot should be running, showing some errors connecting to the network in the balenaCloud Logs.
To check that the Hotspot has been generated correctly, go to the Terminal and select the
gateway-rs service, then enter:
helium_gateway key info
And you will get something like this:
{
"name": "angry-purple-tiger",
"key": "11TL62V8NYvSTXmV5CZCjaucskvNR1Fdar1Pg4Hzmzk5tk2JBac",
"onboarding": "11TL62V8NYvSTXmV5CZCjaucskvNR1Fdar1Pg4Hzmzk5tk2JBac"
}
At this point, your Hotspot is ready to join the Helium IoT Network.
Join the Helium IoT Networkβ
Use the Helium CLI Wallet to add this Hotspot to the network. The Helium Wallet App onboards Hotspots over Bluetooth and requires an approved maker, so it cannot onboard a self-built Hotspot like this one.
Follow On-Device Onboarding to issue the Hotspot on-chain and assert its location.
Check the Hotspotβ
Now that the Hotspot has been added to the Helium IoT Network, it should be visible in the Helium Wallet.
Once you have a device registered with an LNS, inspect packets from that device in your LNS to confirm that this Hotspot is the one relaying the data. You will also be able to see in the balenaCloud logs that UPLINK messages have been relayed. See Find a LoRaWAN Network Server Provider if you do not have an LNS yet.
Manage your gateway_keyβ
It's extremely important that at this point, with the Hotspot added to the Helium IoT Network, you
back up the gateway_key. If you lose this key, you will not be able to use this Hotspot anymore if
there is a problem with it (a corrupted SD card, etc.).
Backup your gateway_key.bin fileβ
Follow these instructions to back up the gateway_key.bin file of your Hotspot.
- Open an SSH session to the "host-os" on balenaCloud Terminal.
- Type this command and make a note of the (YOUR INSTANCE)_miner-storage:
ls /var/lib/docker/volumes. - Type this command to get a link to download the gateway key (be sure to replace the YOUR INSTANCE
part with the container number that you got from the previous command).
curl -F "file=@/var/lib/docker/volumes/(YOUR INSTANCE)_miner-storage/_data#/gateway_key.bin" https://file.io - Use the outputted file.io link to securely download your swarm key. The link only works one time.
Restore your gateway_key.bin file on your new fileβ
Follow these instructions to restore your gateway_key.bin file into your new Hotspot.
- Open an SSH session to the "host-os" on balenaCloud Terminal.
- Type this command and make a note of the (YOUR INSTANCE)_miner-storage information:
ls /var/lib/docker/volumes. - Navigate to where the swarm_key is stored
cd /var/lib/docker/volumes/(YOUR INSTANCE)_miner-storage/_data#/. - Remove the original
gateway_key.binfilerm gateway_key.bin. - Reboot the miner and you will see it restored and working.
- Upload your
gateway_key.binthat you wish to restore onto file.io and docurl -LJO [FILE.IO UPLOAD LINK].
Contributionsβ
Thank you to Nebra for developing and balenifying the Helium Hotspot, the Helium developer community, Jose from RAK, and Travis and Joseph from balena for working on the dbus + conman issues.
