UPDATE: 04/11/2021 : [copied from helium discord] Any new DIY will not earn HNT. If you build a DIY packet forwarder today, it will only transfer data on the Helium network. There is no plan to resume the alpha program. If you would like to earn HNT, please visit helium.com/mine.

Build your own helium hotspot ( miner + packet forwader ) on Raspberry pi 4 using BalenaOS

IMG_3112 IMG_3115

Hardwares you need

  • Raspberry Pi 4 link
  • USBC power adapter link
  • 64GB Micro SD card link
  • RAK2245 Pi HAT link While purchasing please check frequency of your country.

Softwares you need

  • Free Balena Cloud account link
  • Mac or Windows ( I tested on Mac )
  • BalenaEtcher to flash image download
  • Balena CLI install
  • jq install

Deploy with balena

Running Helium on balenaCloud is a breeze. Just click the Deploy with balena button below:

balena deploy button

Alternatively, you can install manually on balenaCloud using the instructions below.

Let's get started

As you got your hardwares and softwares let's get started and turn your Pi into a helium hotspot

Step 1: Prepare image with balenaOS

Log into balena cloud website and click on "Create Application" button

Screen Shot 2020-07-22 at 11 06 14 AM

This wil bring a modal window as below. Type a name as you desire, choose device type as "Raspberry Pi 4" , application type as "Starter" and hit "Create new application" button.

Screen Shot 2020-07-22 at 11 09 00 AM

Once the application is created, it will take you to the application page. You need to add a device now. Screen Shot 2020-07-22 at 11 12 22 AM

Click on "Add device" button which will open below modal. Screen Shot 2020-07-22 at 11 14 44 AM Turn on "Wifi+Ethernet" and put your wifi credential there. After that click on "Download BalenaOS" button which will download a zip file on your comuter. Next, click on Environment variable menu from left pane and create a new variable as "REGION" with value "US915" (you may need to change as per your region. This repo supports US915, EU868 and IN865. Please create PR if with your region) Screen Shot 2020-07-22 at 11 19 30 AM

Step 2: Flash image on SD card

Plug micro SD card into your computer. Open balenaEtcher software, select the downloaded zip file from your computer and select the SD card to format and click on "Flash"

Screen Shot 2020-07-22 at 11 26 22 AM

Once completed, unplug SD card from your computer and insert in your Raspberry Pi and power up your Pi. In about 20-30 seconds your device should appear on balena cloud application as below.

Screen Shot 2020-07-22 at 11 34 12 AM

Very exciting so far! Isn't is?

Step 3: Deploy helium miner and gateway to balena

Now the fun begins. Stack your RAK2245 HAT on your Pi. From balena cloud , generate a session token ( Preferences -> Access Tokens )

Next, clone this repo somewhere on your computer

git clone https://github.com/just4give/helium-dyi-hotspot-balena-pi4  && cd helium-dyi-hotspot-balena-pi4

Next log into balena cli

balena login

Choose "Authetication Token" from the list. This will ask you to enter the token you grabbed from balena cloud website. Paste and hit enter. You should receive successful login message.

Screen Shot 2020-07-22 at 11 45 08 AM

Next, issue below commands one by one

chmod +x build.sh
./build.sh
balena push helium_diy_hotspot_pi4

Please note - the command is balena push <application_name>. If you have used different name in step 1, then use that.

If everything goes fine, you will see a nice unicorn :)

Screen Shot 2020-07-22 at 11 54 55 AM

And in few minutes, both gateway and miner will be distrubuted to your device. You should see some logs like. Now if you have a LoRa node, test it out.

22.07.20 12:05:36 (-0400)  gateway  INFO: [up] PUSH_ACK received in 0 ms
22.07.20 12:05:40 (-0400)  gateway  INFO: [down] PULL_ACK received in 0 ms

Screen Shot 2020-07-22 at 12 04 04 PM

How to enable GPS (Optional)

GPS is not a hard requirement to run your DIY hotspot. So you may entirely skip GPS setup. Make sure in global config JSON file GPS is set to false.

You need to activate UART and modify dtoverlay varible. Go to "Device Configuration" tab from left menu and modify dtoverlay value to pi3-disable-bt and activate UART.

Screen Shot 2020-07-30 at 1 53 11 PM

Troubleshooting

  • If you are not on Mac, you may see some issue running build.sh file. If so , remove '' from sed command.

  • If you are on Windows and are unable to build the run the bash script 'build.sh':

    • First check the sed version using the command sed --version
    • If GNU sed version 3.02 is the version installed it wont support the -i option for sed, so update to the latest version of sed and try running it.
    • Or replace the contents of the 'build.sh' file with the following one:
    
    cp docker-compose-template.yml docker-compose.yml 
    export MINER_TAG=$(curl -s 'https://quay.io/api/v1/repository/team-helium/miner/tag/?limit=100&page=1&onlyActiveTags=true' | jq -c '[ .tags[] | select( .namecontains("arm")) ][0].name' | cut -d'"' -f2)
    sed.exe s/MINER_TAG/$MINER_TAG/g docker-compose.yml > docker-temp.yml
    cp docker-temp.yml docker-compose.yml
    

How to upgrade miner

Execute below commands from the repo. This will fetch the latest miner image from the hub.

rm docker-compose.yml
./build.sh
balena push helium_diy_hotspot_pi4

Dashboard

Open your browser and navigate to http://<Your_Device_IP>. This is work in progress. You will see some useful metrics and can download swam key easily for backup.

Screen Shot 2020-08-04 at 3 20 13 PM

Special Thanks

I like to thank Marc from Balena and PastaGringo. They are the creators of the multi conatiner docker images which I reused.

References

  • Helium Developer Website hotspot
  • Balena Multi-container link