• GitHub
  • Community
  • Network
  • Introduction
  • Device

LongFi Arduino Quickstart Guide


Helium’s LongFi architecture combines LoRaWAN and the Helium blockchain to create a wireless peer-to-peer network for low-bandwidth IoT applications.

This guide will show you step by step how to transmit LoRaWAN packets using a longfi-arduino sketch on an STMicroelectronics B-L072Z-LRWAN1 Discovery kit.


Before we begin, please make sure you've followed the steps from this guide, which goes over some initial setup steps.


In this guide, you will learn:

  • How to setup your environment (Add STM32 board support to Arduino and STLink debugging utility)
  • How to build and program a basic application that will send packets on the Helium Network
  • Verify real time packets sent to a Helium Hotspot on Console.

For this example, you’ll need the following:



Hardware setup

The build for this project is easy! You’ll just need to install the included antenna.

We'll be using the ST-Link debugger on the Discovery board, so you'll want to connect the micro-USB B connector to the micro-USB port labeled CN7 USB STLINK.

That’s it for the hardware setup! Next we will setup your environment. We will be using the Arduino IDE.

Getting the Arduino IDE

Download and install the latest version of Arduino IDE for your preferred OS.

Add STM32 board support to Arduino

Instructions to add STM32 board support to Arduino

Install MCCI LoRaWAN LMIC Library

The MCCI LoRaWAN LMIC Library library may be installed from the Arduino IDE

Arduino IDE:

Sketch -> Include Libraries -> Manage Libraries

Search for MCCI LMIC and install the latest version of MCCI LoRaWAN LMIC Library


If you have already installed the MCCI LMIC library, please make sure to check for updates

LongFi Example Sketches

There is an example sketch included in the LongFi repository.

Create a new sketch and copy the source code over. All you need to do is update the AppEui, DevEui, and AppKey. AppEui (LSB) and AppKey (MSB) are provided from Helium Console after you've created your device:

Be sure to select the appropriate format (LSB/Little-Endian for AppEui and MSB/Big-Endian for AppKey) and copy the information into the sketch:

static const u1_t PROGMEM APPEUI[8]= { 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
static const u1_t PROGMEM APPKEY[16] = { 0xCC, 0x7C, 0xD6, 0x15, 0xA3, 0xCB, 0x9B, 0x5A, 0x3B, 0x55, 0x9B, 0x49, 0x3F, 0x92, 0x43, 0x79 };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}

Note that you can must put some arbitrary data into DevEui; you can use this later in your applications to identify certain settings:

static const u1_t PROGMEM DEVEUI[8]= {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED, 0xFF, 0xFF };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}

Configuring the Arduino IDE for the B-L072Z-LRWAN1 - ST STM32L0 Discovery kit

Instructions to install the board support package can be found here

Arduino IDE:

Select Tools -> Board -> Discovery
Select Tools -> Board part number -> Discovery L072Z-LRWAN1

Programming (Upload Method)

We will use the onboard ST-Link (Flasher/Debugger) to upload this sketch.

Download and install the required utility from ST here

The download comes in the form of a stm32cubeprog.zip file, which you'll need to unpack. After you unzip, you should see the following files:


Installation Requirements

Supported operating systems and architectures

  • Linux 64-bit
  • Windows 7/8/10 32-bit and 64-bit
  • MacOS (minimum version OS X Yosemite)

Software Requirements

Windows Instructions

The download comes with a SetupSTM32CubeProgrammer-[version].exe, which guides you through the installation process.

Linux Instructions

The download comes with a SetupSTM32CubeProgrammer-[version].linux, which guides you through the installation process.

MacOS Instructions

Run the following command:

java -jar SetupSTM32CubeProgrammer-[version].exe

You should use the default installation path.

Arduino IDE:

Select Tools -> Upload Method -> STM32CubeProgrammer(SWD)

Programming your Arduino Sketch

Arduino IDE:

Select Sketch -> Verify/Compile (Ctrl + R)
If there are no errors with your sketch, you should see `Done Compiling`.

Then, you can upload the sketch and program the development board.

Arduino IDE:

Select Sketch -> Upload (Ctrl + U)
Congratulations! You have just programmed your first Helium LongFi application!

However, we are not done just yet. Now let's head back to Helium Console and look at our device.

You should be able to see some packets appear as Live Data.

To learn about routing these packets to an endpoint, check out this guide.

If you've loaded the ButtonTransmit sketch, you can learn about decoding these packets and triggering a service on IFTTT by checking out this guide.