Custom Arduino Shield that provides MQTT to Rflink

Since a couple of years, I used to use a french home automation box : the Zibase. In its time, it was the only one to support a large number of protocols and to allow a some degrees of freedom (xml output, UDP access). I even wrote a binding for Openhab. But even with OpenHab, the box still needs a dedicated cloud service to register some peripherals, and nowdays, the number of supported protocols seems pretty limited compared to Rflink.

So, I decided to build my own Rflink box, including an homemade “all-in-one” arduino shield that provides Rf modules and serial to MQTT/Json converter for Rflink messages.

Source code is available on github :
3d enclosure is available on thingiverse :

Rflink runs on an arduino mega (2560) and need some easy to find RF modules. You can even found shields that work out-of-the-box.

The problem is that Rflink output is plain text over serial. As I wanted something more easy to broadcast and decoupled from my automation server (OpenHab), I chose tcp/ip for the transport layer, and json for the message format (simple to parse and human readable). Thus, MQTT seemed to be the easiest protocol to use.

For now, my Rflink box only support 433 Mhz protocols, but I’m planning to add 868 Mhz.

Hardware build

Used parts

  • Arduino Mega 2560 (Rflink)
  • RBX6 as 433 Mhz receiver
  • The cheap and well known XD-FST FS1000A for transmitting
  • An external high gain Antena for very good reception (the most critical thing)
  • An internal spring antenna to improve orders sending
  • One SMA connector
  • An Arduino nano for the Serial to MQTT/Json convertion
  • A mini W5100 ethernet shield for TCP/IP transport
  • 2 prototypes PCBs 
  • Male Pin headers

Build steps

Prepare the shield with prototype PCBs and pin header:


Then start adding and soldering components on the shield:


Finaly, wire and solder everything:


The shield can then be mounted on top the the Mega (the nano is powered by the Mega from the 5V-out pin to the nano’s V-in. Cable is only used for debugging / programming purpose on the nano)


Note that detailed instructions can be found on Rflink website for Rf modules and everywhere on the internet for Arduino nano and w5100 module.


3D printed enclosure

Because the “wife compliant” property does always mater for homemade devices, a nice enclosure is a must… Here are photos of the box that host my Rflink+Shield package.

Serial to MQTT/Json converter

The arduino sketch is available on github :

It runs on an arduino nano / uno. Mine is running since more than 30 days now, 3 to 5 messages per seconds without any problem.

The goal was to make the sketch as fast as possible regarding the serial to json translation. This translation can be seen in Rflink.cpp, function readRfLinkFields(). Basicaly, it does a string copy with some modifications while copying in order to create a valid json string on the fly:

The whole code is optimized to use the program memory as much as possible.

Example of output with mosquitto:


Note that for incoming messages, this sketch acts as a pure Ethernet gateway. That is to say, any message published on the configured channel will be caught and sent as a plain serial message to Rflink.

Usage example with OpenHab

First, Openhab must be able to subscribe to your mqtt server (mosquitto in my case). I used the addon “org.openhab.binding.mqtt” and named the mqtt instance “mosquitto”

The previously seen Oregon temperature and humidity sensor (ID “2D27”) can then be used with some items :


Another example, this time to send an order to a Chacon DIO switch with RFlink:

As you can see the mqtt message is a plain text message as you would send it to Rflink through a serial connection :


One comment

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.