Tiny Fire Alarm Detector Esp8266 MQTT IFTTT Home Automation

by Wim3d in Circuits > Wireless

5665 Views, 5 Favorites, 0 Comments

Tiny Fire Alarm Detector Esp8266 MQTT IFTTT Home Automation

IMG_20180916_140816.jpg

I wanted to detect whether my home smoke detector system is in alarm. I have eight smoke detector in my home and they are interconnected. If one smoke detector is in alarm, the other get a signal via the interconnection signal wire. My sensor reads the interconnecting wire and sends the information to my home automation (Openhab2) via MQTT and alarms me also via IFTTT.

This instructable was inspired by this project https://hackaday.io/project/5472-internet-enabled-...

Design

IMG_20180916_105030.jpg
IMG_20180908_131729.jpg
Schematic_Fire-alarm-detector-v2_Fire-alarm-detector_20180927202311.png

Firstly, you need to know how the smoke detectors communicate. I have Ei146 detectors.

The smoke detectors are interconnected via a "IC" line. If one smoke detector is activated, it generates a 6V - 8V signal on the IC line, see the picture of the oscillope screen.

I read the voltage of the IC line via an optocoupler (4N35), to isolate the smoke detectors from my home automation for safety.

The smoke alarm is powered by main voltage (220V AC), which I used to power the ESP-01 module

In the schematic you can see how the parts are connected. I use a ESP-01 sinc it is small and cheap.

Building the PCB

IMG_20180914_220241.jpg
IMG_20180914_220156.jpg
IMG_20180914_220054.jpg
IMG_20180914_220326.jpg
IMG_20180914_220140.jpg
IMG_20180914_215957.jpg

In the pictures and the comments on the pictures you can see how the PCB is assembled.

I optimized layout to fit on components on a small PCB, the ESP-01 lies over other components. I attach the ESP-01 via female headers to ensure easy programming via a USB programmer. After the module is assembled, you can flash new firmware Over The Air (OTA) via the Arduino IDE or HTTPupdate (see sketch)

Programming the ESP8266

IMG_20180930_100714.jpg
IMG_20180930_100722.jpg

See my Github for the code. I use all usable pins of the ESP-01 as GPIO-pins, that includes GPIO1 (TX) and GPIO3 (RX). So, serial communication is not possible and must not be initialized, otherwise the declaration of GPIO1 and GPIO3 becomes void.

Remark: do not pull GPIO0, GPIO1 or GPIO2 down at startup, because your program does not start. I found that GPIO03 can be pulled down at startup

I program my EPS-01's via this modified adapter.

The program runs as follows:

  • If the flash button is pushed at power up, the module initiates OTA mode.
  • HTTPupdate is initialized.
  • Connecting to WiFi and MQTT (green light on)
  • Reads the value of the sensor pin (attached to the IC pin of the smoke alarm)
  • If a fire is detected, wait for debounce and then raise the alarm (also Red light on) via
    • MQTT - the MQTT message is read via Openhab and a rule generates a notitification via my app
    • IFTTT - 1 - via a IFTTT Webhook a trigger is initiated which sends a notification.
    • IFTTT - 2 - via a IFTTT Webhook a trigger is initiated which sends a SMS to my wife
  • If the MQTT connection is lost (green light off), the LWT message (ERROR) is send to the topic and is read by Openhab.

Assembling the Module

IMG_20180915_202324.jpg
IMG_20180915_210424.jpg
IMG_20180916_131644.jpg
IMG_20180915_210336.jpg
IMG_20180915_211437.jpg
IMG_20180915_211425.jpg
IMG_20180916_134425.jpg
IMG_20180916_134750.jpg
IMG_20180916_140816.jpg

I designed and 3D-printed a box which nicely fits in the unused cable opening off the base plate of the smoke alarm, no screws needed.

Edit: stl-files are added.

I glued the LEDs and the OTA switch in place with hot glue. The box is closed via 4 screws.

Power up and ready!