Accéder au contenu principal

SONOFF RF BRIDGE with custom firmware

From an user request I took a look into the RF SONOFF Bridge, a quite interesting device from SONOFF. It is able to send and receive 433mhz signal with a very competitive price of less than 10€.

I already own several SONOFF Smart switches on which I loaded custom firmwares with success. One is working since months perfectly!

Here is how the RF bridge looks inside:




First thing I used to do when I launch some new development is to check the state of the art, as we often say google is your friend. And by searching the compatibility between the bridge and RCSwitch library (the main RF library of OpenMQTTGateway) I fall into the very good work of Xose Pérez (Tinkerman)
http://tinkerman.cat/hacking-sonoff-rf-bridge-433/
He ported successfully its ESPURNA code to the Sonoff RF Bridge.

After following its instructions and some mistakes from me (be careful about choosing the good line of pins on the bridge for your FTDI connectors :-( and choose the following parameters except the port) I successfully uploaded some code into the bridge


Please note that the bridge use an ESP8285 and not an ESP8266.

After some modifications I integrated it into OpenMQTTGateway.

I tested it with my switch plugs  and also with cheap door sensors with success.

The received 433mhz code is published to MQTT well:
home/SRFBtoMQTT 267A013603B6140554

My only concern is that the data received by MQTT sometimes vary from the same device or button. For a wall plug you need to try the different values received before getting into the one that will work on your device.
For a door sensor or a PIR it is more complicated because if you use a code to trigger your home automation and this code is not always the one that you receive from the same device.

Here is two examples of received raw values from the same device:
home/SRFBtoMQTT 267A013603B6140554
home/SRFBtoMQTT 268E014A03AC14155F

in the mean time OpenMQTTGateway receive with ZgatewayRF:
home/433toMQTT 1312084

If we dig into the infos given by Tinkerman:
https://www.itead.cc/wiki/images/5/5e/RF_Universal_Transeceive_Module_Serial_Protocol_v1.0.pdf
We can see that the raw values correspond to Tsyn, Tlow, Thigh and 24bit Data below:

24 bit data is also the size of rcswitch data !

If we convert 140554 to decimal we get 1312084, coherent!

Nevertheless to trigger the home automation we need to extract these datas and send them to MQTT.

By extracting the data from the buffer it is quite easy to get the decimal value with some code modifications:
home/433toMQTT 34009
home/SRFBtoMQTT/Raw 2A80015E042E0084D9
home/SRFBtoMQTT 34009
home/SRFBtoMQTT/Tsyn 10880
home/SRFBtoMQTT/Thigh 350
home/SRFBtoMQTT/Tlow 1070

Like that the behaviour for receiving is homogenous with ZgatewayRF and the bridge can be used to trigger home automation controller from 433mhz sensors (of course you can send also). The tutorial is here

Thanks Xose Pérez for its code.






Commentaires

  1. Seems Sonoff are onto us. I just bought one with the hopes of hacking it, they've removed all the pin header on the PCB so now you'd need to be ready to solder pins onto the PCB.

    RépondreSupprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

433toMQTTto433 - Bidirectional ESP8266 NodeMCU gateway between RF 433Mhz signal and MQTT

The goal  is to act as a gateway between 433Mhz sensors and a MQTT broker or between the MQTT broker and 433Mhz actuators, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators (wall sockets) with software like openhab.

List of compatible sensors here

The interest of putting this gateway to an ESP8266 and not on a raspberry pi is to be able to manage security actions at gateway level (power on a siren, cut power to certain devices) following RF data received by sensors without being dependent to the PI for security related actions.

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQTTGateway

You need:

Software:

MosquittoArduino IDE latest version (tested ok with 1.6.10)esp8266 board added to t…

Infrared IR, 433mhz and MQTT on ESP8266 bidirectional gateway OpenMQTTGateway

Following discussions on the home assistant forum people gave me the idea to add Infrared communication to the 433mhz gateway. 

The goal is to act as a gateway between 433Mhz sensors, infrared remote controls and a MQTT broker or between the MQTT broker and 433Mhz actuators, infrared devices, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal receive MQTT data from a topic and send infrared signal corresponding to the received MQTT data publish MQTT data to a different topic related to received infrared signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators (wall sockets), your tv, home cinema, hifi ... with software like openhab or home assistant.

List of compatible RF sensors here

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQT…

433toMQTTto433 - Bidirectional Arduino gateway between RF 433Mhz signal and MQTT

The goal of the Arduino 433toMQTTto433 is to act as a gateway between 433Mhz sensors and a MQTT broker or between the MQTT broker and 433Mhz actuators, It enables to:
receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data publish MQTT data to a different topic related to received 433Mhz signal 
It can be an interesting part in an home automation system so as to interface sensors and actuators with software like openhab.

The interest of putting this gateway to an arduino and not on a raspberry pi is to be able to manage security actions at arduino level (power on a siren, cut power to certain devices) following RF data received by sensors without being dependent to the PI for security related actions.

[EDIT] all infos are now centralized into the github repository take a look at it you will find up to date info about OpenMQTTGateway

You need:
Arduino UNO W5100 Ethernet shield 433Mhz Receiver XD RF 5V and transmitter FS1000A 
Transmitter VCC must be p…