Generic firmware

Tip

You might want to read this document on our documentation space, all inline links will be working there.

Introduction

A flexible software breadboard for sensor-, transceiver- and gateway-nodes transmitting telemetry data in radio link environments. The firmware (config.h, generic.ino) is based on the fine RadioHead and BERadio C++ libraries as well as a bunch of other ones.

Note

This is currently a work in progress, as of June 2016.

Synopsis

RF multi-hop yak shaving.

// Synopsis of the Hiveeyes generic firmware
digraph generic_firmware_synopsis {

    // Options
    rankdir=LR;
    ranksep=0.5;

    // Style
    //graph [splines=ortho];
    node [pin=true, shape="box", fontname="Verdana"];
    edge [fontname="Verdana"];

    // Graph nodes represent hardware node units
    "sensor-1"      [label="Sensor node 1"];
    "sensor-2"      [label="Sensor node 2"];
    "sensor-N"      [label="Sensor node N"];
    "transceiver"   [label="Protocol transceiver node"];
    "gateway"       [label="Gateway node"];
    "soc"           [label="SoC machine", style=dashed];

    // Graph edges represent radio families and
    // protocols spoken between node units.
    "sensor-1"      -> "transceiver"    [label="RFM69"];
    "sensor-2"      -> "transceiver";
    "sensor-N"      -> "transceiver";
    "transceiver"   -> "gateway"        [label="RFM95\n(LoRa)"];
    "gateway"       -> "soc"            [label="UART", style=dashed];

    // Draw a dotted line between sensor-2
    // and sensor-N, but retain node positions.
    "sensor-2"      -> "sensor-N"       [dir=none, style=dotted];
    {rank=same; "sensor-1"; "sensor-2"; "sensor-N" };

}

This firmware can satisfy different purposes:

  • A sensor node collects sensor data, encodes it with BERadio and sends it through a RFM69 radio module to a gateway node or a protocol transceiver node.
  • A protocol transceiver node receives radio signals on RFM69 and emits them to RFM95 (LoRa). The messages are processed opaque, no decoding takes place here.
  • A gateway node receives RFM95 (LoRa) radio signals and emits the payloads to its UART interface connected to the gateway SoC (e.g. a RaspberryPi) running the BERadio forwarder.

The BERadio forwarder will decode the data according to the BERadio specification and forward it to the MQTT bus serialized as JSON dictionary, all of which is beyond the scope of this MCU code.

Workbench

Three nodes, each running the "generic" firmware in different roles.

Three nodes, each running the “generic” firmware in different roles:

  • A sensor node emitting telemetry data via RFM69 (left)
  • A transceiver node receiving RFM69 and emitting RFM95 LoRa (middle)
  • A gateway node receiving RFM95 LoRa and sending it to the UART interface (right)
Three picocom instances connected to each of the three networked nodes.

Three picocom instances connected to each of the three networked nodes.

Build

Build on your workstation

# Get hold of the source code repository including all dependencies
git clone --recursive https://github.com/hiveeyes/arduino

# Select this firmware
cd generic

# Select appropriate Makefile
ln -s Makefile-Linux.mk Makefile

# Build firmware
make

# Upload to MCU
make upload

Note

You might want to adjust the appropriate Makefile to match your environment.