Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Latest commit

 

History

History
209 lines (132 loc) · 8.9 KB

developer-setup.md

File metadata and controls

209 lines (132 loc) · 8.9 KB

Build a Hotspot

{% hint style="danger" %} You are about to build a Hotspot that will not mine HNT.

The ability to mine HNT with a 3rd party gateway is not yet supported. Please join the Helium Discord Server and the #hotspot-diy-hardware channel for the latest updates on the roadmap.

Once again, if you build a DIY Hotspot, it will only route Helium LoRaWAN Packets. It would not earn HNT. {% endhint %}

Helium's Miner Architecture

{% hint style="danger" %} You are about to build a Hotspot that will not mine HNT.

The ability to mine HNT with a 3rd party gateway is not yet supported. Please join the Helium Discord Server and the #hotspot-diy-hardware channel for the latest updates on the roadmap.

Once again, if you build a DIY Hotspot, it will only route Helium LoRaWAN Packets. It would not earn HNT. {% endhint %}

To be a Helium Miner, there are three principle components to know about

  • Packet Forwarder: this is a utility that interacts with the radio front-end and sends and receives raw radio packets with the Helium Miner
  • Miner: the Helium Blockchain comes into the picture here; the Miner is responsible for routing packets to the appropriate Router (see our Routing article) entering into microtransactions brokered via libp2p
  • Router: a Helium compatible LoRaWAN Network Server, basically; this component is interested in receiving the packets relating to its devices and handles downlink responses when appropriate

When you buy a Helium Hotspot, you are buying a Packet Forwarder and a Miner in a convenient package:

In this guide, we are going to do something a little different. We are going to decouple the Packet Forwarder and the Miner from one another from a hardware standpoint. This allows you to use almost any LoRaWAN Gateway on the Helium Network while also reducing the bandwidth and hardware requirements of the gateway hardware.

And rest assured, while this guide uses Amazon AMI images to makes Miner deployment more or less plug-and-play, we are working on a Docker container version which will make it easy to not only run other Cloud Service providers, but your own server hardware or perhaps even your own gateway if the hardware is sufficient.

{% hint style="warning" %} This guide is experimental and for advanced users only, and you may run in to various issues trying to get this working. We eventually intend to make it possible for LoRaWAN gateways of any kind to connect to our cloud-hosted Console directly without needing to follow these instructions. {% endhint %}

Example Custom Hardware

Any hardware that can run an 8 channel LoRa front-end (such as SX1301 or SX1302) and send and receive packets using the Semtech UDP Protocol can be used to participate in the Helium Network.

If you don’t have your own hardware yet, we recommend using a Raspberry Pi 3B+ or 4B running the latest Raspian Buster image with a RAK2245 Pi Hat installed, and a recommended 64GB SD card.

If you already have hardware, we may just have a guide for your LoRaWAN Hotspot already. In general, it is possible to use any LoRa gateway that can run Semtech's packet forwarder application and run the miner application on a separate host.

This README will assume a Raspberry Pi 3B+/4 with 1GB RAM + RAK2245 combination described above. This combination is available as a packaged product directly from RAK called the Pilot Gateway.

There are three distinct applications required in order for the Hotspot to send and receive LoRaWAN packets and route them to the correct internet hosted destination - Miner, packet_forwarder, and lora_gateway.

Raspberry Pi specific setup

The current tested release is:

Raspbian Buster Lite
====================
Minimal image based on Debian Buster
Version:September 2019
Release date:2019-09-26
Kernel version:4.19
Size:435 MB

The default Raspian image has a small swapfile of 100MB, which on a Pi with 1GB or less of RAM is insufficient for building some of the dependencies, such as RocksDB. To increase the swap size, first stop the swap:

sudo dphys-swapfile swapoff

Edit the swapfile configuration and change the size of the swapfile:

sudo nano /etc/dphys-swapfile

Edit the CONF_SWAPSIZE line so that it reads as follows:

CONF_SWAPSIZE=1024

Save the file and exit by pressing ctrl-x, then reboot:

sudo reboot

Next, enable SPI and I2C using the raspi-config tool:

sudo raspi-config

Select Interfacing Options, and enable I2C and SPI from within the menu system. Additionally, set Serial options to disable "login shell to be accessible over serial" and enable "serial port hardware".

Now let's go ahead and update our install with:

sudo apt-get update

Installing the Semtech packet forwarder

Once you have miner running, you'll need the Semtech packet forwarder to receive packets via SPI and the RAK2245 board and deliver them to the miner via UDP.

You may need to install git:

sudo apt-get install git

Clone the git repository:

$ cd ~
$ git clone https://github.com/Lora-net/packet_forwarder
$ git clone https://github.com/Lora-net/lora_gateway

We'll then need to replace the existing packet forwarder configuration file with a Helium-specific version:

$ cd packet_forwarder/lora_pkt_fwd
$ wget https://helium-media.s3-us-west-2.amazonaws.com/global_conf.json --backups

Make sure that the file was downloaded to the packet_forwarder/lora_pkt_fwd/ directory. This will be important when launching the binary.

This new file sets the correct radio frequencies for the US region. Note that this backs up the existing configuration file (with European frequencies) to global_conf.json.1.

If you are using the SX1302, configuration files for many regions may be found here.

One Quick Change

We need to modify the SPI speed for this particular RAK concentrator. You may not have to do this with different concentrators. To do that:

cd ../.. && nano lora_gateway/libloragw/src/loragw_spi.native.c

And modify line 56 to read:

#define SPI_SPEED       2000000

Now we are ready to build.

Compiling the Packet Forwarder

Compile the packet forwarder:

$ cd packet_forwarder
$ ./compile.sh

Before we can start the packet forwarder you will often have to issue a reset command to the RAK concentrator. In most cases you have to issue this command every time before starting the packet forwarder. This resets the concentrator using GPIO pin 17 of the Raspberry Pi, which is connected to the reset pin on the concentrator:

../lora_gateway/reset_lgw.sh start 17

We can now start the packet forwarder:

$ cd ~/packet_forwarder/lora_pkt_fwd
./lora_pkt_fwd

Note that we are doing from ~/packet_forwarder/lora_pkt_fwd ; this is important for finding the configuration file downloaded previously.

That's it, now you're running a packet forwarder! The last step is connecting to a Helium Miner.

Connecting to a Helium Miner

If you haven't done it yet, you'll want to get your Helium Miner running. We'll assume you've done this with an Amazon AMI for the sake of this tutorial.

From Your EC2 dashboard, you should select your miner and take a look at the description at the bottom of the page:

Extract IP Address

In this case, the IP is 18.218.135.176. You now have to go back edit the packet forwarder's configuration such that it connects to you Miner on AWS.

With your favorite editor, open packet_forwarder/lora_pkt_fwd/global_conf.json:

nano packet_forwarder/lora_pkt_fwd/global_conf.json

You want to change the field "server_address" from "localhost" the the IP address of my server, so in this case:

"server_address": "18.218.135.176",

You'll need to restart the packet forwarder for the configuration change to take effect. To verify that things are working, you can follow the logs on the AWS instance:

tail -f /var/log/miner/console.log | grep lora

At the very least, you should see PULL_DATA messages every few seconds. If so, then you've done it!