Here's a video of the AquaNiner in action!
Do you have a furry friend? Are you forgetful when it comes to keeping enough water for them? Then the AquaNiner Pet Hydration Monitor is for you! This system uses a two step process to monitor pet water level and alert you by email when your pet needs more water. The system consists of several different components:
Non-contact liquid level sensor
An Arduino Non-Contact Digital Liquid Level Sensor was modified for use with the Particle Photon. This sensor uses advanced signal processing to quickly determine if there is water present on the other side of a container or not. Though layered containers are not ideal, the sensor works well for our application. Plus, being a non-contact sensor, there is not current running through the liquid like with other sensors, making it safe for pets to make contact with the water.
NOTE: For best results, attach sensor to a relatively flat surface. Curved surfaces do not guarantee a good measurement.
HC-SR04 Ultrasonic Distance Measuring Transducer Sensor
The ultrasonic distance sensor acts as a second check, verifying the exact volume of the water while also tracking it using a webhook through ThingSpeak (more details on this later in the story).
Water dispenser before modification
The container used is a combination of water bowl and tank. The tank uses pressure differences between the inside of the tank and surrounding environment to keep the water level constant. The tank required some modifications for the ultrasonic sensor. This sensor requires line of sight to measure the distance to a point, so it would need to be installed into the tank.
Three holes were drilled into the top of the tank using a boring drill. The ultrasonic sensor was inserted into two of the holes, while the third hole was adapted to allow water to be inserted into the tank from the top. This was done by using a caulk/epoxy mixture to attach and seal the ultrasonic sensor to the top. The hole for water insertion was adapted in a similar manner. In this example, a water bottle top was attached over the hole. The non-contact liquid level sensor was the attached to a flat part on the bottom of the tank at the level we wanted to be the minimum allowable water level.
How the Sensors Interact Through Code
Each photon contains a different code governing their reactions to the responses from their respective sensors. The first photon identifies whether water is present at a given level using the non contact water sensor. The first photon then publishes a string to the second photon indicating whether the water is at the desired level or not. The second photon is constantly monitoring the water level. When the second photon receives the string from the first photon indicating low water level, it then compares that with the water level it is currently reading. If both sensors agree, a string is sent back to the first photon, letting it know that the dog needs water. Finally, the first photon sends a string to IFTTT triggering an email, text or phone call.
1 / 4 • Situation where water needs to be refilled
In the situation where the photons disagree and there is some sort of error in the code, error messages are sent out appropriately. SENSORERROR is sent out if the non-contact liquid sensor indicates low water but the ultrasonic sensor does not. SENSORERROR2 is sent out if the non-contact sensor indicates an acceptable water level but the ultrasonic sensor does not. In the case where both levels are acceptable, no action is taken.
IFTTT Email Notifications
Monitoring Quantity Drunk Over Time
Using this tutorial provided by Particle, integration with ThingSpeak was made easy. Here's a screenshot of our ThingSpeak graph:
ThingSpeak graph of distance from the top of the container versus time