22 April 2022 / Last updated: 22 Apr 2022

Build your Helium Data-Only Hotspot with balena

Execution time: 1hr - 2hr
Difficulty: Low
Cost: Medium
In previous posts, we covered different ways to build a LoRaWAN gateway connected to The Things Stack (the former The Things Network (TTN)). In this post, we’ll show you how to deploy a fleet of Helium data-only hotspots on Raspberry Pi and Seeed WM1302 LoRa concentrators (SX1302).
Learn how to build a Helium hotspot with balena and Seeed
Helium is a crowdsourced LoRaWAN network running on blockchain. To provide network coverage, people host Helium hotspots at their places. The hotspots are devices providing LoRaWAN coverage.
For providing coverage, the hotspots get rewarded with tokens ($HNT). Other actions such as relay messages and ask for coverage also rewards the owners of the hotspots.
Get to know some of the background information below, or go straight to the project build steps.

Some background

Let’s get folks up to speed about what we’re building here. Feel free to skip down below to the build steps if you’re already familiar with LoRaWAN and Helium.

What is a LoRaWAN network?

LoRaWan (LoRa Wide Area Network) is a protocol over LoRa radio technology to manage IoT networks over ISM bands. It is also known as LPWAN (Low Power Wide Area Network) technology. LoRa (Long Range) is a communication technology based on open and free frequencies. It allows long distance communications (some miles depending on the topology) with a minimum of power consumption and a small amount of data (some bytes).
Usually LoRaWAN networks are managed by operators. The network is made up of LoRa nodes (a sensor or actuator) which emit messages over the air. The message is usually captured by one or many LoRaWAN Gateways (in The Things Network) or Hotspots (in Helium), if there is coverage. When a LoRaWAN antenna is receiving and processing the LoRaWAN message, it redirects the data sent by the LoRa node to the operator.
The packet forwarder is the software (e.g. basicstation) running on the Gateway or Hotspot which converts the LoRa data received into an IP package. Then it relays the package to the operators’ platform. Once received by the operator’s platform, the message is associated with an existing device which belongs to an existing user. At this point, the message is accepted or rejected by the network and associated with billing if needed. Later the data received is forwarded where the user wants.

What is Helium?

Helium is a crowdsourced LoRaWAN network, and an advancement from other crowdsourced networks (e.g. guifi.net or The Things Network). It offers tokens (based on the $HNT cryptocurrency) as rewards to the hotspots owners that provide validated network coverage.

How does Helium work?

Helium LoRaWAN hotspots have miners built into the same device. The miners are connected over a P2P network and they all interact with the blockchain managed from the validators (in the past, the blockchain was also maintained by the hotspots). The blockchain rewards the gateway (hotspot) owners with a crypto token (HNT). The main idea is to incentivize the hotspot owners to provide good coverage.
On Helium, sending LoRa data over the network costs money. To send 24 bytes of data it costs 1 DC (Data Credit). 1 Data Credit has a stable price of $0,00001. To acquire DCs users need to burn HNT (Helium Network Tokens). Price for sending data can be calculated here. If you send data over LoRa through your hotspots burning DCs, the HNTs that you will get rewarded to relay data will be the same as the DC spent.
Helium’s blockchain performs Proof of Coverage (PoC) instead of Proof of Work. We won’t cover those topics in this guide, but feel free to do some independent research on them.
The blockchain doesn’t contain data from the sensors, it manages the message routing and the gateway list. It validates the gateway location via the PoC, and it also manages the HNT transactions. The blockchain is currently managed by the validators.

What is a Helium Hotspot?

At the moment, a Helium Hotspot is a single board computer with a LoRa concentrator (compatible with SX1301, SX1302 or SX1303) with the aim to provide the right LoRaWAN coverage to the sensors that send LoRa data.
Official Helium Hotspots need to run a secure element (ECC) where the blockchain swarm key will be stored. The swarm key is a secure key used by the miner service to sign all blockchain transactions. That means that the swarm key can’t be accessed easily and it’s not open.
The Data Only Hotspots are Light Hotspots without the secure element. The Data Only Hotspots only get rewards for forwarding data, and they are not rewarded for PoC.

Tutorial

Now it’s time to build together the Data-Only Helium Hotspot using a Raspberry Pi and the Seeed WM1302 LoRa concentrator.
This Data-Only Helium Hotspot is based on the Nebra Light Hotspot.

Hardware required

I’m going to use a Raspberry Pi 4 on this tutorial, but the project is compatible with other models.

Software required

Run your Helium Hotspot

Running this project is as simple as clicking the Deploy with balena button and deploying the project to your balenaCloud fleet. Click the button below:
Once clicked, follow the instructions, click Add a Device, download the balenaOS image and flash an SD card. Enjoy the magic 🌟Over-The-Air🌟!
Alternatively you also can deploy it from the balenaHub or the github repo.

Configure your data-only Helium Hotspot

