Remote Flood and Temp Monitoring

Tutorials & Guides
Post Reply
User avatar
Site Admin
Posts: 5150
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Remote Flood and Temp Monitoring

Post by kgschlosser » Sat Dec 10, 2016 6:56 pm


So i have on taken the task of monitoring my buddy's house while he is gone for the next 5 weeks. It is winter where i live and things like a furnace going out will lead to frozen pipes and water leaks.

Because he lives an hour and a half away it would be really inconvenient for me to make a daily trip to his home to make sure everything is in order.



External Devices:
Arduino $10.00 USD
Wiznet W5100 Ethernet Shield $7.00 USD
DHT11 Temp/Humidity Sensor $2.00 USD
Misc wiring $2.00 USD
2 x 10000 ohm resistors $0.25 USD
High Output USB Cell Phone Charger (samsung) $ Don't Know had a bunch kicking around
USB Cable leaving the USB-A Male End and cutting the other off to connect the power and ground wires to the Arduino VIN and ground pins

Arduino Libraries:
Ethernet DNS

Dynamic DNS Provider
Gmail Account

-------------How It Works-------------

It uses a library for the Arduino to send events to Eventghost. I had to forward the port on my firewall.
It sends a 5.0 Volt 50ma charge out of one of the GPIO pins. and there is another pin set to read voltage (analog pin 1, digital pin 7). analog pin 1 has a 10000 ohm resistor that is connected to it and the ground pin , attach some wires to those pins without about 2" stripped off the opposite end on both wires. these ends will be placed about 1/2" apart in the area where a leak can occur. and attached to something that won't float and that isn't metal. LOL. the DHT (Digital Humidity and Temp) sensor is attach to the 5V pin the ground pin and digital pin 6, digital pin 6 also has a 10000 ohm resistor attached to it and connected to the 5.0 volt pin.

Place the Arduino someplace up high where it will have a difficult time getting wet if there is a leak.

the Arduino reads voltage from Analog Pin 1 (which has what is called a pull-down resistor attached to it making it read as a ground) and that reading is sent via EtherEvents to a remote server running EG how that pin would see voltage is when water covers the 2 exposed ends of the wires it will create a short and voltage will transfer from digital pin 7 to analog pin 1. and from that reading I will know there is a flood and have EG send an e-mail which is pointed to the sms text messaging on my cell phone

the dht sensor reads the temp and humidity and sends that information to EventGhost. and based on what the temp is have EG send an e-mail

the default checking timing is every 10 minutes. but if it sees that the temp is below 50 degrees F it will change the speed to every 5 minutes. this will let me know how fast the temp is dropping in the house.


Anything that has an asterisk (*) has to be set by the user


Code: Select all

#include <SPI.h>
#include <DHT.h>
#include <Ethernet.h>
#include <Dns.h>
#include <EtherEvent.h>

DHT dht(6, DHT11);

byte MACaddress[] = {0, 1, 2, 3, 4, 4};

const int port = ****;
unsigned long queueEventInterval = 10000; / 10 seconds to get an initial reading

IPAddress dnsIP(8, 8, 8, 8);

EthernetClient txEvent;
DNSClient dClient;

unsigned long sendTimeStamp = 0;

void setup() {
	pinMode(7, OUTPUT);
	pinMode(A1, INPUT);
	EtherEvent.begin(26, 9);

void loop() {
	if (millis() - sendTimeStamp > queueEventInterval) {
		sendTimeStamp = millis();
		Serial.println(F("\nAttempting event send"));

void LookupDNS() {
	IPAddress txEventIP;
	if(dClient.getHostByName("*****.*****.com", txEventIP) == 1) {
		Serial.print(F("EG = "));
	} else {
		Serial.print(F("dns lookup failed"));
void ReadFlood(IPAddress txEventIP) {
	digitalWrite(7, HIGH);
	EtherEvent.send(txEvent, txEventIP, port, F("Allens.House.FloodSensor"), analogRead(A1));
	digitalWrite(7, LOW);

void ReadDHT(IPAddress txEventIP) {
	char payloadChar[9] = {NULL};
	dtostrf(dht.readHumidity(), 4, 3, payloadChar);
	EtherEvent.send(txEvent, txEventIP, port, F("Allens.House.Humidity"), payloadChar);
	payloadChar[0] = NULL;
	float temp = dht.readTemperature(true);
	if (temp < 50.0) {
		queueEventInterval = 300000; // 5 Minutes
	} else {
		queueEventInterval = 600000; // 10 Minutes
	dtostrf(temp, 4, 3, payloadChar);
	EtherEvent.send(txEvent, txEventIP, port, F("Allens.House.TempF"), payloadChar);
	payloadChar[0] = NULL;
	dtostrf(dht.computeHeatIndex(dht.readTemperature(true), dht.readHumidity()), 4, 3, payloadChar);
	EtherEvent.send(txEvent, txEventIP, port, F("Allens.House.HeatIndexF"), payloadChar);

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1706">
    <Folder Name="AllenScripts" Expanded="True">
        <Macro Name="Python Script" Expanded="True">
            <Event Name="Allens.House.TempF" />
                EventGhost.PythonScript(u"temp = float(eg.event.payload[0][0])\n\nif temp < 50.0:\n    eg.plugins.E_mail.SendEmail(\n        u'Allens House Temp Alert',\n        u' &lt;*******; - *******',\n        u'*******@******.com',\n        u'',\n        u'Temp is now at %2f' % temp,\n        u'',\n        u'*****'\n        )")
        <Macro Name="Python Script" Expanded="True">
            <Event Name="Allens.House.FloodSensor" />
                EventGhost.PythonScript(u"flood = int(eg.event.payload[0][0])\n\nif flood > 900:\n    eg.plugins.E_mail.SendEmail(\n        u'Allens House Flood Alert',\n        u' &lt;*******; - *******',\n        u'*******@******.com',\n        u'',\n        u'Basement is flooding %d' % flood,\n        u'',\n        u'*****'\n    )")

If you like the work I have been doing then feel free to Image

Post Reply