Software apps and online services
Are you tired of your dog drinking out of the toilet and then licking your face? Well not anymore you're not, with the Toilet Water Protector 3000! Using a few simple components and the Internet of Things, you can keep your little furry companion from drinking dirty pee water once and for all!
Your results may vary. We are not responsible for any eaten electronics.
The theory behind this that when either of our dogs enters the bathroom, the magical seeming combination of loud beeps and the flashing lights will scare them away and keep them from drinking the nasty toilet water. Because, you know, dogs are dumb, right?Part 1
The project was set up using two separate particle photons: one for the motion sensor and buzzer circuits, and one to control the Philips HUE bathroom lights using IFTTT. The motion sensor and buzzer circuit is shown in the circuit diagram below. The second particle was only used as a standalone communication relay, and was not part of any circuit, so there is no diagram for it.
The PIR sensor is a basic 3-wire sensor. One wire for power, One for ground, and one output signal back to the photon, pin D0. D0 is set as a digital read pin, so it is LOW if there is no motion, and HIGH if there is motion. The code is written so that if there is motion, the D7 led lights up on the particle, and the Buzzer would beep an annoying sound pattern that we set with delays of the LOW and HIGH outputs of pin D6 (see code). The buzzer was hooked up to an NPN transistor to boost the output current from the photon and amplify the beep sounds.
The time delay for activation of the motion sensor was set to .5 seconds, as anything longer would for some reason create at least a 10-15 second delay between when the sensor would be able to detect motion.Part 2
The motion sensor photon was also set up to create two Particle.publish events for either motion, or no motion. The second photon, then subscribed to those events, and was set to illuminate its D7 pin and output to a Partice.variable whenever there was motion. The variable was a digital read of the D7 pin, so LOW corresponded to a 0, and HIGH corresponded to a 1. We then used IFTTT to monitor the variable and connect it to our Phillips HUE lighting system. Whenever IFTTT reads the variable as 1, indicating motion in the bathroom, the WiFi connected bathroom light bulbs blink and IFTTT sends a notification to my iPhone as pictured below:
Also using IFTTT, whenever motion is detected, it sends timestamped data to a Google drive spreadsheet with the value of the variable, which in this case is always a 1 if there is motion. So it will simply graph the time and date whenever there was motion detected, as you can see in the picture below.
There are some limitations to our system. It's difficult to tell if this thing actually scares the dogs out of the bathroom or not, since the motion sensor doesn't seem to send a signal to IFTTT every time it is tripped, especially when it is tripped multiple times at short intervals, say a few seconds. If we got multiple trips close together it would probably indicate that the dog was still in the bathroom drinking, but from the data we gathered it appeared that IFTTT will only do 1 data point per minute, even when we intentionally trip it every few seconds. However, everything functions as it should in the bathroom. If there is motion in the bathroom, it beeps and blinks the leds on both photons, as well as blinking the bathroom lights and sending the data to google drive and a notification to my iPhone.Video
Below is a video of everything functioning.