How to build a RFLink 433MHz radio smarthome gateway for €10.50. Test with Domoticz

rflink rfxcom domoticz jeedom superheterodyne rbx6 ksa6

RFLink is an open source project that allows to realize a gateway between a home automation software and home automation modules that communicate by radio waves. It is a very economical alternative to the well known commercial RFXCom gateway. RFLink is capable of managing frequencies 315, 433, 868, 915MHz and recently 2.4Ghz using nRF24L01 + modules. RFLink is developed by the Dutch company Nodo.

And why not a mini RFLink gateway?

You can also read this tutorial that explains how to make a mini version of the RFLink gateway using an Arduino Mega 2560 Pro Mini from the Chinese manufacturer RobotDyn. If you have a 3D printer, you will find the STL files of the box to be printed in 3D.

What can be done with a Gateway RFLink

The Nodo team has been working on this project for several years now and is constantly adding new hardware supported by the gateway. If you have modules compatible with the firmware of the RFLink, you will be able to receive the frames of the latter (status, data …) and display them in your home automation software. You can also transmit frames from your home automation software and thus control the actuators by radio waves. The R43 version supports an impressive list of hardware in all domains (the complete list is available here). Here is a quick overview:

Compatible radio equipment: choose a quality receiver

To make an RFLink gateway, Nodo recommends (having all of them tested a priori) to use a quality radio module to ensure a good transmission / reception of the packets. Low-cost Asian modules are not recommended (although they may be suitable for testing or short-range use). For my part, I opted for a Super Heterodyne module RXB6 which costs about €5,30.

Radio Module Caractéristiques
rflink domoticz jeedom aurel tranceiver rtx-mid-5v Aurel RTX-MID-5v Frequency: 433,92 MHz

Sensibility: +10/-106dBm

Consumption: 13mA

rflink rfxcom domoticz jeedom superheterodyne rbx6 ksa6 SuperHeterodyne RXB6 or KSA6 Frequency: 433,92 MHz

Sensibility: -116dBm

Consumption: 6mA

Certifications: CE / FCC

rflink-domoticz-jeedom-syn480r SYN480R (receiver)

SYN115 (transmitter)

Frequency: 433MHz

Sensibility: -107dBm

rflink nrf24l01 nRF24L01+ PA LNA (with antenna)

Adaptor with power supply  (better)

Frequency: 2,4GHz

Transmitter

315mhz xd-fstIf you wish to order home automation devices, you will also need to add a radio transmitter. For the frequency 433MHz, Nodo does not anticipate anything special. The low cost XD-FST modules FS1000A seems to fit perfectly and cost almost nothing (about €1,70). On the other hand the receiver will be of no use.

Remaining equipment required

The RFLink firmware is too large to run on a conventional Arduino R3. It is for this reason that you will have to acquire an Arduino Mega 2560. An Arduino Mega clone may also be suitable. The Arduino Mega is a little more bulky than an Arduino R3. There are also more compact clones (but I have not tested yet). The advantage for Nodo to have opted for a Mega 2560 is the large number of input / output. Rather than having to configure the firmware according to the radio module used, this firmware sends the packets of signals to be sent to all antennas connected to the Arduino.

To improve the reception of your gateway, it is preferable to add an external antenna with SMA connector. To start, you can take a simple piece of copper recovery 17cm long. A 1.5mm2 cable can do the trick.

Production cost

Here is the average manufacturing cost, without a housing or external antenna (a simple 17cm copper cable).

Matériel Material selected for this article Price
Arduino Mega 2560 Arduino Mega2560 clone €6,74
Radio module 433MHz (transmitter) Superheterodyne RXB6 €1,10
Radio module 433MHz (emitter) XD-FST FS1000A €1,69
Breadboard 400 points €1
Antenna Copper cable
Approximate total €10,50

To make a more compact gateway, we can also opt for a clone of Arduino Mega 2560 Pro Mini. Follow this tutorial to make a mini version with a box by 3D printing.

Wiring of radio modules

