Introduction: Flower Pot Watering System

This project is meant for learning a little electronics and Arduino programming. A real beginners project I would say.

The idea was to make a compact unit for watering flowers whenever they where in need of water. The system uses a stepper motor which is driven by a uStepper board to get a compact stand-alone system. I must mention that I am co-creator on uStepper, and this instructable is not meant as an advert for uStepper which should be reflected in the focus on the actual application and not the uStepper board in this instructable.

Now let's proceed to the fun part!

Step 1: Bill of Materials

For this project you will need to have access to a 3D printer, since there is 5 parts that will have to be printed. The mechanical parts (screws, nuts, bolts, bearings, 3D parts etc.) is presented on the technical drawing here.

Besides these parts you I used:

  • uStepper controller
  • A resistors (value will be discussed in a later step)
  • A little wire
  • A little heat schrink tube

The silicone tube on the drawing should be longer to reach a water reservoir with one end and the soil with the other. Here I used roughly 50cm. You will also need some sort of water reservoir (could just be a bottle).

Step 2: Assembly of Mechanics

The mechanical assembly is done in a few steps. I have made use of Autodesk Fusion 360 to make a little animation showing the assembly process.

It should be self-explaining when held together with the technical drawing. Adding threadlocker could prove to be a good idea in the long run, so that risk of nuts and bolts falling of is reduced.

The stepper motor model is found on grabcad here:

NEMA 17 3D model

The bearings were found on SKF bearing suppliers web page -

All other parts are made by me.

Step 3: Measuring Soil Moisture

For the system to know when to water the flower, the soil moisture level must be acquired. You can buy fancy sensors for this, but it's really not that complicated to do your self.

You could see soil as a variable resistor, with a high resistance when dry, and a low when wet. We will put a little current through the soil, resulting in a voltage drop across the soil resistance - which can be measured using an analog input on the uStepper. We do this using the two bolts on the bottom of the assembly as probes which is inserted in the soil.

So all we have to do is to measure the resistance of dry soil vs. wet soil, and then we have something to proceed with in the electronics step coming up next!

The soil was not entirely dry when I measured it, but it will do for now. I measured the dry soil to have a resistance of 13.3 kOhm and the wet to have 11.3 kOhm. This was measured at the wires attached to the two "probes" (which is just two bolts as seen on the other picture).

Step 4: Electronics

Now that we know the resistance of the soil, we can construct the small circuit providing current and outputting the voltage drop across the soil (which we will use to calculate the soil resistance with in the program).

Since the soil is just a resistor, we will construct a voltage divider to provide us with a voltage proportional to the soil resistance.

We know the resistance of the dry and wet soil. We assume that the resistance varies linearly with moist in the soil, meaning that the nominal value of Rs is between dry and wet values. When choosing the resistance R there is three things to consider:

  • Sensitivity of the measurements
  • Range
  • Current consumption

Current consumption should be below 20 mA, which is the limit of the AVR microprocessor output. We use a pin to power the "sensor", so that we can switch it on and off, to limit power usage. From the graph showing Voltage % vs resistance ratio, we see that the change in voltage is largest for small ratios (i.e. the sensitivity is high). Large ratios gives only small changes in voltage.

The range (percentage) is very limited in one direction when having a small resistance ratio, while choosing it to be 1 will give us equal range on both sides of the curve. For this reason we choose R = Rs nominal, giving a good sensitivity and a good range.

Since Rdry = 13.3 kOhm and Rwet = 11.3 kOhm, we get Rsoil = 12.3 kOhm. Since I don't have a 12.3 kOhm resistor, a 10 kOhm will have to do! From this we can calculate the voltage as Vsoil = Rsoil/(Rsoil+R)*5V. This gives us 2.854 V for dry and 2.653 V for wet, so only a 0.2 V span.

Having a completely dry soil to measure should give a larger Rsoil for dry soil, and by that a greater range.

In our program we can calculate Rsoil by measuring Vsoil on an analog pin and calculate:

Rsoil = R*((5V-Vsoil)/Vsoil)

Now we mount the resistor R and the probes as shown on the diagram. The current drawn by the circuit is no larger than 5 V/(10 kOhm + 11.3 kOhm) = 0.23 mA, so no frying of outputs!

Of course we also have to mount the uStepper to the stepper motor.

This makes us ready for the next step, which is programming!

Step 5: Programming

Final step is programming. uStepper uses the Arduino IDE, so it should be quite simple to do. First of all we have to add uStepper to the Arduino IDE - this is shown in the video.

Secondly we will have to upload the code, which is attached here in this step. I have added comments in the code, which should make it quite easy to grasp. But the main idea is to check the soil every hour by calling the soil() function, and water the soil if necessary.

The calculation of Rsoil is really not necessary - one could just use the Vsoil voltages calculated earlier to evaluate the soil condition.


Step 6: Final Notes

Now you should be up and running with your automatic watering system!

Of course we could build more features on this - a couple of thoughts:

  • Measure water-level in the reservoir
  • Alert user when water level is low in reservoir
  • Alert user if moist level is unaffected by pumping
  • Alert user if the motor is blocked (reading the encoder value)
  • Use the stepper to alert user (making noise by commanding high speed in open loop)

And I bet some of you could come up with even better ones!

Questions and comments are welcome.

Sensors Contest 2017

Participated in the
Sensors Contest 2017

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017