Automatic Garden Waterer | 3D Printed | Arduino




Introduction: Automatic Garden Waterer | 3D Printed | Arduino

I'm a keen gardener but watering your plants by hand during dry spells takes some time. This project frees me from watering, so I can work on my other projects. It's also great at taking care of the garden whilst you're away from home, and the plants benefit from the more regular watering.

It's powered by a USB port so that you can connect it to various sources of electricity. Such as an outdoor power socket or USB powered battery with integrated solar recharging. You can also customise at what time, day or night, your plants are watered. I currently have mine watering the hanging baskets twice a day. Once in the morning before sunrise and then they get topped up again just after

Step 1: Video

If you prefer to follow along with a video then I have made one which you can watch, otherwise read on...

Step 2: Bill of Materials

You'll need a few things to build one of your own:

■ Elegoo Arduino Nano (x1):

■ Servo (x1):

■ Real time clock (x1):

■ Hoselock compatible connector (x2):

■ Wire:

■ Hoselock compatible inline valve (x1):

■ Nuts and Bolts - M3 x 10 (x3):

■ ABS Filament:

■ Long Usb cable (x1)

■ USB wall plug (x1)

If you would prefer to use PLA filament I have good success with this one:

■ PLA Filament:

Step 3: 3D Printed Parts

There are three printable parts to this project. The inner and outer case and 'the coupling'.

You can download the 3D models here:

I have printed all of my parts using ABS plastic. You could use PLA or PETG but just know that PLA is the most likely to degrade in outdoor conditions or inside a greenhouse. In the images are the three 3D prints I did as well as the setting that I used for each.

Step 4: Connect the Servo

I'm going to be soldering all of my connections in this project as I will be permanently installing this into my garden. If you prefer you can use jumpers and a breadboard to make the same connections as I have with the one in the photo.

There is a circuit diagram available here if you prefer them:

First we can strip the plug of the end of the servo wire and solder this directly to the nano. There are three wires on mine, the red and brown wires are attached to the power and ground so I will attach these to the Arduino's 5V and ground connections. This leaves the orange wire which is our signal wire. This needs to be connected to digital 9 on the Arduino.

Step 5: Connect RTC

Now we can turn to the Real Time Clock or 'RTC' as it is often shortened too. We will be using four pins. You will need to prepare four 7cm long lengths of wire for this.

As before the ground lead is connected to ground and VCC to same 5V power supply the servo was just connected to. The SDA pin connects to A4 on the Arduino and SCL to A5.

Step 6: Uploading and Customising the Code

Use a USB cable to connect it to your PC and open the Arduino IDE.

You can download the Arduino IDE here:

This project uses the handy DS3231 Simple library:- Please follow the instruction on installing this provided on the libraries page

And the code for the project can be found here:

Before you upload the project main code you need to set the time on your DS3231. Once you have connected it as shown and have installed the DS3231_Simple library (see above) go to 'File' >> 'Examples' >> 'DS3231_Simple' >> 'Z1_TimeAndDate' >> 'SetDateTime' and follow the instructions in the example to set the date and time on your RTC

In the main loop of the code are two IF statements which check the time and then initiate the watering sequence for a specified amount of time. The conditional check of the IF statements checks to see if the value of the hours and minutes from the clock match what we have set here. If they both match then the 'Open Valve' function runs, followed by a delay.

This delay (set in thousandths of a second) determines for how long the water is allowed to flow through the hose to your plants. You can have as many of the statements in the main loop of the code as you need.Just copy and paste them whilst updating the conditions of the IF statement and duration of watering (the delay between opening and closing the valve).

Step 7: Fit the Valve

Once you have finished programming your watering schedule we can disconnect it from the computer and begin to complete the assembly.

Use one of the M3 bolts and nut to secure the servo into position as shown in the photo. We only need to secure one of the holes to hold it sufficiently.

