Sensors: Fire Sensor MQTT OpenHAB ESP8266 Demo

Fire Sensor MQTT OpenHAB ESP8266


Hey guys Matt here from and in this video I am going to give you a demo of the Fire Sensor we will be creating.
So what is this fire sensor exactly well, it is a sensor that connects to our openhab server through MQTT and tells it the state of the fire detector. Personally It provides a sense of relief because now I will know if there is a fire at home and can possibly get it put out faster instead of coming home to a house burnt to the ground. If I pull out a mobile device and open up the openHAB app you can see that I now have a new item in a new frame called fire detectors.The item is the fire sensor and it is labeled as “House”. This item shows me the current status of the fire detectors in the main house. The reason I have it called house is because in the future when there are fire detectors in the garage I plan on putting another device there to show the status of those fire detectors. This device is great because whenever the fire detectors go off I get a notification on my phone. I locked my mobile device and as you can see if I press the test button on the fire detector I get a notification. If I go back to the openhab app you can now see that if I press the test button the device status changes to Fire Detected. Next, I am going to show you around the device. Starting from the top we have the wire that goes to the fire detector and this is how we get the signal from it. Next we have the control box and then if we keep going down is its power wire connected to an outlet. But, let's take a closer look at the control box. It is all housed in a nice plastic enclosure with two holes for screws. Anyway if we open it up we can see the Custom PCB and its components. First up at the top left is the communication port and this is how we are going to program the device. Below that is the 5 volt to 3.3 volt regulator because the ESP8266 uses 3.3V . To the right of that is the mode switch and we use this to either put the device into program mode or in run mode. To the left of that is the 5 volt power input terminal. In the top right there is a 1K resistor. Below that and to the left is a 330 ohm resistor and 10k resistor. To the right of the resistors is the input terminal from the fire detector. Underneath that is PC817 optocoupler. If we flip the board over we will see the esp right in the middle. The esp8266 is the whole brains of the device and it is what connects to the openhab server through mqtt over wifi. But let's talk a little bit more about the fire detector and how we connect to it. If we take a look at my fire detectors you can see that there are three wires coming out of it, that is because this is a hardwired fire detector with a battery backup. These types of fire detectors feature something called interconnect and what it does is that if 1 fire detector goes off then all the fire detectors connected also go off. So what my device does is it pretends to be a fire detector and receives the signal. In past videos some of you guys mentioned that you wanted to know a little bit more in detail how the hardware works so I will try to explain how the fire sensor works. Let's pretend there is a fire, the fire sensor and fire detector go off. The first thing that happens is the fire detector sends a 9 volt pulse over the red and white wires. The red and white wires are connected to the fire sensor through the blue terminal block. The white wire side of the terminal block is then connected to the Cathode of the optocoupler. The red wire side of the terminal block is connected to the 1K resistor and the 330 ohm resistor. The reason I have these two resistors is to bring the voltage down. Then the other end of the 330 ohm resistor is connected to the Anode of the optocoupler. For those of you who don’t know an optocoupler in the most basic terms is sort of a switch that if you apply voltage to one side it connects the other. In this case the voltage side is the one with the fire detector. So lets talk about the other side. The emitter side of the optocoupler is connected to ground and the collector side is connected to GPIO 13 on the esp8266. But GPIO 13 also has a resistor connected to that goes to 3.3v, this is known as a Pull Up Resistor. The rest of the esp8266 and the circuit is just standard stuff but If you guys want me to do a video on that let me know. That’s it that is the entire device! In the next video I will show you all the hardware we will need and how to put it together. If you want to be ready for the hardware video you can buy a kit or the PCB to make the device at the link in the video description. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to Good Bye!