Dog Fountain

Dog Fountain

The Garden's fountain for the dogs based on Arduino

Introduction

The project started with 2 dogs in a garden and bowls always empty or fill with dirty water. Dogs like fresh water, and two monsters of 100 lbs can consume a lot of water especially under the "hot" California climate.

The first approach was to use an "Outside Faucet Dog Waterer", a mechanical valve put on a faucet and activated by the dog tongue. One dog, the youngest one, try without consistent success and usually finished looking at me for help. The other didn’t even try to look at the valve.

I understand, with some training, both dogs can probably learn how to use a mechanical valve, just I found much more interesting to have a system more intuitive for the dog.

This experience shows:

  • It’s not natural for a dog to go near a place where there is no water and push a "button" to get some.
  • The youngest dog is always ready to try something new, but the oldest one has apparently some strict manners, and for him a dog should drink from a bowl, not from a faucet.
  • When a dog sees water, or hears a water flow, and he is thirsty, he will come to see, and that is without training ;-)

At this point, the only solution was a robot to serve water to the dogs on demand ;-).

Some ideas:

  • Start the water when dog approaches to get his attention.
  • Avoid to stop the water when dogs are drinking (dog have a moderate sense of humor),
  • Stop the water when the dog walks away (bill payer have a moderate sense of humor).
  • Have a bowl placed under the faucet to respect “papa” dog habit,
  • Try to not overfill the bowl, ideally balance the water output with the dog input.
  • Try to have a simple design, simple to build.

The result

It is now (as July 2014) for almost one year the fountain is online, the dogs use it every day. I get 2 freezes of the fountain during the year, a simple power off/on solved the problem.

Build Overview

The fountain is mainly composed of two parts:

  • the brain, including CPU, sensors and relay
  • the valve and faucet.

The existing wall faucet was too low for the dogs, and too cluttered by hoses. A garden hose is used to deport the fountain.

The fountain faucet is placed on the top of a bowl.

Components

Components of the Garden's fountain for dogs

Water Valve

Valve location choices

Initially the valve was positioned at the extremity of the hose, but when the valve was closed, the water pressure was expanding the hose… and when the valve open, the elasticity of the hose added to the water pressure was generating a small jet of water...
and dogs didn’t approve that.

Moving the valve next to the wall faucet solved this inconvenience and we became friend again.

Analyze of the valve

I used one valve I had in stock, not too expensive and easy to find in store.

This valve is designed for battery powered controller, and gets two stable states.
A DC current pulse is used to change the state between open and close.
The polarity of the pulse defines the movement direction: open or close.

By testing this solenoid at various DC voltages, it appears that it could actuate down to 11V DC with a current of about 1.4A.

Current and voltage at the valve when the valve open or close

Note:

  • Yellow shows the voltage at the valve
  • Blue shows the current at the valve.

Valve open

State

Notice the pick of back-emf at the end.

If we zoom at the beginning of the pulse:

we can see some fluctuation at the beginning, but nothing really bad.

On the other side, at the end of the pulse, we clearly see a back-emf effect when the current stop

Valve Close

State

Timing

To estimate the pulse length needed to actuate, I recorded the valve sound and compared for different pulse length the variation of the sound envelop.

Valve Open


10ms pulse


25ms pulse


50ms pulse


50ms pulse with water flow, without the relay noise.

Analysis:

  • 10ms pulse compared to the 25ms pulse shows missing power in the second part of the sound wave. 10ms is too short.
  • On the other side 25ms compared to 50ms does not show any improvement.
  • Presence of water flow does not seem to impact duration.

Valve Close


10ms pulse


25ms pulse


50ms pulse

The close pulse does not show any difference starting at the 10ms pulse.

Detail of a 50ms pulse

Following captures show a 50ms pulse during the open and close.
First, only the relay sound is recorded. In the order: relay 1 open, close, relay 2 open, and close.
We can verify the time between the relay: open and close is timed to 50ms.

