Touch sensitive pet watering (gravity fed)

Hello from an absolute newbie to electronics.

My family has several guinea pigs using the typical small animal watering bottle with a bearing to stop the water flow. When the piggies push the ball bearing, the water drips into their mouth. The systems works but also leaks (sometimes more leaking than drinking). I estimate 25% of the water is lost by dripping when no pig is drinking. This means that a bottle holding three days of water really only lasts about two days.

I had some time on my hands and have always wanted to learn some electronic project basics.

My idea was to place a valve between the water reservoir and the metal spout. I got some inspiration from out capacitive touch kitchen faucet. The idea is that the valve opens when the piggie puts their mouth on the spout. The ball bearing remains in place so the water doesn't free-flow but it limits the amount of water available to leak out.

Thanks mostly to AI (Google Gemini Advanced, in this case) I now have a working breadboard proof of concept using an Arduino Nano 3 (the Elegoo version) with the CapacitiveSensor from the IDE library. I initially ordered a 12v Keurig solenoid valve but switched to a 5v .22A solenoid valve for simplicity.

Breadboard photo

So, now I have this tangle of wires on my breadboard as a proof of concept but I am a bit stumped on how to translate this into a usable device that i can affix to the cage etc. Unfortunately, I can't quite visualize the next step in building this out.

Any suggestions on an approach would be helpful. Thank you in advance.

If they can drink out of a bowl, this doesn't need electronics or mechanics. When the water in the bowl falls below the bottle, air comes-in and water comes-out until the opening is blocked by water again.

Use in rat labs for centuries. The "sipper."

Step 1 is to draw a schematic of what you have breadboarded.
Step 2 is to translate that schematic to a protoboard and solder wires together.

an air trapped bowl with reservoir would work well for a larger pet, but these little critters lick from a tube. They pretty much poop in anything resembling a bowl... even their food dish.

This is exactly what we currently have. The issue is really the amount of water lost through excess dripping. I have purchased many models and brands of this type. They all say "no drip" but it just isn't the case.

Thanks for your response. ok. I don't know how to hand draw an electronics diagram but I did download Fritzing. I gave it a go for a bit but it wasn't looking very pretty. But, based on your recommendation, I will give it a bit more time to learn it.

Would I be soldering directly to the nano or should I be moving towards a pcb into which the nano (with headers) plugs?

Temperature variations (not tap water at 55f/13c, but tepid water at 75f/25c), tube length and lumen sized to allow air pressure trying to get into the water bottle to exceed water pressure (gravity) trying to get out of the bottle, and a shallow pan (dish, lid) to catch drips and evaporate.

If I understand correctly, your recommendation for how to proceed on an electronics learning project is to use tepid water and a dish. Sort of misses the point here. I think if you took a walk instead of typing, it would have been more useful to me.

Living beings are not for learning electronics. I hope the animals escape and chew on your house wiring.

Fritzing is actually less than useless for communicating anything. The drawings might look nice but they are ambiguous. If you're going to make progress in the hobby you'll have to learn to draw at least basic schematics. Simply blocks with pins labelled and interconnecting lines will get you 80% of the way.

Adapters like these make it easy to connect nanos to other components.

1 Like

So did you already made a touch sensor like this one ( using this library )?

td_libs_CapacitiveSensor_1

And also have a 5V valve?
I think you need a relay ( or a mosfet transistor ) to turn on the valve.
I think the circuit should work like this: as detector senses something/someone turn on the valve for an amount of time ( 1 min ), in this way the valve will be open as long the sensor sesnses something and will close 1 min after the sensor senses nothing.

  • Test the sensor with the example provided in the library, once everything works proceed
  • mount the board and the sensor 'in place' and 'ask a guinea pig to be a cavia' pun intended ( in italian cavia is someone undergoing a test ) only to verify the sensibility with the 'beasts' ( and sensor positioning too )

Check also that the valves work properly when open and when close, I mean water pressure in the bottle is low verify that is enough to let water flow once valve opens. also verify that the case when the circuit under the valve is empty ( if it empties at all with valve closed )

