Let's Make Robots!

Dog needs water alarm

Beeps then the dog's water bowl is empty
dog-needs-water.cpp1.76 KB

For a friend of mine I made this small alarm that goes off then the dog's water bowl is empty. We set the following design goals:

  • cheap
  • battery powered
  • maintenance free
  • rugged sensor

And here we have the result, an ATmega328p running slow at low voltage, draws only a little current, will make the 3 AA cells (well spent recycled from my mouse) last for quite some time. I have clocked the 328 all the way down to 128KHz, and the current draw is as low as 24uA when the supply voltage is 2.4v.

The sensor is made by putting two bolts through the bottom of the bowl and simply test if there is electric conductivity between them.

Most of the time the atmega328 is in some deep sleep mode there only an timer interrupt wakes it up from time to time. Then awake the program tests the probe and if no conductivity, squeeks it's tiny beeper, and then back to sleep.

The beeper is one of those small capacitive ones from postcards. I drive it between two pins in a push pull setup to maximize the output.

After assembly on stripe board it looks like this:

Note. An annoying lesson (re)learned: When running off the internal 128KHz oscillator it's too far away it's calibration to make serial code upload via optiboot possible. I had to program the chip via ISP instead.

Update 13.Oct.2012

Based on feedback received from you my friends I have made completely a new version. New features:

  • cheaper parts (I have not done the math in details)
  • smaller, with on board battery
  • less power usage, as low as 200nA when idling.
  • Louder beep!
  • Not using a micro controller any longer, nor any software. (boring)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Please post your analog circuit. The transistor simply cut-off and needs theoretically not any current during that phase. You can build such a circuit with just one or two 1.5V batteries. Btw, any long term water level sensor based on water conductivity should be designed in a different way: apply AC voltage instead of DC voltage to the electrodes to avoid corrosion of the electrodes by electrochemical processes. According circuit diagrams you can find in the internet.

I don't have an analogue version of the circuit, I could not make it as low power as I could with the uC. Remember most of the time there is water in the bowl.

I'm not sure how much electrolytic corrosion I will see. Most of the time there is no sensing current, and then it's actually sensing it's 2.5v through an 8.2Mohm resistor.

But agreed, perhaps I should rewire the circuit a little to and make the software reverse the current for each other sample.

Well, you could use for instance a transistor in NOT-gate configuration.

It was also my thought to reverse the polarity of the sensing electrodes from time to time. I was also thinking to measure the conductivity of the water itself. I guess the water is getting more conductive with dirtying, so increased conductivity could be a sign to replace the water as well.

Question is if it will be a simpler circuit with the same low, or even lower current draw? My calculations says it will run for 10 years on two fresh AA's.

As said, I tried some simple transistor configurations but the all ended up using even more current or involving quite a few transistors. And then they would still not be able to reverse the detection polarity or using AC.

The only place where I admit to have made a blatant overkill is the choice of uC. I could have made the same circuit with an attiny13a, but the difference in price where not that important in this circuit, and my drawer only had the 328's if I wanted pico-power.

And while we are at it, actually my friend have requested to an addition: an IR led and the code from tv-b-gone. Dog out of water -> TV turns off!

The current draw at sensing mode is then

Let's say, R1=10 MΩ, R2=4 MΩ, saturation cut-off current of the Darlington transistor Is=10-16 A and capacity of AA battery CN=0.3 Ah

We get

Operating time t in sensing mode is then