Automatic Watering System Using Pico:ed V2

26,034

362

36

Introduction: Automatic Watering System Using Pico:ed V2

About: IT Teacher (Andalucía, Spain)

This time I present you an useful and affordable project very easy to build by our kids.

It is an automatic watering system controlled by a Pico:ed V2 board.

How it works: when the soil moisture sensor detects the soil is not moist enough (sad image), send a signal to a water pump to begin to water the plant (cry image). It only will happen if the water level sensor installed detects there is enough water in the plastic bowl to prevent the water pump damage. If the soil is moist enough, the board shows a smile image. By the other hand, if we keep pushing the button A, we can set up the number of seconds the water pump is watering the plant, from 1 to 10 seconds, and if we push the button B, the water pump will begin to watering the plant the number of seconds configured without taking into account the soil moisture.

I have built an indoor solution connected to whatever 5V mobile charger and an outdoor solution with solar panels.

With the Pico:ed V2 board we can introduce our kids the Python programming and to teach them this programming language so used in our days.

I hope you like it.

Supplies

  • Pico:ed V2 board
  • IOBit V2 expansion board
  • Plastic Bowl
  • Little funnel
  • 5V Water pump
  • 5V Relay
  • Water level sensor
  • Soil moisture sensor
  • Plastic tube
  • 18650 Battery
  • 18650 Battery Shield
  • Four 1.5 V 400 mA solar panel
  • Electric Cables
  • M4 nuts, screw (20 milimeters) and washers
  • M3 nuts, screw (20 milimeters) and washers

Step 1: How It Works

This video shows how it works the indoor version.

Step 2: How to Begin to Program the Pico:ed V2 Board

After connecting the board to the computer, you have to see a CIRCUITPY disk as you can see in the image.

If you can´t, you have to do the following:

  1. Download the firmware of the Pico:ed V2.
  2. Long pressing the BOOTSEL button and connect with the USB cable, release the button until you see a disk named RPI-RP2 on the computer
  3. Send the downloaded firmware to that disk.

Pico:ed will reconnect automatically after getting the firmware downloaded, then you will see a CIRCUITPY disk.

It is recommended to use the integrated development environment Thonny, which you can install by choosing the appropriate version for your computer system from here.

Once you have installed Thonny, you have to choose “Tools/Options/Interpreter” and click “CircuitPython(generic)”.

Step 3: Code.py

The code for this project is very simple.

It has been codified in Python using the Thonny editor as you can see in the image. In the image you can see the file "code.py" that you can find in the disk "CIRCUITPY" when you plugged the board to the computer.

One of the advantage to codify in Pytthon is that it is a interpreted programming language, so whatever you change in your code, you will see the results immediately in the board without generating a file to download it.

You can download the whole "code.py" from here

Step 4: Setting Up the Water Level Sensor

Step 5: Setting Up the Soil Moisture Sensor

Step 6: Fix the Relay and the IOBit

Mark and open several holes in the plastic bowl to fix the devices using the nuts, the screws and the washers as you can see in the images.

Step 7: Fix the Water Level Sensor

Cut the plastic bowl to insert the the water level sensor as you can see in the image.

After that, you have to apply hot silicone to prevent the water from leaking out and connect the cables: the 5V cable (red one), the ground cable (black one) and the signal (orange one) to the #1 pin in the IOBit

Step 8: Fix the Funnel

Open a hole in the top of the plastic bowl to fix a little funnel to fill it with water.

Open a new hole near the previous one to pass through it the plastic tube and the cables for the soil moisture sensor

Step 9: Fix the Water Pump

Open a hole in the plastic bowl near the microcontroller, fix the water pump using hot silicone and pass through the hole the cables as you can see in the image: the 5V cable (red one) to the NO (Normally Open) pin of the rele and the ground cable (black one) to one ground pin in the IOBit

Step 10: Closing the Plastic Box

Before you close the plastic bowl, you have to do the following:

  • Connect the plastic tube to the water pump
  • Use hot silicone to close properly a hole opened to pass trough it the cables needed to connect the water pump and the soil moisture sensor
  • Pass trough the top hole the plastic tube and the three cables needed by the soil moisture sensor to work
  • Pass trough the hole near the microcontroller the cables above and connect it to the Pico:ed: the 5V cable (orange one in the image) to a 5v pin in the board, the ground (gray one) to a ground in the board and the signal one (yellow) to the #2 pin in the board
  • Apply hot silicone to prevent the water from leaking out from the hole near the microcontroller

