Accéder au contenu principal

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

[EDIT] a new version compatible with Arduino and ESP8266 and adding infrared is available here

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.

You need:


Software:

  • Mosquitto
  • Arduino IDE latest version (tested ok with 1.6.10)
  • esp8266 board added to the arduino IDE board manager version >= 2.3.0



Hardware
  • ESP8266 (nodemcu)
  • 433Mhz Receiver XD RF 5V
  • transmitter FS1000A 



Transmitter signal to pin D2, Receiver signal to pin D1
Here is the schematic:

If you want to increase the range of the receiver XD RF 5V plug its vcc directly to a 5V power supply like on the schema below and not to Vin of your nodemcu, it will considerably increase the range. In this case I disconnect the usb cable as I don't know if the nodemcu can handle the both source of power.





Some pictures:









Remote control used for the tests



Download the following libraries from your arduino environment:
Install Mosquitto to your server.

Download the code of the gateway:

The code of the gateway can be found here , you can follow the wikis tutorials.



Upload the sketch to your ESP8266 and open the serial monitor with a speed set to 9600b.
Launch or verify that you mosquitto broker is up and running

If the connexion to mosquitto is ok you should see on the serial monitor of the arduino "connected" & "subscription OK to home/MQTTto433/"
Now you can do some tests to verify that all is working as expected, here is some usefull commands to test gateway with mosquitto from the server, on your mosquitto server:
  • Subscribe to the subject for data reiception from RF signal 
mosquitto_sub -t home/433toMQTT
  • Send data by MQTT to convert it on RF signal 
mosquitto_pub -t home/MQTTto433/ -m 1315156

Arduino IDE serial data received when publishing data by MQTT


We see that the Arduino receive the value 1315156 on the MQTT subject "MQTTto433" and send the data by RF


Arduino IDE serial data received when receiving data by 433Mhz





MQTT subject follow from command line:
pi@raspberrypi ~ $ sudo mosquitto_sub -t home/# -v
home/433toMQTT 1312084 
home/433toMQTT 1312095


Enjoy!


Commentaires

  1. Nice indeed! I missed your page when I did the same. I also included a web admin page. See https://github.com/dagrende/cheaperstick.

    RépondreSupprimer
    Réponses
    1. I have made some notes about issues I am having using your code on your Git page. Unfortunately, it does not appear you have seen them.

      Supprimer
  2. Ce commentaire a été supprimé par un administrateur du blog.

    RépondreSupprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

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

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

You need:

Software:

MosquittoArduino IDE latest version (tested ok with 1.6.10)esp8266 board added to the arduino IDE board man…

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

[EDIT] a new version compatible with Arduino and ESP8266 and adding infrared is available here

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.

You need:
Arduino UNO W5100 Ethernet shield 433Mhz Receiver XD RF 5V and transmitter FS1000A 
Transmitter VCC must be plugged to pin 9, signal to pin 10, Rec…