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:
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 OpenMQTTGateway
You need:
Software:
433mhz Transmitter signal to pin D2, 433mhz Receiver signal to pin D1, transistor to pin D5, IR receiver to pin D4
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:
Download the following libraries from your arduino environment:
Download the code of the gateway , the wiki contains this tutorial and all the updated infos
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:
pi@raspberrypi ~ $ sudo mosquitto_sub -t home/# -v
home/433toMQTT 1312084
home/433toMQTT 1312095
home/sensors/ir 3609272523
You can take this code and try to reproduce it with the gateway. With the IR gateway you need to put on the topic the protocol you want to use to send the signal, the different protocols implemented are the following, the MQTT subject is between "":
subjectMQTTtoIRLG "home/commands/IR_LG"
subjectMQTTtoIRSony "home/commands/IR_Sony"
subjectMQTTtoIRCOOLIX "home/commands/IR_COOLIX"
subjectMQTTtoIRWhynter "home/commands/IR_Whynter"
subjectMQTTtoIRNEC "home/commands/IR_NEC"
subjectMQTTtoIRDISH "home/commands/IR_DISH"
subjectMQTTtoIRSharp "home/commands/IR_Sharp"
subjectMQTTtoIRPanasonic "home/commands/IR_Panasonic"
subjectMQTTtoIRSAMSUNG "home/commands/IR_SAMSUNG"
For example if I want to send a command to a sony TV you can use the following command:
mosquitto_pub -t home/commands/IR_Sony -m 3609272523
The code after the -m represent the value you want to send.
Enjoy!
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 OpenMQTTGateway
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
- OpenMQTTGateway
- ESP8266 (tested ok on geekcreit ESP12F), NodeMCU V0.9 is not working with this configuration
- 433Mhz Receiver XD RF 5V and transmitter FS1000A or better alternative a superheterodyne ones
- an infrared diode for emitting
- a transistor 2N2222
- a 330 ohms resistor
- an infrared receiver
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:
Download the following libraries from your arduino environment:
- RCSwitch
- PubSubClient
- ESP8266WiFi (standard one from arduino IDE)
- IRRemoteESP8266
Download the code of the gateway , the wiki contains this tutorial and all the updated infos
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/commands/#"
If the connexion to mosquitto is ok you should see on the serial monitor of the arduino "connected" & "subscription OK to home/commands/#"
- Subscribe to the # subject so as to check the data received eitherr by RF either by IR
Testing the RF gateway
- Send data by MQTT to convert it on RF signal
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
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
Testing the IR infrared gateway
If you already subscribed to
mosquitto_sub -t home/# -v
And press your IR remote control in front of the receiver led you should see the following message for example:home/sensors/ir 3609272523
subjectMQTTtoIRLG "home/commands/IR_LG"
subjectMQTTtoIRSony "home/commands/IR_Sony"
subjectMQTTtoIRCOOLIX "home/commands/IR_COOLIX"
subjectMQTTtoIRWhynter "home/commands/IR_Whynter"
subjectMQTTtoIRNEC "home/commands/IR_NEC"
subjectMQTTtoIRDISH "home/commands/IR_DISH"
subjectMQTTtoIRSharp "home/commands/IR_Sharp"
subjectMQTTtoIRPanasonic "home/commands/IR_Panasonic"
subjectMQTTtoIRSAMSUNG "home/commands/IR_SAMSUNG"
For example if I want to send a command to a sony TV you can use the following command:
mosquitto_pub -t home/commands/IR_Sony -m 3609272523
The code after the -m represent the value you want to send.
Enjoy!
Would it be possible to base this on the RFLink Gateway firmware instead as it have support for many more devices? See http://www.nemcon.nl/blog2/easyha
RépondreSupprimerHello, the last version of the RFlink is not anymore opensource unfortunately but I'm agree with you if we add to a MQTT gateway the RFlink protocols list it would be awesome
SupprimerStumbled upon this and have to say that this bridge project could be a good business idea for Kickstarter/Indiegogo:
RépondreSupprimerIf someone would just steal that concept and make it into cheap enough nicely boxed appliance product that only acted as a “IR and 315/433 MHz to WiFi + MQTT Bridge ” then I think that alone could sell pretty well in some home automation niche markets.
“315 MHz /433 MHz and InfraRed to MQTT WiFi Bridge”
Reason for that is I really believe there is a commercial market for a such specific “315 MHz /433 MHz and InfraRed to MQTT WiFi Bridge” product because most existing commercial home automation hubs do not feature 315/433 MHz or InfraRed receivers or transmitters, but as most existing commercial home automation hubs does support MQTT there is a large potential market for customers who don’t want to use expensive ZigBee and Z-Wave sensors.
To keep cost down you would make and sell one 315 MHz model for North America and one 433 MHz model for Europe and Asia. So one model that is; “315 MHz and InfraRed to MQTT WiFi Bridge” and one model that is “433 MHz and InfraRed to MQTT WiFi Bridge”, and possibly you could also make a third product model that is a 868MHz bride; “868 MHz and InfraRed to MQTT WiFi Bridge”.
As listed there all that you really need as far as hardware components goes is a ESP8266 or ESP32 chip, InfraRed and 315 or 433 MHz transmitters, and InfraRed and 315 or 433 MHz receivers. The source code for protocols and more could be copied from other firmware project (and shared with that project) as long as you keep it open source under the same license. Regardless it would be a good idea to make the whole firmware open source as then you have the possibility of getting help with the code from the community, and open source projects also often get more passionate communities than those who keep their code proprietary and closed.
You could possibly make cheaper by making a receiver only model as a “lite” version, but personally I don’t think there would be a large enough market for a such stripped down version to make it worth the little extra cost that a 315/433 MHz transmitter adds, (as proven with Telldus Tellstick ZNet Lite v1 which did not sell so well because it only had a 433 MHz receiver, so Telldus Tellstick ZNet Lite v2 also added a 433 MHz transmitter too).
As stretch goals Kickstarter/Indiegogo you could add a DHT22 humidity + temperature sensor and a light sensor.
In any case I think that this concept alone have the potential of becoming a proper commercial product if someone here have both the coding skills and enough business sense to push a such idea.
Great project. I was wondering if the output of the IR receiver and the Rf receiver is not too high for the esp chip when those modules are supplied to 5Volt.
RépondreSupprimerHaving said that, I have fed an rf transmitter with 3.3Volt and that still had a good range... with a proper antenna
Hello,
SupprimerThanks, in theory yes esp8266 accept 3,3V and the receivers are returning 5V signal, but in real life it works and I never had issue about this.
The SantaMedical RY-230 Non-Contact Infrared Thermometer is designed to take accurate temperature readings of areas such as the forehead or tear ducts. It reads forehead temperature from 1” to 4” away, and has a large LCD screen and backlight for easy night time usage. Buy Now at amazon.com
RépondreSupprimer2 in 1 Professional Clinical Infrared Thermometer
I wonder if you could help me.
RépondreSupprimerThis picture shows pin D1 and D2.
Based on the code for ESP8266, it seems like I should use D3 and RX?
So far I cannot receive any signal.
I also am not sure to convert the binary based code to the decimal base code to verify the transmit works.
What can I try to diagnose this... :(
Wifi, subscription to MQTT, is working.
I disabled IR in my code.
Ce commentaire a été supprimé par un administrateur du blog.
RépondreSupprimer