Paranoid fire/gas/motion alarm system based on a ESP8266

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
* Work in progress, see post 2 *

Hello everyone,

I've been slowly making a thing for a while now. As I have some spare time, some money, etc.

Basically what I'm building is a cheap but quite robust wireless environment sensing and alarming device.

Operating principle:
1. Detect a fire by sampling multiple sensors. Try to establish the likelihood of false alarm/sensor malfunction/actual fire.
- is it getting more hot than usual?
- optical detection of an open flame via infrared?
- is there smoke?
- smoke detection by checking both the MQ-2 sensor's reading AND a simple diode emitter-phototransistor setup
- (added 26.04) measure supply voltage, notify in event of insufficient power

2. Detect presence of combustible gases (only tested smoke and Buthane for now, using MQ-2)
2a. (added 26.04) MQ-2 is a tube-like sensor. It needs to warm up for a few minutes and have adequate current available.
During startup, current draw to MQ-2 will be measured to determine sensor readiness and a baseline readout will be established (calibration).
(added 01.05) - measuring the MQ-2 sensor's current draw isn't helpful for determining readiness because power supply fluctuations and humidity affect the readout more than the heating up... But a baseline will be recorded.

3. Motion detection (optional)
- motion detection via passive infrared (PIR) sensors
- multiple sensors, partially overlapping to help identify false alarms


4. Shit's on - tell b0ss
- the ESP8266 by default supports WiFi.
- on alarm, send e-mail, detail which sensors tripped
- send SMS message (there are GSM/GPRS modules available for Arduino, ESP8266, etc.)
- send SMS message via an API / SMS gateway on the interwebs
- buzzer buzzes. Will adjust signal based on how real the shit has gotten (multiple sensors tripped?)

4a. Level of paranoia (panic thresholds) can be configured.

5. And here's the kicker.
- total cost of device - around $30-$40.
- it's so cheap because all the mentioned parts are very inexpensive and can be had for peanuts.
They aren't obviously pr0 grade calibrated certified etc, but using multiple methods of sensing the environment makes up for that.
- because it's cheap, multiple devices can be used and there's no need for a compromise (which room? which corridor?)

Current parts list:
- a Wemos D1 development board, based on the ESP8266 microcontroller ($5)
- OLED 0,91" display ($5)
- MQ-2 LPG, Smoke, Alcohol, Propane, Hydrogen, Methane and Carbon Monoxide sensor ($2)
- optical fire sensing detector (760 to 1100 nm) ($3)
- AM2302 based temperature and humidity sensor ($5?)
- GSM module - $10 (?)
- backup power in the form of any small power bank ($8?)
- wall adapter to charge/top off the power bank
- wires and a plastic box ($5?)
- (added 26.04) INA-219 digital current & voltage sensor module ($4)
 

Attachments

  • WP_20210420_19_23_57_Pro.jpg
    WP_20210420_19_23_57_Pro.jpg
    369.3 KB · Views: 0
Last edited:

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
Because this is a work in progress, I'll be adding some some stuff in this thread as time goes on.

Code will be published here.

Everyone's welcome to throw in their suggestions, but please be uhhh terse and succint :D
 
Last edited:

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
The choice of a Wemos D1 ESP8266 dev. board is not random.
You may have heard/read about the ESP32 or beefier ESP8266 versions, but...

- Earlier revisions of this device can be bought for crazy low clearance prices. I got mine for 20 PLN ( around $5 )
- You can supply power through a jack connector, the "VIN" pin, or through the USB connector.
- You can supply either 5V or 12V. The board has a built-in buck converter and exposes 3.3V and 5V for use by various modules via pins.
 

Attachments

  • WeMos-D1-R1-WiFi-Development-Board-2.jpg
    WeMos-D1-R1-WiFi-Development-Board-2.jpg
    204.6 KB · Views: 0

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
Update: added INA219 current/voltage sensor to parts list for important additional features
 

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
I'm considering dropping the IR diode - phototransistor mode of smoke detection, and motion sensor in favor of adding a GSM module to send texts when an alarm is raised.
Reason for this decision would be component count, which adds to complexity, which usually reduces stability of any device.
I'll think about it.

However, the power consumption numbers are looking good for a basic smoke/gas/temperature setup I have going now.
Todo: enable WiFi, reports.
power consumption.jpg
 

michalrz

2[H]4U
Joined
Jun 4, 2012
Messages
2,839
1st of May
- decided to drop the motion detection portion - no point in trying to have it do everything. Complexity/parts count/power.
- decided to drop IR-diode/photo-transistor smoke detection: a ready-made sensor is surprisingly costly and also real estate issues. Might re-think after everything else is done.
- ordered GSM module, small passive buzzer

Good news - power supply voltage measurement works, device reboots/freezes/glitches below 4.6V, but will alert on flaky power.
The built-in hardware watchdog reboots the ESP8266 controller, so as long as there's power, it will start up and work unattended.

Weird bug: don't know if that's an issue with just my power bank... When the power bank discharges to 0, and mains power is restored, the power bank's output is really bad during top-up, despite good mains power. In my case, it went to 4.3V, which caused all sorts of problems (device worked, but badly).

So I guess the next update will be when I get GSM and WiFi working.
 

Attachments

  • zestaw-z-modulem-gprs-gsm-sim800l-v20.jpg
    zestaw-z-modulem-gprs-gsm-sim800l-v20.jpg
    33.2 KB · Views: 0
Top