Step 11: Connecting the Relay

You have to connect in the the relay 5 pins:

  • Upper side (red cable) from the 5V pin of the water pump
  • Upper side (orange cable) from a 5V pin in the IOBit
  • Lower side (gray cable) from a ground pin in the IOBit
  • Lower side (red cable) from a 5V pin in the IOBit
  • Lower side (white cable) from #3 pin in the IOBit

Step 12: Fritzing Circuit Diagram

Step 13: The Solar Version (Outdoor Solution)

The outdoor solution include a 18650 battery and 18650 battery shield to supply the project.

Moreover, the 18650 battery is charged by four 1.5 V 400 mA solar panels connected in serial way.

Be the First to Share

    Recommendations

    • Anything Goes Contest

      Anything Goes Contest

    36 Comments

    0
    yllenfernandez
    yllenfernandez

    27 days ago on Step 13

    Great project. I am new to hardware things, but your project got me excited already. I have a couple of indoor plants and I travel from time to time; I think this is a great idea to keep my plants alive for a longer period of time.

    I am a computer science student, therefore I can code a couple of bugs. The big question for you is, are you are hardware engineer? if not, how do you figure out what pieces of hardware/tools you need in order to build different projects?

    Again, this project is amazing and I cannot imagine how happy and proud you and your children were after building this cool automatic watering system.

    0
    TecnoProfesor
    TecnoProfesor

    Reply 26 days ago

    Many thanks for your comment. I am so glad you like this project.
    About your question. I am computer science engineer as you will be in the future and as far as I know, the only way to make similar projects is reading others makers as you can find in this fascinating web, learning from that guys, and of course, trying to make your own projects

    0
    yllenfernandez
    yllenfernandez

    Reply 26 days ago

    Hi just found out that you are based in Spain, I recently moved to Madrid and I am eager to do something similar to what you did.
    Where did you get your pico: ed and other pieces of hardware? I am trying to buy some of them in Spain but the shipping prices are insane.

    Thank you very very much for replying.

    0
    TecnoProfesor
    TecnoProfesor

    Reply 26 days ago

    I buy all the electronics elements from Amazon and the pico:ed from elecfreaks web

    0
    mwitt1337
    mwitt1337

    4 weeks ago

    Great project! Also some great comments and suggestions.

    My specific use case would be large indoor plants like tomato plants in 5 gallon buckets on shelving with three levels.

    - The goal is a minimal maintenance hydroponic type of system.
    - Watering is short and frequent to keep the roots moist but not submerged in water.
    - Six inches from the bottom of each bucket is a reservoir return hose where the water travels back the the large reservoir tub to be reused.
    - The electrical conductivity of the reservoir is used to determine the nutrient level of the water
    - Ph level is monitored

    I've encountered one specific problem that I haven't discovered a solution: watering elevated plants from a large reservoir. Watering a single plant elevated 4ft is not difficult for a typical small impeller pump. Trying to water more then one plant simultaneously is impossible with a < $100 impeller pump in my experience. Purchasing a $200-$300 pump just doesn't seem reasonable.

    I've tried using 1/2" hose and splits to other buckets but this is too much elevated volume for the pump to handle. I've tried using 1/8" sprinkler system hosing a T's to each bucket but this creates too much pressure for the pump. If I elevate the reservoir the pump works in both scenarios however I've created a new problem because the reservoir returns for the buckets on lower shelves cannot return to the elevated reservoir.

    The water level sensors in this project could be a potential solution for elevated watering. A water level sensor could trigger a pump in the larger reservoir at ground level to fill a smaller elevated reservoir for each level of plants. Any thoughts or suggestions about elevated water pumping would be helpful. Maybe I am using the wrong kind of pump.

    I agree with another comment that any transparent container holding water for a long period of time should be lined with black plastic to stop light from growing algae.

    0
    mill-art
    mill-art

    4 weeks ago on Introduction

    Nice proof of concept. I’d definitely be interested in making something larger to handle watering plants from a grey water cistern that’s in the ground. Obviously we would need a larger pump and batteries to include the panels but what you have here could definitely be marketable. One recommendation though. Ditch the 18650 and similar series batteries. Thanks to a flood of knock off batteries coming out of a particular nation in the east most of these fail or have a short lifespan. Just ask Tesla how well those and the larger size have worked out in their cars that by year 4 have lost 30% or more capacity or so I have been told. Either way I really like your design and I hope you take it to market.

    0
    JavedH
    JavedH

    4 weeks ago

    Good project.
    Can you, please, add the circuit diagram showing all the wire connections.
    Also from where to by the IOBIT board?

    Thanks.

    0
    TecnoProfesor
    TecnoProfesor

    Reply 4 weeks ago

    I have just included the Fritzing circuit diagram in the instructable.
    I have bought the IOBit in Amazon

    0
    the naP
    the naP

    4 weeks ago

    It appears as though you have mounted the water level sensor "flat" when it should be on it's "side" Are you using it as a single level sensor?

    0
    TecnoProfesor
    TecnoProfesor

    Reply 4 weeks ago

    I have used as a single level water sensor.
    It is installed a few centimeters over the water pump because I think it is the best position to fill the bowl fully and, at the same time, to detect the minimum water level to avoid the pump works without water.

    0
    the naP
    the naP

    Reply 4 weeks ago

    Right, but in this orientation, water could pool on top of the sensor, and provide a false positive. Flip it upside down if you are going to use it that way.

    0
    AlbertDumont
    AlbertDumont

    4 weeks ago

    Nice design but you cannot charge a 18650 battery by simply appling a voltage on it.
    These are Li-Ion batteries and need to have a specific charger module (cost 1$ on aliexpress)

    0
    bartek.blecki
    bartek.blecki

    4 weeks ago on Step 13

    Great job! I strongly recommend capacitive moisture sensor - this one you use will be covered with corrosion very soon and will start making problems :)

    0
    TecnoProfesor
    TecnoProfesor

    Reply 4 weeks ago

    Thanks for your comment.
    I am agree with you.
    I have used it because that was the sensor in a robotic kit in our shool.

    0
    TecnoProfesor
    TecnoProfesor

    Reply 4 weeks ago

    Thank you for yor comment Sir.

    0
    shalnachywyt
    shalnachywyt

    4 weeks ago

    Nice idea if you have a large system of plantings, but for one plant? Too complicated when all you have to do is water the plant once a week. This is why the phrase, "if it ain't broke, don't fix it." was invented.

    0
    F1nnsp1n
    F1nnsp1n

    Reply 4 weeks ago

    It's a project to introduce someone to programming, picoed development boards, automation and electronics.
    Yes, you can obviously water the plant once a week, but this project is about the learning you do when you build this and ending up with something at least semi-useful.

    0
    shalnachywyt
    shalnachywyt

    Reply 4 weeks ago

    Okay, so basically for someone more inclined towards electronic gadgets. Thanks for the explanation.

    0
    tantris
    tantris

    4 weeks ago

    Nice project.
    For anyone who would like it easier: I had a watering system going last winter, that used an arduino instead. You can start out with the LED-blink example, but instead of on for a second and off for a second, you turn it on for e.g. 30 seconds and off for the rest of the day. Setup was similar to here, except that I used mosfets instead of relays.
    For the next iteration of my watering system, I will probably also switch to python and turn it into a kids project.I am looking at either micropython or microblocks (a micropython based graphical programming ide like scratch or snap). Snap and scratch work as well, but have to stay connected to a computer. With micropython / circuitpython / microblocks, you can disconnect the board

    Some experiences/ideas:
    - For a long term project don't use a see through container for the water reservoir, especially when exposed to the sun. Half way through the season I already had nice algae. Not that much of a problem though: I used plastic milk jugs (USA). The pump in this tutorial just fits through the opening.
    - Some plants don't want constant humidity and are picky about it. Instead of watering for a few seconds and keeping the soil at a constant humidity level, water less frequently but for a longer time.
    - This humidity sensor corrodes. Part of the culprit is the constant current. You can extend the life by switching the power off, when not in use. (npn-transistor with the base connected to an enable pin [ with resistor and pull down-resistor]) Or even by using a pin from the microcontroller for power, but I don't know the current limits there.
    - Making a whole in a container wall makes me uneasy. The water level sensor could be two wires sticking in from the top. Again, best to avoid a constantly flowing current.
    - A tube going up and then down again has the potential of creating a siphon, especially with an impeller pump. Before you know it, half your watering container gets emptied into the plant.