When the device gets online, the services helium-miner and packet-forwarder will be downloaded and installed.
See your successfully created app on your device in the balenaCloud dashboard.
Now it’s time to configure your Hotspot. Go to Device Variables and modify the variables:
  • REGION_OVERRIDE: to define your LoRa region (e.g. EU868, US915, AS923_1 and more). Check here the supported LoRa region frequencies.
  • VARIANT: to define the LoRa concentrator and hardware that you are using. On this tutorial, I'm using a Raspberry Pi 4 with a Seeed WM1302, then the VARIANT is DIY-RAK2287. Find here the complete list of variants.
  • MINER_UPDATE: to accept to have automatic updates or not.
In my case, I'm running the variable RUST_BACKTRACE to full to get all the logs when there is an error on the helium-miner service. You might not need to have this variable if you don’t want to see all the logs in case something fails.
Change device variables in the balenaCloud dashboard.

Add the Helium Hotspot into the Blockchain

If you are deploying for the first time the Hotspot you will need to add it into the Helium Blockchain. To do that, you need a Helium wallet with 65,000DC. Find more instructions here.

Check your Hotspot

Open the terminal with the service helium-miner and type /usr/bin/helium_gateway -c /etc/helium_gateway/ key info. The result should be this:
/usr/bin/helium_gateway -c /etc/helium_gateway/ key info
This is the result that you have to see:
{
  "address": "<hotspot-address>",
  "name": "<hotspot-name>"
}
If you see an error when running this, please introduce a ticket on the balena forums with the error description and logs.
If everything worked well, copy the hotspot address as you will need this to add your Helium Hotspot into the Helium Blockchain.

Create the Helium wallet on your computer

*DISCLAIMER: At the moment we are writing this blogpost the Helium mobile Application (and wallet) still do not register Data-Only Hotspots.*
First of all install on your computer the Helium Wallet CLI.
Open your terminal and type:
helium-wallet create basic
To see your Helium wallet information type:
Helium-wallet info
Copy YOUR_WALLET variable. Go to the Terminal of your Hotspot on balenaCloud and select helium-miner service and type:
helium_gateway add --owner YOUR_WALLET --payer YOUR_WALLET 
The result should be something like this:
{
  "address": "YOUR_ADDRESS",
  "fee": 65000,
  "mode": "dataonly",
  "owner": "YOUR_WALLET",
  "payer": "YOUR_WALLET",
  "staking fee": 1000000,
  "txn": "YOUR_TXN"
}
To confirm the helium_gateway add operation you will need to add --commit at the end of the command.
Copy YOUR_TXNand go to the Terminal of your computer where you have the Helium wallet CLI installed. Type:
./helium-wallet hotspots add YOUR_TXN
Remember that you need to add --commit at the end of this command.
The result should be something like:
+-------------+-----------------------------------------------------+
| Key         | Value                                               |
+-------------+-----------------------------------------------------+
| Address     | YOUR_ADDRESS                                        |
+-------------+-----------------------------------------------------+
| Payer       | YOUR_WALLET                                         |
+-------------+-----------------------------------------------------+
| Fee         | 65000                                               |
+-------------+-----------------------------------------------------+
| Staking fee | 1000000                                             |
+-------------+-----------------------------------------------------+
| Hash        | YOUR_HASH                                           |
+-------------+-----------------------------------------------------+
Now it’s time to assert the operation by adding the data-only Hotspot into the Blockchain using the Helium wallet CLI on your computer. Remember that you need 65,000DC on your Helium wallet to run this operation.
For asserting the hotspot you will need to know your latitude and longitude, plus elevation of the Hotspot’s antenna and the gain of the antenna.
./helium-wallet hotspots assert --gateway YOUR_ADDRESS --lat=YOUR_LAT --lon=YOUR_LON --mode dataonly --elevation=YOUR_ELEVATION --gain=YOUR_GAIN
Remember that you need to add --commit at the end of this command.
The result should be similar to this:
+------------------+-----------------------------------------------------+
| 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                                           |
+------------------+-----------------------------------------------------+

If everything worked properly, now your Helium data-only Hotspot should be available on the Helium Network. At some point it will appear on the Helium explorer map. Use this URL
https://explorer.helium.com/hotspots/<hotspot_address>
Change <hotspot_address> by your hotspot address generated on the Terminal helium_miner at balenaCloud running:
/usr/bin/helium_gateway -c /etc/helium_gateway/ key info
See your new Helium data-only hotspot at work.
Now that you've confirmed your data-only hotspot is online, enjoy watching data pass through your hotspot in the Helium Explorer.

Troubleshooting

This is an open source Data-Only Helium Hotspot application, so feel free to contribute and send feedback. If you find any issue, feel free to report it at the balena forums.

Attributions

Thank you to Seeed and Nebra for developing and "balenifying" the Helium Hotspot, and to the Helium developer community, Mithun, Alexis, disk91, Travis, David and Joseph.
by Marc PousDeveloper Advocate