The wiring is very simple. The radio modules only require 5V power, grounding and wiring of the data output. If you opt for an external antenna (note that it is not available on all modules), it will be necessary to wire the +5V, GND and ANT (the antenna)

Nodo has listed the wiring of modules supported by RFLink. Here is a summary table taken from the blog of Nodo.

Module Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 Pin 9 Pin 10

Aurel RTX MID 5V

Antenna GND Mega/Pin 14 (TX) Mega/Pin 15 Mega/Pin 22 GND Mega/Pin 19 (RX) Mega VCC (100nf to GND)

Super Heterodyne RXB6 ou KSA6

Antenna Mega/Pin 16 (RX VCC) Mega/Pin 19 (RX) GND

SYN480R

VCC Mega/Pin 19(RX) GND Antenne

Qiachip WL101 + WL102

Antenna  GND VCC (3 to 5V) Mega/Pin 19 (??) Mega/Pin 19 (??)

NRF24L01 (Nodo) for sensors

 GND  VCC (max 3.6V) CE : +3V (max. 3,6V)  CS : Mega/Pin A12  SCK : Mega/Pin A15 MOSI : Mega/Pin A13  MISO : Mega/Pin A14  IRQ : –

NRF24L01*

GND VCC (max 3.6V) CE : Mega/Pin 48 CS : Mega/Pin 49 SCK : Mega/Pin 52 MOSI : Mega/Pin 51 MISO : Mega/Pin 50  IRQ : –

XD-FST FS1000A

GND VCC : Mega/Pin 15 Data : Mega/Pin 14

* Wiring for MiLight and MySensors objects.

It is possible to cable two antennas nRF24L01 (Nodo / MiLight – MySensors) in order to benefit from two protocols at the same time.

Note. At the moment, RFLink can not be used as a MySensors gateway. The gateway is capable of receiving messages but is unable to send messages to a node. This function is reserved for learning and development. It can be used as a sniffer, for example.

Nothing very complicated wiring side, here is what it gives with a radio module 433MMhz Super Heterodyne.

Upload Firmware

To install the RFLink firmware, Nodo has developed a small utility called RFLinkLoader. So we will not go through the Arduino IDE. Go to the Sourceforge page to retrieve the compressed file from the project. The RFLInk firmware is now hosted on a google drive. You have to go to the Nodo blog to download the latest version (or an old one in case of problems).

rflink-sourceforge

The ZIP file contains (among other things) the following:

  • The RFLink firmware, RFLink.cpp.hex file,
  • RFLinkLoader
  • Avrdude (required to install the firmware on the ATMEL chip)
  • RFLink Protocol Reference: Explanation of the protocol for receiving and sending messages with examples for common devices
  • Supporter Device List: a complete list of supported devices, also available here.

rflink contenu zip firmware

What can you do with RLinkLoader?

RFLinkLoader first allows you to install the firmware on the Arduino Mega 2560 (RFLink.cpp.hex file). Since the gateway supports 2.4GHz modules, one has to go through the loader to activate the NodoNRF mode to use sensors based on nRF24L01 +. If you want to use Mi-Light bulbs, you will also need to activate the MiLightNRF mode from the Loader.

Installing the firmware

Connect the Arduino Mega 2560 to the USB port and start the RFLinkLoader program. Open the file selector and specify the path to the firmware (RFLink.cpp.hex file). Check that the Arduino Mega is well recognized and offered in the Serial Port combo. Start downloading from the Upload / program Firmware to device button. The operation does not last very long. The software will inform you of the end of the operation via an information box.

rflink console port serie log

First test

We will now do some testing to find out how the RFLink gateway works. I used a (old) Phoenix remote control socket that allows me to control the on / off of a lamp as well as an old X10 motion detector. We will see in future tutorials how to communicate with newer devices. The principle remains the same.

Turn on the console by pressing the Serial Port Logging button. By enabling Debug mode, you will have more detail about receiving messages. The other solution is to use the log (log) of Domoticz. We’ll see how to do it a little further.

Interception of messages sent by the Phoenix remote control

By pressing the ON button on the A plug, the following code is obtained

