LinkIt Smart 7688 Duo as RFM95 to Wifi-BERadio gateway


The general idea about this setup is to use the LinkIt Smart 7688 Duo as WiFi gateway for the RFM95 radio on the hardware layer and as UART-to-MQTT gateway on the transport layer. Since the 7688 is capable of running LEDE/OpenWrt and Python, BERadio should work out of the box.

The Duo comes with the ATmega32U4 as a realtime processor for the radio. LEDE has AVRDude on board so it can flash the ATmega with .hex files. This is the corresponding boards.txt.

Hardware Setup


LinkIt Smart 7688 Duo

RFM95 radio

Moteino Wireing

Antenna Length:

  • 868.35 MHz 8.64 cm / 3.40 inch


| **7688**  	    | **RFM95W** 	| **ATmega32U4** 	|
| S0 / MISO 	| MISO       	| D14            	|
| S1 / MOSI  	| MOSI       	| D15            	|
| S2 / SCLK 	| SCK        	| D16            	|
| D17           | NSS        	| D17            	|
| D3      	    | DIO0          | D3             	|
| 3V3       	| 3.3V       	|                	|
| GND       	| GND        	|                	|
| GND       	| GND        	|                	|
| GND       	| GND        	|                	|
|           	| ANA        	|                	|

Software Setup



# Get serial console of MCU from within the 7688
$ picocom /dev/ttyS0 -b 57600
# Flash the MCU
$ root@mylinkit:/tmp$ avrdude -p m32u4 -c linuxgpio -v -e -U flash:w:generic.hex

I added this to my board txt

# avrdude boards.txt Smart 7688 Duo


smart7688.bootloader.lock_bits=0x2F"LinkIt Smart 7688 Duo""MediaTek Labs"{build.usb_flags}

To make work we need to provide the pins_arduino.h file for this target and place it in the $ARDUINO_CORE_PATH/hardware/arduino/avr/variants/smart7688 folder. /usr/share/arduino/hardware/archlinux-arduino/avr/variants/smart7688 in my case Archlinux and make it readable (775) for everyone.

$ REV="$(dd bs=1 skip=1043 count=1 if=/dev/mtd2 2> /dev/null)" && echo $REV
# see:
# $ dd bs=1 skip=1043 count=1 if=/dev/mtd2 2> /dev/null
  id    = "linuxgpio";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 3;
  sck   = 15;
  mosi  = 16;
  miso  = 17;

Make sure, that the SPI pins are free for flashing
If you take the next step after wiring on a breadboard, you should consider jumpers between the radios SPI (MISO, MOSI, SCK) and the SPI of the LinkIt. Otherwise the firmware is flashed forever. And you should definitely consider soldering, since it was the only possibility for me to get stable radio receiving.

$ scp bin/generic/smart7688/generic.hex root@he_gateway.lan:/tmp/
$ ssh root@he_gateway.lan

$ cd /tmp
$ avrdude -p m32u4 -c linuxgpio -v -e -U flash:w:generic.hex
$ opkg update && opkg install picocom
$ picocom -b 115200 /dev/ttyS0

You might not getting any output here, which is because the default serial port in the AVR is mapped to Serial1. If you don’t want replace Serial.print() with Serial1.print() you can use the much more ugly but conventional SERIAL_PORT_HARDWARE directive, see: pins_arduino.h. (SERIAL_PORT_HARDWARE.print() …).


Please enjoy this further reading material.

1 Like

RFM95-to-UART forwarding firmware


The Arduino-based firmware running on the ATmega32U4 picks up LoRa radio messages and forwards them verbatim to the UART interface of the AVR MCU without any transcoding involved.

As it is based on the fine RadioHead: RadioHead Packet Radio library for embedded microprocessors, it will work with a wide range of inexpensive FSK/GFSK/ASK/OOK RF transceivers.

Setup, configure and build


UART-to-MQTT gateway software


beradio forward ingests message payloads from an UART interface, sanitizes and decodes them from Bencode format and republishes the data to a MQTT topic, effectively acting as an UART-to-MQTT gateway.


To install the gateway software written in Python, just run

pip install beradio --upgrade

When running beradio for the first time, it will generate two unique identifiers representing the network- and gateway addresses. “beradio info” will display them:

$ beradio info
                  beradio 0.8.1
config file: /root/.local/share/beradio/config.json
network_id:  755af7af-66aa-44f8-9b78-5dc6c2dd5670
gateway_id:  siss4

All data which is forwarded through this gateway will be attributed to the data channel identified by these values.

Running interactively

For running the gateway software, you would use such a command:

beradio forward --source="serial:///dev/ttyS0" --target="mqtt://"

To acquire your personal credentials for accessing the MQTT broker, you might want to read how to get your MQTT credentials or get in touch with us. Finally, you can find your dashboard on the The Hiveeyes Platform.

Running as service

If the software works for you, you might want to run it as a system service on your machine. The BERadio sources contain a blueprint for an old-style init script for OpenWrt/LEDE, called beradio.init. When you are actually running BERadio on a Debian-based distribution, the beradio.service systemd unit file might fit better for you. You will find appropriate installation instructions inside these files.

Please make sure to amend the --target=mqtt:// parameter to match your environment before starting the service. To send data to the collaborative platform, please use --target=mqtt:// after requesting appropriate credentials from us.


If you encounter problems when installing or running BERadio, please consider having a look at Development of the BERadio RFM-to-MQTT gateway software or just get back to us.