Then, the relay and valve are recorded, with the same sequences.
We can see much stronger noise created by the valve just after the relay actuates.
We can also verify the margin between the pulse duration and the valve movement duration.

Conclusion

A 20ms pulse should open the valve, and a 10ms pulse should close it.
Closing the valve is an important step to avoid leak. Better to have a lot of margin here.
To make it simple, we can set the pulse to 50ms in both directions.
Open and closing of the valve does not happen often, valve is outside, solenoid temperature should not be a problem.

Valve Connector

The Orbits valve gets a very small power cable, I needed a little more.
The valve connects to a male connector not available in store, but creating one is pretty simple.

We use 1/16 (1.6mm) solid wire solder to a 2 wires extension cable.

We add Heat-shrink tubing around the soldering, and use a smaller solid wire to keep the distance between the 2 solid wire pins.

The smaller solid wire is turned around 2 pins providing a rigid assembly.

The pin space between the cable are filled with hot melt glue, using the transversal solid wire for support.

When cold, we cut the two pins to the correct lengths, and smoothing the extremities. The white cable (positive) connects to the open pin of the Orbit connector.

Waterproofing needs to be added.

Valve Relay

The relays are used to commute the valve. It is a simple solution to commute 12V 1.5A.
Each relay gets a contact normally-open and normally-close. Pulling to low IN1 or IN2 switch the relay.
Two relays are needed to generate 3 states: Open Pulse, Close Pulse, and Stay.

Valve Connection to Relay

The following table describes the action or the relay input on the valve:

IN1 IN2 Open Pin Close Pin State Description
Low Low 12V 12V Stay Keep valve state (not used)
Low High 12V GND Open Pulse Valve switch to Open
High Low GND 12V Close Pulse Valve switch to close
High High GND GND Stay Keep valve state

Reference:

Fountain Sensor: Proximity

The HC-SR04 Ultrasonic sensor is inexpensive and popular. It can determine the distance of an object from 2cm (1”) to 3m (10ft) or more.
The detection area is very narrow, about 2 degrees.

This sensor emits an ultrasonic sound (ping) and the time for the echo to come back gives the distance, like an active sonar.

This sensor gets few drawbacks:

  • It is an active sensor, not sure how long before it will fail with continues operation.
  • False positive if a fly is moving on the front of the sensor.
  • Dog seems to hear the ultrasonic sound, and they might ignore if present continuously.

And some good sides:

  • Dogs hear the ultrasonic sound, they can associate the sound with "Hey! Remember! Water is here!”.
  • The sensor returns a distance, perfect to fine control of the valve activation.

Reference:

Fountain Sensor: PIR

PIR is also inexpensive and popular. It can sense motion of human or animal (heat source) up to 6m (20 ft).
The detection area is wide, almost 180 degrees.

This sensor gets few drawback:

  • It detects only movement of heat source, when the movement stops (dog drinking) the detection also stops.
  • The PIR is sensitive to a lot of unwanted type of heat movement, like a flow of hot air, or the cloud that creates moving sun ray on the ground. Outside a PIR can generate a lot of false positive detection.
  • Also the PIR gives a very basic information (movement detected) but lack details like the direction of the movement or if the dog is currently drinking, that will make difficult to optimize the water usage.

And some good sides:

  • Passive, silence, and probably long life. Does not disturb the environment.
  • Large detection area, can see the dog coming from far.

References:

Sensors usage

The idea is to use a tandem of two sensors to detect dog presence and trigger the water flow.

Using a combination of both sensor can improve the detection:

  • Initially the ultrasonic sensor is turned off.
  • The PIR sensor “scans” the region around the fountain.
  • When a dog approaches, the PIR detects the movement and the Ultrasonic sensor starts.
  • When the dog reaches the fountain, the Ultrasonic sensor triggers the water fountain
  • When the dog leaves, the Ultrasonic sensor triggers the fountain stop
  • After a while, if no more movement, the PIR stops the Ultrasonic sensor.

Feedback: RGB LED

The LED is very useful to debug the fountain code.
At night the box is glowing with a pulsing white light when the fountain sleeps... very nice effect.