The servo should have come with an assortment of arms that fit to it. We want to fit the straight armed one. When we turn the circuit off after uploading the code the servo should have been left in the valve closed position. So when we fit the arm you want it to be vertical.

Now rotate it 90 degrees anti-clockwise until it is horizontal. Slide in the inline valve and fit the coupler we printed onto the servo arm. The next bit does require quite a bit of force but you need to rotate the valve towards the coupling whilst pulling it away from the servo. It will take force to pop it into place, but we only need to do this once.

Step 8: Connect the Cable and Attach the Cover

I'm going to use a 10m long USB lead to connect it to my outdoor power socket to power mine. Let's connect the Arduino end of the cable now and finish of the enclosure.

I've soldered my connections directly to the board so I'm just going to squeeze my electronics into place inside the enclosure. If yours is on a breadboard you can use the self adhesive backing to hold it in place on the ledge provided.

There are two screws that need to be inserted to complete the housing. This should keep it fairly weather resistant whilst kept upright. If you wanted to secure it to a plank or floor there are two screw holes (one underneath the inline valve and one inside the enclosure - you would need to secure these to something before proceeding with the assembly as they cannot be accessed afterwards.

Step 9: Connect It Outside

Let's now take our project to the garden.

I will install the project between my tap and hanging baskets. Earlier I installed a drip irrigation kit by Hoselock to each of my hanging baskets. This is the one I've been using with good success:

Now we attach this to our hosepipe between the tap and irrigation kit using the two of the quick fit connectors.

I powered mine with the long USB cable connected to an outdoor socket.

Step 10: Project Complete!

And that's it, my hanging baskets will now take good care of themselves until early Winter. :)

Thanks for taking a look at my tutorial. I hope you've enjoyed this project. If you have please think about checking out some of my other projects, don't forget to subscribe to DIY machines on here and YouTube and share this project with anyone you know who might like to build one of their own.

Otherwise until next time chow for now!

Subscribe to my Youtube channel:

Support me on Patreon: :


Be the First to Share


    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest
    • Big and Small Contest

      Big and Small Contest



    Question 3 years ago

    Filament prints aren't typically waterproof. Did you treat your ABS to an acetone bath or vapor treatment? If not, do you feel that this would be reasonably resistant to rain?

    DIY Machines
    DIY Machines

    Answer 3 years ago

    I did not treat mine, though this would certainly help the prints waterproofness. The waterproofness provided by using a few solid walls when slicing prooved to be enough to prevent vertically falling low pressure water from enetering. During the testing of the design, we had a very heavy downpour of rain and this did not ingress.


    3 years ago

    I'm wondering why you used a servo to turn a tap instead of a solenoid valve? If power consumption was the concern, you could opt for a bistable solenoid valve so it wouldn't draw current while open.

    DIY Machines
    DIY Machines

    Reply 3 years ago

    It was because of power consumtion. A solenoid was my first thought. However, I had not been introduced to latching / bistable solenoids until you just introduced them to me. Thank you. You're correct, they would have been suitable. I'm likely to use them in a future project. :)


    3 years ago

    Wow. I somehow never considered using a mechanical tap in an automatic watering system. I have tested various methods, like mini pups, solenoids, but they all had issues (mainly safety if you want to keep the cost down), but this is brilliant! and it can be easily adapted to various different taps as well and easy to scale up or down! thanks for sharing :)

    DIY Machines
    DIY Machines

    Reply 3 years ago

    Thanks. Yes I had looked at solenoids and similar but the power requirements were greater and it required ensuring watertight connections. This takes hose systems already well designed and just automates the turning of the valve. :)


    3 years ago

    What a great idea! Saving this for later. Have a feeling I'll need something like this once I set my greenhouse up :)

    DIY Machines
    DIY Machines

    Reply 3 years ago

    Thanks. My hanging baskets have never been better thanks to regular watering and the top-up they receive just after the midday heat. It's stopped my tomatoes from splitting as much as they usually would as well.