Smoke Detector Alarm with Relay and NodeMCU (for sending texts)
I am trying to build a smoke detector relay that will monitor a smoke sensor, temps, control an external 30A relay, and send me a text message if there is a problem. Additionally I want to be able to reset the 30A relay or shut it off remotely, and also view the temps and alarm states. Optionally I may add an input for a logic level signal to control the relay (via the NodeMCU) from an external device like a Rpi.
Project outline:
Integrate the following major components:
NodeMCU
9V Smoke Detector Relay
Dallas DS18B20 digital one wire temperature sensor (x2)
5-12v Piezo Buzzer
12V 30A relay (with 1-5v signal input)
L7809 9v regulator with 9V battery circuit
L7805 5v regulator fed from the 9v regulator (found that 9v in may be too hot for the NodeMCU so adding this 5v reg).
The smoke detector should perform the following functions:
When the sensor detects smoke:
1. shut the signal to the external 12V 30A relay
1a. check (this is not implemented yet - need to find a way to verify power is off)
2. set piezo buzzer on
3. send a text and email stating the alarm state with the timestamp, the last temperature sensor reading (use the last stored value) and state of mains power (from ADC0).
4. send a text and email every minute (or less) for 5 minutes with the same information.
5. allow a remote command to turn off the buzzer and toggle the 30A relay.
During normal operation:
1. poll the state of the smoke detector sensor (on or off)
2. poll the temperature sensors, store their values
3. poll the NTP time every hour or so and correct the programmed clock time
https://www.youtube.com/watch?v=qzkNXhubWLg
https://www.youtube.com/watch?v=BzFM3PWx1rg
Library: https://github.com/SensorsIot/ESPDail... SNTP
library: https://github.com/SensorsIot/SNTPtime
4. check the ADC0 vlaue to see if there is a mains power failure
5. monitor for remote commands
6. Poll an input for external signal (from RPi) to shut down or turn on the connected device via the 12V 30A external relay.
7. Send text or email once recovered from power loss with time stamp.
8. If either temp sensor is not readable - set a flag to note it is not available.
9. Watchdog timer to confirm normal operation.
https://www.youtube.com/watch?v=D_7ciW_TCac
10. Use a 9v battery for automatic backup power if mains goes down.
Remote commands and data output:
1. Configure IP and AP info via HTTP server (using WiFiManager)
2. Configure API Key for IFTTT or other service via HTTP server (using WiFiManager)
3. View the state of the temperature sensors and mains power
4. Disable the Piezo buzzer (it cannot be turned on remotely due to wiring config).
5. Enable or disable the signal to the 12V 30A relay (to switch on or off the printer).
6. reset the nodemcu (this may not be implemented except for a soft reset) since I don't want a reset of the MCU to bounce the relay.
Buttons and ports:
1. Reset button (momentary)
2. 3 wire input/output connection (12V, GND, Logic Level Signal out to 12V 30A relay)
3. External DS18B20 port (audio DIN jack)
4. 9V DC battery connection
5. Possible remote trigger logic level input (not sure on the connector type), would probably add an opto-isolator for this.
I have the schematic almost done except for some odds and ends like the remote trigger input which I may or may not end up using.
The next step is to build the program for the NodeMCU to manage the sensors and send the notifications.
The Libraries I expect to use for that are:
WiFiManager more info
onewire
dallastemperature
SNMPtime more info
ESPDailyTaskNTP more info
ticker more info
FS more info
ArduinoJson more info
ArduinoJson also requires the ESP8266 filesystem uploader for the Arduino IDE to send the JSON file over using the Arduino IDE
So this is gonna be a heavy lift for me since I have not messed with Arduino or any PIC for quite a long time, but I am gonna try breaking this down in baby steps and work the tutorials. I will hopefully get somewhere with it and learn some new tricks.
Project outline:
Integrate the following major components:
NodeMCU
9V Smoke Detector Relay
Dallas DS18B20 digital one wire temperature sensor (x2)
5-12v Piezo Buzzer
12V 30A relay (with 1-5v signal input)
L7809 9v regulator with 9V battery circuit
L7805 5v regulator fed from the 9v regulator (found that 9v in may be too hot for the NodeMCU so adding this 5v reg).
The smoke detector should perform the following functions:
When the sensor detects smoke:
1. shut the signal to the external 12V 30A relay
1a. check (this is not implemented yet - need to find a way to verify power is off)
2. set piezo buzzer on
3. send a text and email stating the alarm state with the timestamp, the last temperature sensor reading (use the last stored value) and state of mains power (from ADC0).
4. send a text and email every minute (or less) for 5 minutes with the same information.
5. allow a remote command to turn off the buzzer and toggle the 30A relay.
During normal operation:
1. poll the state of the smoke detector sensor (on or off)
2. poll the temperature sensors, store their values
3. poll the NTP time every hour or so and correct the programmed clock time
https://www.youtube.com/watch?v=qzkNXhubWLg
https://www.youtube.com/watch?v=BzFM3PWx1rg
Library: https://github.com/SensorsIot/ESPDail... SNTP
library: https://github.com/SensorsIot/SNTPtime
4. check the ADC0 vlaue to see if there is a mains power failure
5. monitor for remote commands
6. Poll an input for external signal (from RPi) to shut down or turn on the connected device via the 12V 30A external relay.
7. Send text or email once recovered from power loss with time stamp.
8. If either temp sensor is not readable - set a flag to note it is not available.
9. Watchdog timer to confirm normal operation.
https://www.youtube.com/watch?v=D_7ciW_TCac
10. Use a 9v battery for automatic backup power if mains goes down.
Remote commands and data output:
1. Configure IP and AP info via HTTP server (using WiFiManager)
2. Configure API Key for IFTTT or other service via HTTP server (using WiFiManager)
3. View the state of the temperature sensors and mains power
4. Disable the Piezo buzzer (it cannot be turned on remotely due to wiring config).
5. Enable or disable the signal to the 12V 30A relay (to switch on or off the printer).
6. reset the nodemcu (this may not be implemented except for a soft reset) since I don't want a reset of the MCU to bounce the relay.
Buttons and ports:
1. Reset button (momentary)
2. 3 wire input/output connection (12V, GND, Logic Level Signal out to 12V 30A relay)
3. External DS18B20 port (audio DIN jack)
4. 9V DC battery connection
5. Possible remote trigger logic level input (not sure on the connector type), would probably add an opto-isolator for this.
I have the schematic almost done except for some odds and ends like the remote trigger input which I may or may not end up using.
The next step is to build the program for the NodeMCU to manage the sensors and send the notifications.
The Libraries I expect to use for that are:
WiFiManager more info
onewire
dallastemperature
SNMPtime more info
ESPDailyTaskNTP more info
ticker more info
FS more info
ArduinoJson more info
ArduinoJson also requires the ESP8266 filesystem uploader for the Arduino IDE to send the JSON file over using the Arduino IDE
So this is gonna be a heavy lift for me since I have not messed with Arduino or any PIC for quite a long time, but I am gonna try breaking this down in baby steps and work the tutorials. I will hopefully get somewhere with it and learn some new tricks.