LightBox

The RGB led provides the following feedback (in order):

Light Description
Green Near presence detected (ultrasonic)
Yellow (Red+Green) Far presence detected (ultrasonic debug)
Red Motion detected (PIR)
Blue PIR was recently triggered, but no more
White pulsing Fountain is sleeping
Black Do you have power?

Note:

  • The table order indicates what will be the feedback if multiple sensors are trigged at the same time, for example if we have both the PIR and ultrasonic, then we will get only the Ultrasonic indication.
  • The white pulsing appears if nothing else is present.

The Arduino Nano can provide up to 40mA for each pin.

We do not need the usual 20mA per LED, 9mA should be enough for our usage. From the measure of the forward voltage for each color, we get the value for each resistor

Color FV ohm
Red 1.7V 180
Green 2.4V 100
Blue 2.5V 100

CPU

The fountain is based on an Arduino nano, small and inexpensive.

References:

Fountain Body

The COSTCO Band-aid box fits very nicely for the purpose.
The good size, and the compartments inside fit the Arduino and relay almost perfectly.

Power Supply

A standard power supply is used, and a connector is added to the bottom of the box.

Note: The same connector is used to connect to the valve.

Schematic

The schema is pretty simple, few soldering are needed.

A capacitor (470µF) was added to the power line energizing the valve.
The capacitor provides a reserve of energy for the valve, and removes all visible back-emf to the power line.
Without the capacitor, the Arduino is completely unstable.

Note: the capacitor cannot be place directly on the valve because of the valve inversion of polarity.

Most connections use Female to Female jumper cable.

The “hat” is a cut from a plastic envelope, fixed on the top of a Band-Aid box.
That was nice looking hat... but after a year the plastic didn't survive the sun :(

Parts and Cost

Description Reference Quantity Price Store
CPU Arduino Nano v3.0 1 $13.99 Amazon
Valve Orbit extra valve 1 $13.56 Amazon
Sensor 2-Channel Relay Module 1 $7.18 Amazon
Power Supply DC 12V 1.5A 1 $7.00  
Connector 2.1mmx5.5mm DC Power Jack Socket Female 2 $5.32 Amazon
Sensor HC-SR04 Ultrasonic Distance Sensor 1 $3.13 Amazon
Sensor HC-SR501 Human Sensor Module Pyroelectric Infrared 1 $2.67 Amazon
Component Resistors: 1x 180 ohm, 2x 100 ohm 3 $0.10  
Component RGB Led ($2.67/50) 1 $0.05 Amazon
Component Capacitor 1 $0.03 Amazon
Cable 20cm Female to Female 2.54mm 0.1 Inch Jumper Cable Wires Connector ($3.99/5) 1 $0.80 Amazon
Box COSTCO’s Band-Aid (Recycling) 1 $0.00 COSTCO
Total     $53.83  

Prototype & Test

Testing the PIR and Ultrasonic distance sensor.

First prototype and it's beautiful box :)
Notice the relay directly connected to the wall faucet.

Test of all components before integration.

Testing a configuration of the fountain faucet. The valve and the "jet" effect.

Testing of the valve

A simple setup to test the valve. The valve is controlled by 2 switches.


Download from GitHub  


The Garden's fountain for the dogs based on Arduino.

  • Actuators / output devices: valve
  • CPU: Arduino Nano 328
  • Operating system: Arduino
  • Power source: 12V DC
  • Programming language: sketches
  • Sensors / input devices: SRF05 Ultra Sound, PIR sensor
  • Target environment: outdoor

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/dog-fountain

This is one of the most useful bots I’ve seen!
Being a dog person, I really love it.

I’ve been trying to think of ways to make my bots more dog-friendly because we’re going to get some as soon as we can get at least a six month stretch when Lee doesn’t have surgery.

Maybe I can have the bots that are capable of doing so feed and water them or maybe give them treats occasionally. I wonder if I make a nice enough arm, would a dog let a robot pet her?

Thanks you, it is indeed a

