Software apps and online services
Instead of paying for an expensive home monitoring system that charges a monthly fee, we decided to build our own. Three Particle Argon's are linked together on the same network, each having their own monitoring sensor. One Argon is connected to a flame sensor module that uses infrared light to detect the presence of a flame or hot object. The second Argon is connected to a water sensor brick that can be laid in a basement or low lying area to detect the presence of water. The third Argon is connected to a digital temperature and humidity sensor that logs real time temp/humidity data that can be graphed and viewed using ThingSpeak. Alerts for all three sensors are sent via text messages using If This Then That (IFTTT). This homemade home monitoring system is perfect for beach houses or second homes. The text alert setup creates a fast and reliable way for homeowners to get notified about potential disastrous events happening at a location far away from where they are currently. Events such as basement floods could go noticed for weeks and have potentially disastrous effects. The system we have built is ideal for all types of homes, offices, and other buildings.
The flame sensor converts the incoming infrared light into current changes. The integrated circuit turns the current into a useful thermal resistance which can be used as an analog or digital input. A threshold value for the thermal resistance had to be found to prevent false positives. After some tinkering with a lighter and ambient light we determined that any value below 2900 was a good determination of a flame. The lower the value the higher intensity of flame.
When a threshold value is reached, the buzzer will sound for an audible alarm. The Argon publishes a Flame_Detected event that can be heard by the other two Argon's, which subscribe to the event. LEDs are illuminated on both Argon's and wont extinguish until a flame is no longer detected. The same goes for the buzzer alarm on the sensing Argon. This event also triggers an IFTTT widget that messages the user in the event of a fire. A detailed explanation of the code is given as comments within the application.
The flame detecting circuit also has an LED which will turn on when a Temp/Humidity event is heard from another Argon. This event discussed further later on.
When a flame is detected the Argon also publishes a Flame_Value event that outputs the thermal resistance value. This data can be used in ThingSpeak to track a total number of flame events, or observe the intensity of each detected flame.
Both fire and flood monitoring is sent to the Telegram app on the users device for real time alerts. This is accomplished using IFTTT. When either the "Fire_Detected" or "H20_Lyons" event is published it triggers a preset message to be sent.
The flood monitoring system utilizes a water level sensor to detect whether or not water is present. The sensor is powered by a 5 volt input (red wire) and connected to group on the negative side (black wire). It then has a 3rd wire used for signalling (green wire). The sensor works by running electricity through the copper strands. When water is detected, it causes a short circuit and the sensor outputs an analog value of the water height in relation to the sensor. In order to get an output value in a common unit like inches or centimeters, some testing and conversions need to take place. For this monitoring system, the code is written so that any water level above a few millimeters from the bottom will output an alert. The analog value is outputted from the sensor and converted to a voltage. This would allow the user of the system to place the measurement device where they need it so the device could be used in a variety of applications and situations.
The Argon is also coded to alert users when another Argon detects something. The LED shown in the wiring diagram is programmed to turn on when the Temperature and Humidity Argon posts an event. This could easily be coded to detect a fire from the Fire Detection Argon as well. The user has the freedom to use any of the published event data as a trigger for the wired LED.
The code for the water level sensor involves multiple if statements which post different events. One of the events is published if water is detected, while the other event is published once water is no longer detected. This allows the LED indicator on the fire detection Argon to turn on and alert anyone in that area that a high water level has been detected. The second event which gives an "all clear" can help to provide valuable information like how long the high level of water was present in the area where the sensor was placed. The water level takes a reading every 10 seconds so that users of the system are able to see if the water level is increasing rapidly.
The third Argon monitors both ambient temperature and air humidity. The two parameters are measured using one sensor which relies on a 5 v signal from the Argon. The sensor output connects to an analog input pin on the argon. Unlike the fire and water level detection systems, the temperature and humidity is constantly outputting values to real time graphs. Both of the other sensors in the system rely on a set point that either returns a high or low value. If the sensed value is below the set point, then no fire or high water level are detected. If the value is over the set point, the Argons publish an event alerting the user a fire or flood are present. This data collection is constantly measured, with a new value being outputted every minute so that temperature and humidity can be closely monitored or checked.
One thing that differentiates this code from the water level and fire detection sensors is the use of a library. The specific library that needs to be included for the temperature and humidity sensor is titled "Seeed_DHT11.h". This file can be added by searching the library ribbon. Data is collected using the float operator seen in the loop. The data can then be converted into a String to be published to the cloud for graphing seen below. It can also be detected as an event trigger for the other Argons. This Argon is programmed to communicate with the water and fire detection sensor circuits by subscribing to the events published by each circuit. If either of the events indicating a threat are published, the LED in this circuit will light up. It then publishes an event that will activate an LED on the water level or fire sensor to confirm that all the Argons have successfully communicated.
The live data from the temperature and humidity sensor are both subscribed to through ThingSpeak. The published events can be tracked on graphs through the program.
https://thingspeak.com/channels/913274 live data can be viewed here.
See the project in action below!