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.
- 1 And why not a mini RFLink gateway?
- 2 What can be done with a Gateway RFLink
- 3 Compatible radio equipment: choose a quality receiver
- 4 Transmitter
- 5 Remaining equipment required
- 6 Wiring of radio modules
- 7 Upload Firmware
- 8 First test
- 9 Connect the RFLink gateway to Domoticz (on a Raspberry Pi)
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:
- Light Bulbs MiLight (2.4GHz),
- Flap opening control,
- Power consumption
- Smoke detector or fire detector,
- Motion detector,
- Switches and dimmers,
- Door or window opening,
- Weather stations and weather sensors,
- Monitoring of energy consumption,
- Remote controls with code learning
- Sonoff 433-wifi bridge
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.
|Aurel RTX-MID-5v||Frequency: 433,92 MHz
|SuperHeterodyne RXB6 or KSA6||Frequency: 433,92 MHz
Certifications: CE / FCC
|nRF24L01+ PA LNA (with antenna)
Adaptor with power supply (better)
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.
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|
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.
|Arduino Mega 2560 Pro Mini 5V with integrated CH340 FTDI converter||€7,95|
|Superheterodyne RXB6 ru KSA6 433MHz receiver + transmitter||€4,85 (with transmitter)|
|XD-FST FS1000A transmitter (optional if not included with receiver)||€2,80 (optional)|
|Mini breadboard (170 points)||€0,35|
|Jumper Dupont mâle-mâle de 10cm||1,30€|
|Female SMA PCD connector compatible with breadboard||€0,85|
|433MHz 6dBi (or more) antenna with SMA connector||€3,90|
|Approximate total amount||€19,20|
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|
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 : –|
|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 : –|
|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.
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).
The ZIP file contains (among other things) the following:
- The RFLink firmware, RFLink.cpp.hex file,
- 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.
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.
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
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
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 (;).
|1||20||Order type||20 for receiving
10 for emitting
|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…|
To send a message, you pass the parameters directly in any label. for example 10;X10;000041;1;OFF;
|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.
If you’re starting out (Linux, Domoticz, SSH), here’s a series of articles to read before you start:
- How to install and configure Domoticz on a Raspberry Pi 3 or 2
- Useful Unix commands
- How to connect Raspberry Pi with SSH
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
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
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.
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.
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.
- Xiaomi Mijia Honeywell Smoke Detector Test with Domoticz, Emergency Notification with PushOver
- Xiaomi Aqara now compatible with Apple Homekit, new Vibration Sensor and Honeywell Natural Gas Detector
- #Test Zigbee2MQTT gateway. Part 2, include Xiaomi Aqara or Mijia accessories to Domoticz with Node-RED [update]
- #Test Zigbee2MQTT project, hack of the Xiaomo Aqara Smart Home Gateway. Part 1: assembly, demo with Node-RED, 3D printed case [update]
- The diyprojects application also available on iOS and Android, first mobile project with Ionic 3
- #Deal: Xiaomi Mijia Honeywell Gas Alarm, Methane Detector