20;1;TriState;ID=0000aa;SWITCH=0;CMD=ON;

Then, OFF

20;2;TriState;ID=0000aa;SWITCH=2;CMD=OFF;

flink reception messages commandes on/off telecommande phenix

Interception of presence detection by a detector X10 MS13E

The Marmitech MS13E detector to the standard X10 is no longer marketed today but as we will see, it can still very easily use it with a recent home automation software without the slightest difficulty. The idea of this article is to build a 433MHz gateway and discover it, the MS13E is perfectly suited.

The MS13E has two HOUSE / ON and UNIT / OFF buttons. Pressing HOUSE / ON simulates the detection of a presence. The following message is retrieved

20;1;X10;ID=41;SWITCH=1;CMD=ON;

Then, OFF

20;1;X10;ID=41;SWITCH=1;CMD=OFF;

How to decode incoming and outgoing messages

Let us now see what these messages mean. Each message is formatted. Each element is separated by a semicolon (;).

Message received

Position Element Signification
1 20 Order type 20 for receiving

10 for emitting

2 1 NA
3 X10 Protocol Name Name of the protocole. Here X10.
4 ID=41 Device Address Device ID, in hexa
5 SWITCH=1 Button Number Command number
6 CMD=OFF Action Action to make, for example ON/OFF/ALLON/Level…

Transmitted messages

To send a message, you pass the parameters directly in any label. for example 10;X10;000041;1;OFF;

Position Element Label
1 10 Emit
2 X10 Protocol Name X10 protocole
3 000041 Device Address Device ID
4 1 Button Number Button 1
5 OFF Action Turns off the appliance connected

If you need to know in detail how the RFLink gateway works, go to this page.

Connect the RFLink gateway to Domoticz (on a Raspberry Pi)

It is high time to test the gateway on a home automation software and more particularly on Domoticz. No plugin is required. Domoticz accepts RFLink USB or network gateways. For this article, I used Domoticz on a Raspberry Pi 3. As the gateway is powered by the USB port of Raspberry, opt for a power supply of at least 3A like this one. If your RPI stops unexplained, this is the primary cause of the problem in general.

The article was written with version v3.4838 of Domoticz.

Warning. Make a backup of your SD card and / or the Domoticz database before installing an RFLink Gateway.

If you’re starting out (Linux, Domoticz, SSH), here’s a series of articles to read before you start:

Find the USB port on which the gateway is connected

There are no particular problems with installing the gateway. However, if you have multiple devices connected via USB, the risk of misleading is important. Small problem, Domoticz is allergic to a USB declaration error.

Connect to your Pi in SSH or live and run this command to stop the Domoticz service

sudo service domoticz.sh stop

Connect the RFLink gateway to a USB port on the Raspberry and run the command

dmesg -s 1024

rflink dmesg -s 1024 port usb gateway rapsberry pi3

In my case, the Arduino Mega 2560 of the gateway is connected to the USB port ttyACM0.

All you have to do is restart the Domoticz service with the command

sudo service domoticz.sh start

Adding RFLink hardware

Go to Settings then Hardware then:

  • Give a name,
  • In the Type list, choose RFLink Gateway USB (or Network)
  • Do not indicate any waiting times
  • Choose the serial port on which the Arduino is connected
  • Save

Adding a radio device

There are several ways to add material. In any case, as soon as a signal is decoded by RFLink, it is transmitted to Domoticz which adds it to the list of devices.

If your device has buttons (for example, a remote control, a test mode for a presence or smoke detector), press the button. The device will then be directly added to the list of Domoticz devices. It is added as usual using the green arrow.

rflink x10 détecteur mouvement motion sensor ms13e

You can also manually add the device from the Switches page with the auto detection feature (on the right side of the screen). Domoticz is listening to commands sent by the devices.

If no hardware is added to the devices, check in the settings that Domoticz accepts the new hardware.

domoticz-activer-decouverte-materiels-auto

