DEV Community

Cover image for Deploy a Data Only Helium Hotspot with balena, Raspberry Pi and RAK LoRa concentrator
Marc Pous
Marc Pous

Posted on

Deploy a Data Only Helium Hotspot with balena, Raspberry Pi and RAK LoRa concentrator

Find here a step-by-step tutorial to build, deploy and manage a Helium data-only Hotspot using balena. Note that this is a balena version based on the Nebra helium light hotspot.

Disclaimer

This Helium Hotspot is going to transfer LoRa data to Helium OUIs BUT it's not going to perform proof-of-coverage or anything else to retrieve tokens.
Read more information about the milestones and what's possible to get here

Requirements

Hardware

  • Raspberry Pi 0/2/3/4 or balenaFin
  • SD card in case of the RPi 0/2/3/4
  • Power supply and (optionally) ethernet cable
  • LoRa concentrator (SX1302 SPI based) (e.g. RAK2287)

Software

Deploy the fleet

One-click deploy using Balena Deploy

Running this project is as simple as deploying it to a balenaCloud application. You can do it in just one click by using the button below:

Follow instructions, click Add a Device and flash an SD card with that OS image dowloaded from balenaCloud. Enjoy the magic ๐ŸŒŸOver-The-Air๐ŸŒŸ!

Device Variables

Once the device is online and the services packet-forwarder and gatewayrs are downloaded and installed go to Device Variables:

  • VARIANT: This is used to define your hardware. During the test is being used a Raspberry Pi 4 with RAK2287 LoRa concentrator and the VARIANT is defined DIY-RAK2287. You can find here the list of hardware compatible.

  • REGION_OVERRIDE: This is used to define your LoRa region (e.g. EU868). You can find here the list of LoRa regions compatible.

At that moment the hotspot should be running showing some errors on connecting to the Blockchain on the balenaCloud Logs.

Run the Helium Hotspot

To check that everything is running properly, go to the Terminal and select the gatewayrs service, then introduce.

helium_gateway key info
Enter fullscreen mode Exit fullscreen mode

And you will get something like this:

{
  "address": <hotspot address>,
  "name": <hotspot name>
}
Enter fullscreen mode Exit fullscreen mode

Join the Helium blockchain with your data-only hotspot

To join the Helium blockchain, at the moment (summer 2021) you only can use the Helium CLI. The Helium app is still not compatible with the data-only hotspots. Install the Helium CLI wallet and follow these steps:

Create a Helium wallet

Install the Helium wallet CLI or use the wallet key from your mobile application. In case that you need to create a wallet from scratch, just type and follow the instructions.

helium-wallet create basic
Enter fullscreen mode Exit fullscreen mode

Then to see YOUR_WALLET of the Helium wallet type:

helium-wallet info
Enter fullscreen mode Exit fullscreen mode

Add the hotspot from balenaCloud

Go to your device on balenaCloud and type on the HostOS terminal (before change YOUR_WALLET by your public Helium wallet ID):

root@d83bf778fc69:/etc/helium_gateway# helium_gateway add --owner YOUR_WALLET --payer YOUR_WALLET
{
  "address": "YOUR_ADDRESS",
  "fee": 65000,
  "mode": "dataonly",
  "owner": "YOUR_WALLET",
  "payer": "YOUR_WALLET",
  "staking fee": 1000000,
  "txn": "YOUR_TXN"
}
Enter fullscreen mode Exit fullscreen mode

Remember that to confirm all the commands you will need to add --commit at the end of the command.

Then go to your computer where you installed the Helium wallet CLI software. Copy your txn from the previous JSON response and type:

MacBookPro-Marc-Pous-2827:helium-wallet-v1.6.6-x86-64-macos marcpous$ ./helium-wallet hotspots add YOUR_TXN --commit
Password: [hidden]
+-------------+-----------------------------------------------------+
| Key         | Value                                               |
+-------------+-----------------------------------------------------+
| Address     | YOUR_ADDRESS                                        |
+-------------+-----------------------------------------------------+
| Payer       | YOUR_WALLET                                         |
+-------------+-----------------------------------------------------+
| Fee         | 65000                                               |
+-------------+-----------------------------------------------------+
| Staking fee | 1000000                                             |
+-------------+-----------------------------------------------------+
| Hash        | YOUR_HASH                                           |
+-------------+-----------------------------------------------------+
Enter fullscreen mode Exit fullscreen mode

You will need to have some Data Credits to be able to do this operation (1065000 DCs).

Finally you will need to assert the location of the data-only Helium hotspot. Cpy your

MacBookPro-Marc-Pous-2827:helium-wallet-v1.6.6-x86-64-macos marcpous$ ./helium-wallet hotspots assert --gateway YOUR_ADDRESS --lat=YOUR_LAT --lon=YOUR_LON --mode dataonly --commit
Password: [hidden]
+------------------+-----------------------------------------------------+
| Key              | Value                                               |
+------------------+-----------------------------------------------------+
| Address          | YOUR_ADDRESS                                        |
+------------------+-----------------------------------------------------+
| Location         | LOCATION_HASH                                       |
+------------------+-----------------------------------------------------+
| Payer            | YOUR_WALLET                                         |
+------------------+-----------------------------------------------------+
| Nonce            | 1                                                   |
+------------------+-----------------------------------------------------+
| Fee (DC)         | 55000                                               |
+------------------+-----------------------------------------------------+
| Staking Fee (DC) | 500000                                              |
+------------------+-----------------------------------------------------+
| Gain (dBi)       | 1.2                                                 |
+------------------+-----------------------------------------------------+
| Elevation        | 0                                                   |
+------------------+-----------------------------------------------------+
| Hash             | YOUR_HASH                                           |
+------------------+-----------------------------------------------------+

Enter fullscreen mode Exit fullscreen mode

And now that should have worked.

Backup your gateway_key.bin file

DISCLAIMER: It's very important that at this point you backup the gateway_key of your hotspot. If you loose this key, you will not be able to use this hotspot anymore.

Follow this instructions to backup your gateway_key.bin file of your hotspot.

  1. Open an SSH session to the "host-os" on balenaCloud Terminal.
  2. Type this command and keep note of the (YOUR INSTANCE)_miner-storage: ls /var/lib/docker/volumes
  3. Type this command to get a link to download the gateway key (note 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
  4. 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 this instructions to restore your gateway_key.bin key into your new hotspot.

  1. Open an SSH session to the "host-os" on balenaCloud Terminal.
  2. Type this command and keep note of the (YOUR INSTANCE)_miner-storage information: ls /var/lib/docker/volumes
  3. Navigate to where the swarm_key is stored cd /var/lib/docker/volumes/(YOUR INSTANCE)_miner-storage/_data#/
  4. Remove the original gateway_key.bin file rm gateway_key.bin
  5. Upload your gateway_key.bin that you wish to restore onto file.io and do curl -LJO [FILE.IO UPLOAD LINK]
  6. Reboot miner and you will see it restored and working :)

Attributions

Thank you to Nebra for developing and balenifying the Helium Hotspot, Helium developers community, Travis and Joseph from balena to work on the dbus + conman issues.

Discussion (0)