Thanks you, it is indeed a simple bot but efficiant. 

On the side note, I will never let a bot give them a treats, or pet them… that is my pleasure :slight_smile:

My comment was mainly just a
My comment was mainly just a thought experiment because I’ve never gotten a dog anywhere near even a hair dryer. My little Lego bots scared the girls silly back when.

I’m just trying to think of ways to allow my bots to interact with our dogs without the dogs running and hiding or trying to attack the robot. One of the girls (Amber the Sheltie) would run up and bite the vacuum cleaner then run away. I’m still not sure if she really was thinking she was protecting Chaos (the other dog) from the vacuum, or if Amber thought this was just a game we were playing.

That’s just cool :-)I know

That’s just cool :slight_smile:

I know that some people make everything very accurate and that one is the proof :wink:

I did not expect to find a graph from an oscilloscope in such a project. However, I am sure your dogs don’t mind and they will have fresh water all the time. How about a level sensor on the bowl and stop the fountain when there is enough water in the bowl? I mean, you need to pay the water and even a bowl each day will make a difference over one year.

I think it is a mix of

I think it is a mix of curiosity and frighteness, difficult to say without seeing the body language of the dog.
She probably try to evaluate the thread of the bot… by doing guerrilla attack

My only experience was when I build a big 6 wheel bots (based on the beautifull Wild Thumper). The dogs didn’t attack it because they know somehow it was my stuff, but they was afraid of it, especially when moving to them. I didn’t finish the project yet, and didn’t have the occasion to resolve the conflict.
The same happend when I vacum the floor, they almost run away… I even see the dog barking at a door, when the door moved unexpectedly.

They need to get used of forein entity, especially the one that move. I will let my bot next to the dog for few days without any movment, them make it move it a little while petting the dog, just to associate the bot with positive feeling, and progressivelly they may get use of it. I think it is similar to when you try to get the pet used of the grooming clipper.
Ultrasonic sensor are good, because dog hear them (and not you) and they are not surpise when the toys approach.

Now my experience with pet are limited, just have 2 big and old guard dog for about 2 years, I develop a good empathy link with them, and can almost know what they want every time. They are usually pretty placid with me around, for small dog it may be more difficult to get use of moving entity around them.

Thanks you for your good

Thanks you for your good words,

Was important to make this little fountain reliable, and the valve was not documented. Didn’t want my dog to miss water :slight_smile:

I did think about a level sensor on the bowl, but not exactly for the same idea.

After few few hours the bowl water become warm, after a day the water become durty, and we have mosquito… I do not like to provid mosquito breeding nest :slight_smile:

The fountain water flow is very small, the boll is usually half full by the end of the day, and never overflow. Every morning, or so, I empty the bowl, and clean the bowl time to time.

The water sensor idea was when evaluating about adding another valve in the bottom of the bowl. The idea was to empty the bowl preiodically. The water was expected to evacuat to the garden flower (no waste). But I didn’t find an “evacuation” valve I like, that didn’t solve the problem of cleaning the bowl, and finally dogs doesn’t go to drink so often (or I do not go aways long enough) to need a so complex system.

Finally the choice was to have a small water flow at the fountain (what doesn’t seem to annoys the dog) to prevent the bowl to fill too quickly. When dog drink only a small part escape from the dog and go in the bowl, the older dog drink in the bowl at about the same speed the bowl fill up. The switch on/off of the fountain is timmed short to avoid waste.

two point that may not be

two point that may not be clear from my previous post:

- Dog doesn’t like much to drink durty water, they usually come to bug me to changes the water.

- Dog like reproductibility, on the early tests, when the fountain was disconnected between test, and dog was trying to get some water out of it, they were puzzle. I’m not sure dogs will understand “if bowl almost full then no more water will flow out of the faucet”… but they understand “If head near fountain and noize present then get fresh water”… if that happend (almost) every time.

Ok, understood, dogs are

Ok, understood, dogs are more picky than me :slight_smile:

I will watch this project further, even I do not have a dog but i am interested in the approach and the result.