Automated Arduino Tap

6,234

57

8

Introduction: Automated Arduino Tap

About: I'm a high school student that thinks that school doesn't teach cool enough things. I'm trying to find my way in this world by exploring it. Instructables is a fantastic place to do that.

This project was designed for my dog, who refuses to drink from a water bowl. She often sits by the tap for hours waiting for someone to pass and open it for her. So I built her this automatic tap that opens when it senses her and closes again when she's out of range.

The whole setup is centered around a 20L bucket. This allows it to stand even where there is no tap. It uses a Arduino Nano as a controller, a normally closed solenoid valve as a tap and a 12V battery as a power supply.

I created this tap as a solution to a problem that, while most people probably never experience it, was quite a problem to my family. Trust me, there is nothing sadder than a dog sitting for probably half an hour waiting for someone to see her and open the tap. And then to stand there and wait for her to finish before you can go about your business can also be a nuisance.

Supplies

12V solenoid valve
Arduino nano
HC-SR04 range sensor
10K resistor
Diode
MOFSET (I used a IRFZ24N)
12V battery
Jumper cables
Breadboard
Female spade terminals for the battery and solenoid valve
Heatshrink
A bucket
About a meter of twin flex
Epoxy glue
Some plumbing pieces the same diameter as your solenoid. I used 2 elbow joints and 2 connector pieces
A strip of flexible metal
Some rivets
Two small plastic containers to protect your components from the elements

Step 1: Connecting the Circuit

Connect everything together as shown in the schematic above and mount it onto a mini breadboard.
The DC motor in the schematic represents the solenoid.
The reason for the MOFSET is that the Arduino can't drive the 12V solenoid by itself. The Arduino's output is only 5V therefore the MOFSET allows the Adruino to still control the solenoid while the battery powers it. The battery also powers the board through the VIN pin.
It isn't recommended to omit the diode. The solenoid opens and closes by means of an electromagnet. The closing magnetic field can induce a backward flowing current that damages the board.

Step 2: The Code

int trigPin = 12;
int echoPin = 11;
int valvePin = 9;
long distance;
long duration;
void setup(){
  pinMode (9, OUTPUT);
  pinMode (trigPin, OUTPUT);
  pinMode (echoPin, INPUT);
  
  Serial.begin(9600);
}
void loop() {
  ultra();
   
  if(distance <= 25){
  digitalWrite (9, HIGH);
    Serial.print("Distance: ");
    Serial.println(distance);
  } 
  
  else {
    digitalWrite (9, LOW);
  }
  
}
void ultra(){ //the range sensor's code
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration*0.034/2;
  }

Step 3: The Bucket: Part 1

Drill a hole the diameter of your solenoid as close to the bottom of the bucket as possible.
Screw the pieces together as shown, then screw the elbow piece into the rest through the hole.

Step 4: The Bucket: Part 2

First, mark and drill holes for the range sensor into its container (the sensor box). Drill another hole on the top for the wires to come out.

Next, cut a strip of metal and rivet it onto the top of the bucket. On the other end, rivet the container.

Put the sensor inside. Pull the wires through the holes and connect them.

Step 5: Assembly: Part 1

Drill holes on the sides of the other container (control box). Place the breadboard inside and string the wires through the holes.

Manipulate any components so that they fit into the box.

Step 6: Assembly: Part 2

Attach the solenoid's spade terminals to one end of two male-to-male jumper wires. Run the male ends through the control box's hole.

Wire the positive terminal of the battery to the VIN pin and the negative to the ground pin.

Step 7: Assembly: Part 3

Use the epoxy to glue the control box and the wires to the bucket.

Tidy up any other loose ends and you're done!

Step 8: Testing Your Creation

Finally, test your creation. Put the bucket on a stool or step or something, connect the battery and make sure everything works.

Step 9: Teaching the Dog

Possibly the hardest step of all if your dog doesn't already drink from a tap. Luckily mine does and she quickly realised that she doesn't have to wait for anyone to open this tap. The video is of her on her first go. She took to it like a fish to water. This is proof that you really can teach an old dog new tricks.

Well that's it. I hope you, and your dog, enjoyed this instructable.

Battery Powered Contest

Runner Up in the
Battery Powered Contest

Be the First to Share

    Recommendations

    • Jewelry Challenge

      Jewelry Challenge
    • One Board Contest

      One Board Contest
    • Raspberry Pi Contest

      Raspberry Pi Contest

    8 Comments

    0
    SteveCutts
    SteveCutts

    1 year ago on Step 7

    Another bit of learning for me. i.e. 1 Arduino project down and looking for others. It's ironic that an advanced micro controller still relies on a 'bent bit of metal' to make it work. Been there. Done that. :-)

    0
    Blackbeltrider
    Blackbeltrider

    Reply 1 year ago

    Very true. If you have a better solution, please share😊

    0
    JohnG184
    JohnG184

    1 year ago

    Good Job !
    I think about how sad it is for the dog to have to wait .... :-)

    0
    mebush427
    mebush427

    1 year ago on Step 9

    I'm a high school STEM teacher and I definitely agree with you about schools not teaching enough cool stuff. I've tried to change that for 30 years (www.theinsidescoop.tv). To see a high school student independently see a problem and design a solution is very encouraging. I would've been happy to have you in my class making cool stuff. Keep up the creativity and use of technology. Good luck.

    0
    panyamnikil
    panyamnikil

    1 year ago

    I've looked for a design like this on the internet, and finally we have this post! It's the same with my dog. I would love to try this out!

    0
    Blackbeltrider
    Blackbeltrider

    Reply 1 year ago

    I'm glad to hear mine isnt the only one. Happy I could help😊

    0
    MakersAtMicrosoft
    MakersAtMicrosoft

    1 year ago

    Fantastic project to improve accessibility for dogs! Love the demo video <3