Thanks. I will get out a sketch pad. I was wondering whether to get a terminal adapter shield next. on order now. thanks again. :slight_smile:

Paul

Very Pun-ny indeed. :grinning:

Thanks for your other recommendations as well. I think I am on the right track.

I'll include a link to a short video of the function so far. This has been an iterative learning project.

  1. I started with an LED blink,

  2. then added in the capacitive touch switch using a 1M Ohm resister and a coin (to operate the LED). Once that was working I swapped out the coin for a water spout.

  3. I initially thought all I would need to do was replace the LED for a 5v solenoid valve and voila! Not so fast... that was obviously wrong because the current draw would have been too high.

  4. After more consultation with Gemini, I built the solenoid circuit using an S8050 (NPN) transistor and 1k Ohm resistor.

  5. I then tinkered with the timings etc keeping in mind how the Piggies actually use the spout. They place their mouth on the spout then lick to push the ball bearing in and release. They rapidly lick 5-10 times, before taking a break for a second or two. sometimes they remove their mouth for a moment then restart.
    a) an open signal is triggered the moment the pigs touch the spout. (To this point I have used my finger to simulate that, so I know that I will need to recalibrate the capacitance value to suit the pigs. I also anticipate variation in capacitance based on the presence and characteristics of the water).
    b) The signal continues for 2.5 seconds after last contact. ie. it closes after 2.5 seconds of no contact.

[Video of basic function](https://photos.app.goo.gl/eqwfcpsjPxvGBR826)
The light is triggered at the same time as the valve. You may be able to hear the slight click of the solenoid.

My code is as follows:

#include <CapacitiveSensor.h>

CapacitiveSensor Sensor = CapacitiveSensor(4, 6);
long val;
#define ledPin 13
#define valvePin 7
unsigned long touchStartTime = 0; // Variable to store when the touch started

void setup()
{
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    pinMode(valvePin, OUTPUT);
}

void loop()
{
    val = Sensor.capacitiveSensor(30);
    Serial.println(val);

    if (val >= 10000) 
    {
        digitalWrite(ledPin, HIGH); // Turn on LED if touched
        digitalWrite(valvePin, HIGH); // Open Valve if touched
        touchStartTime = millis();  // Record the time when the touch began
        Serial.println("OPEN"); // Print valve state
    }

    // Check if 2.5 seconds have passed since the last touch
    if (millis() - touchStartTime >= 2500) 
    {

It seems perfect to me, your are using the metallic part of the 'dripper' as the capacitive element.
May I only suggest to put a diode in parallel to the solenoid ( 1n4007 or similar, catode connected to +5V ) to clip the extravoltages when solenoid is opened.

I'm not sure I am understanding "parallel" in this context. Do you mean placing the diode between the solenoid and the 5v rail?

Leave the solenoid connected as is.
Add the diode, catode connected to +5V, anode connected to collector of transistor.
Any inductance generates extravoltages when current is turn off, this cuts these voltage spikes that could damage the transistor

1 Like

How can I determine if I have the diode polarity correct and its working as expected?

Diode Placement

The white goes to the collector, the red goes to the 5V+.

*** oh I think I got it. one direction the valve worked, the other way it did not. *** Does that sound about right?

Have you now made sure that a piggy’s capacitance does reliably open the relay? If not consider a sensitive micro switch on a pivoted platform (acting as leverage). I used that successfully on my ‘Humane Mouse Trap’ a few decades ago - although it was, of course, cheese my targets were after, not water.

P.S. I do not use Google Photos so have seen neither your photo nor video.

1 Like

I'm still at the breadboard stage (waiting for housing on order) so have not done any testing with the guinea pigs yet. I do have some more ideas to explore after I get this done... Perhaps a pressure sensitive plate to weigh them each time they come to the water. We have three pigs so it would be interesting to have a camera recognize which pig is present, record its weight and display some info on an eink screen.

I should learn a bunch though that project.

With respect to the photo/video link, I am new to the forum. Should I be uploading into the forum or Arduino Cloud somehow and then linking to that?

In the meantime, I think the links work without a Google account.

Paul.