Now you have a radio gateway capable of receiving or transmitting to devices operating at 315, 433, 868MHz or 2.4GHz. Although RFLink remains an Open Source project, a very large number of devices are supported. The budget of realization (without box or antenna) is very reasonable (about 10 €) compared to the box RFXcom which costs about 110 €. In the next articles we will see how to make the RFLink a little sexier and more pro by putting it in a nice box with an antenna.

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

  • El_Consul

    Great article!

    Note that the link to the transmitter goes to a 315MHz transmitter and not 433Mhz… is that on purpose?
    https://www.banggood.com/315MHz-XDFST-XDRF5V-Wireless-Transmitter-Receiver-Module-p-925524.html

    I am concerned because when looking at the product it only says “Working frequency: 315MHz” and doesn’t mention 433MHz.

    • Thank you very much Oh, I’m really sorry for the mistake. This is modified http://s.click.aliexpress.com/e/F6UrjMR

      • El_Consul

        No need to apologize 🙂

        I think it’s great that you have taken the time to go through this with so many details… so thank you!

        PS. I have a question that I will post in another thread

  • El_Consul

    I find this article very useful since buying a RFCom or a RFLink kit from nodo-shop is expensive.

    When
    looking at those products and your article it looks like that the
    antenna is something that will be needed and it would be smart to be
    ordered all together with the rest (specially with the very long
    delivery times from Ali). You suggest the “nRF24L01+ PA LNA (with
    antenna)”.

    As a newbie on this matter I cannot figure
    out how this part fits into the setup. Is it something that replaces
    one of the other parts (i.e. the transmitter and receiver) or is it an
    add-on to the assembled prototype and somehow connected to the receiver and transmitter antenna pin?

    And as important… were/how do you connect the “nRF24L01+ PA LNA (with antenna)” to the prototype?

    I understand if you don’t answer this since it is out of scope but… it would be great if you could 😀

    Once again, thank you for a great DIY!!!

    • Thank you very much. RFLink is a more versatile gateway than RFXCom. It supports several radio frequencies. Simply add the transmitters and receiver in the frequency that one needs. As for nRF24L01, it will allow to communicate with Xiaomi MiLight or Ikea. I tested many models for my own editing and got the best results. I noticed everything in this article https://diyprojects.io/mysensors-v2-increase-range-nrf24l01-hardware-configuration/. Well, I hope everything will work for you. See you soon

  • El_Consul

    Hi

    After some months of waiting I finally got a lot of different components and have been playing around and learning how everything works. Your guide is perfect for the purpose… thank you!

    As a newbie the images are very impportant and I would like to point out something a little bit confusing. On your “…superheterodyne-domoticz.jpg” image with the SuperHeterodyne KSA6 and the Arduino MEGA you have pinned them as follows:
    * KSA6 PIN 6 => MEGA tx2/Pin 16 (RX VCC)
    * KSA6 PIN 7 => MEGA rx1/Pin 19 (RX Data)

    I don’t understand why you pin the PIN 6 as you do. As far as I can see the PIN 6 shouldn’t be connected at all (www.rflink.nl/blog2/wiring). At most it should be PIN 5 => PIN 16 though I prefer as you have done

    and connected PIN 5 to VCC.

    https://uploads.disquscdn.com/images/614a6d879e4b4f208cbedd43a46fa6528bf12f39f4977e6c00b5297b399d5c0f.png

    • Hello El Consul. I thank you very much. I test 100% of the circuit and codes but sometimes it can remain errors: D. I just checked my editing (it is right next to me since writing the tutorial). The wiring is correct. It may be an error after updating the blog rflink or firmware. Have a good day

  • Robert Coemans

    Hi, great tutorial but unfortunately the project is no longer available on Sourceforg. Any ideas where the .zip containing the project files can be obtained?

    • Hello Robert. You have to go to the Nodo blog to download the latest version now. the firmware is hosted on a google drive now http://www.rflink.nl/blog2/download

      • Robert Coemans

        Hi, tx a lot for the quick and helpful response. Have already downloaded the firmware and can’t wait to start working on this fantastic project.

        • Thank you very much Robert, you’re right!

  • Michał Sałak

    What module do you suggest for 868 mhz?

DIY Projects