For three years now, we have been building volunteer employees on a reconstruction of a former factory building into a church. We store materials and tools in the premises in order to have access to them on the day of use.
One day, our construction manager reported from the open entrance door, which we had forgotten to leave carelessly and openly after work.
A clear case: here electronics should provide us with a little help.
Today I installed a Particle Electron with SIM card on site, because there is still no WiFi network (for the Particle Photon as option) available.
This has entered with 2G into the available radio cell and now has the task of monitoring the opening of the door - restricted to the time window at night - with the help of a reed switch to monitor.
The reed switch reacts to magnetism so that its state (open or closed) can be read and responded.
As soon as the door is open during the day, it can be assumed that everything is in order. Rather, the focus is on monitoring in the period between 22:00 h and 07:00 h.
if ((h >= start_h /*22*/) and (h <= 24) or (h >= 0) and (h <= ende_h /*7*/))
If the door is opened, the state is changed and a variable is popped into the Particle Cloud.
if ((proximity == HIGH) and (firstfire == true)) // If the pin reads HIGH, the switch is open // the pin reads LOW, the switch is closed
{
Serial.println(">> Alarm >> Switch open");
digitalWrite(LED_PIN, HIGH); // Turn the LED on
Particle.publish("EMF-Bielefeld - Eingangstür Projekt", "Tür ist offen", PRIVATE);
firstfire = false;
delay(1000);
}
This event will be used by IFTTT to send an e-mail to me (to initiate further steps in self-government).
Let us now hope that I will never receive an information about an open door, and we will, with God's help, complete the construction in the foreseeable future.
Final Notes & ConclusionsIf you come from Germany, you can participate in the worship of the EMF Bielefeld every Sunday at 10:00 h.
If you are interested in daily Bible verse (which are also called "Losungen"), I recommend you the following project "Die Losungen - every day a new bible verse". Here is my Paypal link. I will send incoming payments to EMF Bielefeld e.V.
Like my description? You will find more under my account.
Follow me to be notified when I publish new projects! You can also send me sensors, which I like to look at.
Update 17.09.2017You will find version 1.1 attached: I change the Read-Input from Input to an Input_Pullup in the setup-definitions and put the code into its own function "readData".
Now the number of IFTTT messages is as expected only once, namely when the door is opened.
Comments