DIY Home Hazard Monitoring System (Gas, Smoke, Water & Power Loss) (uses an Arduino Like Micro Controller and Raspberry Pi)
by foxtrap in Circuits > Electronics
82 Views, 0 Favorites, 0 Comments
DIY Home Hazard Monitoring System (Gas, Smoke, Water & Power Loss) (uses an Arduino Like Micro Controller and Raspberry Pi)
Ever wondered how to monitor your home for multiple hazards in one system?
In this project, I built a compact home safety monitor that detects gas leaks, smoke, water leaks, and power outages. The system sends real-time alerts to a smartphone dashboard, allowing you to respond quickly to potential hazards.
While many DIY systems use Arduino, this build takes a slightly different approach using a Raspberry Pi running Node-Red and an ESP8266 based controller. This solution requires no software development and instead uses a drag and drop IoT dashboard and workflow builder.
The result is a clean, scalable system that’s easy to expand and practical for real-world use.
Bits n Pieces
The table below gives the complete parts list required and a complete budgetary price.
Putting It Together
Gas/Smoke Sensor
Plug the gas sensor into the breadboard for rigid support and connect the wiring to the Wrappa module, as shown in the diagram below. We connect the analog output of the MQ2 to the A1 analog input terminal of the Wrappa. Note that we are powering the MQ2 via a switched 5V from the Wrappa’s buit-in relay. This is done in order to preserve the life of the sensor module, which includes a heater as part of the sensing element. This is an optional implementation and may be ignored if you have other usage plans for the relay.
Next, connect the water sensing probe terminals to the terminals of theYL-38 comparator module and the comparator module to the Wrappa. We power the YL-38 board with 3.3V and use the digital output of the module to connect to D5 of the Wrappa digital input (see diagram below).
As explained later, you will need to adjust the threshold value of the water sensor via the trim pot on the YL-38.
Preparing the Probe & Connecting the Parts
As explained later, you will need to adjust the threshold value of the water sensor via the trim pot on the YL-38.
Connect Water Probe
I directly soldered the probe to the comparator module for added stability but both devices have screw holes for rigid fixing to the wall or kick-board. The trim-pot is exposed for further fine tuning if required.
Mains Power Monitor
Mains Power Monitor
In order to be able to receive a power outage alert, it is necessary to ensure communications over the internet during this period. You will need to power your internet WiFI home router and the Wrapit Hub via a UPS. The UPS only needs to power the router and hub for around 5 minutes. So, a small capacity, low cost UPS of around 300W will suffice.
The Wrappa module needs to be powered by the power adapter that comes with it, and needs to be plugged into an outlet on the same mains circuit as your refrigerator or freezer. How it works; the Wrappa module sends continuous heartbeats to the Wrapit Hub. When power to the fridge/freezer/Wrappa is lost, the Wrapit hub detects the loss of heartbeats from the wrappa and sends an alert to your smartphone via Telegram, after a timed persistence check is exceeded.
Bringing it to Life
It is assumed that you have already setup your Wrapit Solution Environment, if not, you should refer to the “Wrappa Getting Started” video, accessible here.
On your browser, open up the Wrapit NodeRed development environment and import the Home-Monitor flow, which is available by clicking the link.
The flow is broken up into functional groups. Some nodes in each group require some very minor edits to reflect the specific naming relevant to your Wrappa or Telegram account details. These nodes are highlighted with a red circle in the diagram below ,with relevant comments provided for guidance.
Download and Fine Tune the NodeRed Flow
Once you have made all the edits that pertain to the unique names of your devices or the registration ID of your Telegram account, click on “Deploy” and open your Dashboard in another tab on your browser by entering wrapit-hub.local:1880/ui in the URL bar.
Select “Home Monitor” from the Dashboard Selector Dropdown and you should see the following.
Test and Tune the Project
Testing and Tuning
You may need to adjust the threshold level on the Water detection sensor by setting the trim pot on the YL-38 comparator module to a suitable threshold. Place the sensor tip in about 1mm of water and adjust the trim pot until the trigger LED on the module comes on. Remove the probe from the water and make sure the trigger LED goes off.
For the gas/smoke sensor the reading shown on the dashboard gauge should indicate the quiescent value within around 30s after the sensor is activated and warms up. The value from the sensor varies from 0 to 1023. To set the thresholds for which alert messages will be sent, you must edit the threshold in the switch node, identified as “Set Thresholds”. To test this sensor use a gas top lighter or safely blow some smoke over the sensor.