The Watering Thing

by FleurMat37 in Circuits > Arduino

128 Views, 0 Favorites, 0 Comments

The Watering Thing

IMG_9895.jpg

This project was designed to solve an issue that is sadly common among many plant owners.

Being unable to water your precious plants for extended periods can lead to the untimely demise of the plant, and nobody likes seeing a dried-up plant upon returning home. This project aims to solve that issue by watering a plant placed underneath a bottle if the plant's soil becomes too dry.

Here's a demonstration with explanations of each part.

https://clipchamp.com/watch/6BLW1GgNrkA

Supplies

motor.jpg
download.png
DFR0611_564x376.jpg
356-03.jpg

This project requires the following materials:

Argon components:

  • Particle Argon
  • Adafruit Stepper Motor
  • Capacitive Soil Moisture Sensor 2.0 (https://makerselectronics.com/product/capacitive-soil-moisture-sensor-v2-0)
  • A handful of M2M wires and M2F wires
  • Potentiometer

Other Materials:

  • Soil
  • A plant
  • Cardboard
  • Box cutter
  • Tape
  • Glue gun


If you ever find yourself lost, make sure to take a closer look at the pictures I have uploaded. If you click on them, you will see a comments I have left on each picture.

Code the Argon!!

Without code, your Argon will do absolutely nothing. So, let's put some code in there. Make sure to include the "Stepper" library in your project.


I put some comments in the code to hopefully make each part easier to understand.

#include <Stepper.h>

const int stepsPerRevolution = 2048; // the number of steps in one full rotation of the motor

int potentioPin = A4;
int goodWater;


// pins connected to stepper
#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5


// Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence
Stepper myStepper(stepsPerRevolution, IN1, IN3 , IN2, IN4);


unsigned long prevTime = 0;


void setup() {
  myStepper.setSpeed(14); //stepper speed
 
  Serial.begin(9600); //use a port monitor set to port 9600. there, you will be able to see the moisture measurements.


}


void loop() {
    unsigned long currTime = millis(); //takes the time at the beginning of each loop
    const int dry = 3100; // value for fully dry sensor, will vary depending on sensor used
    const int wet = 0; // value for fully wet sensor
    int sensorVal = analogRead(A0); //read water sensor
    int percentageMoisture = map(sensorVal, dry, wet, 0, 100); //convert range of dry-wet to 0-100% wetness
    goodWater = analogRead(potentioPin); //read potentiometer
    int waterGood = map(goodWater, 0, 4095, 100, 0); //convert potentiometer range of 0-4095 to 0-100% wetness
    
    if (currTime - prevTime >= 10000) //checks if over 10 seconds (10,000ms) have passed since the motor stopped moving. You can change this value if desired
    {
            Serial.println("The requested moisture value is ");
            delay(100);
            Serial.println(waterGood);
            delay(100);
            Serial.println("The current moisture value is ");
            delay(100);
            Serial.println(percentageMoisture);
        if (percentageMoisture <= waterGood) //if the soil moisture is lower than the requested amount, starts the motor
        {
            Serial.println("starting motor...");
            myStepper.step(stepsPerRevolution/4); //motor rotates 90 degrees (note: I decided to divide the steps by 4 because changing "stepsPerRevolution" led to some errors when testing.)
            delay(3000); //long wait (3 seconds) as water comes out 
            myStepper.step((-(stepsPerRevolution))/4);//motor rotates 90 degrees, but backwards!
            delay(100);
            Serial.println("Loop complete!");
            delay(100);
        }
        else{
            Serial.println("Plant is OK! Starting over..."); 
        }
        prevTime = millis(); //sets the value to the time that the loop ended
     }
     else{
         Serial.println("not enough time has passed...");
         delay(1000); //makes the argon check time every second instead of every millisecond.
     }
}


Begin Wiring (Stepper Motor)

61mkoDi1vlL.jpg
454325_850883_02_front_comping.jpg
argon-top.png

Before starting this step, make sure you have included the Stepper library onto your Argon's program. The project will not work if you forget this. (https://build.particle.io/libs/Stepper/1.1.3/tab/Stepper.cpp)


The code will run, but nothing will happen if you don't have anything connected. So, let's start wiring. Before this step, make sure your Argon is properly placed inside of your breadboard.


We'll begin with the stepper motor. You will need M2F jumper wires for each step unless specified otherwise. Here's the proper wiring:

  1. Using an M2M wire, connect GND to the power rail labeled "-" on the breadboard. It should have a blue line down the side. We'll come back to this later.
  2. Connect D2 from the breadboard to IN4 on the stepper.
  3. Connect D3 from the breadboard to IN3 on the stepper.
  4. Connect D4 from the breadboard to IN2 on the stepper.
  5. Connect D5 from the breadboard to IN1 on the stepper.
  6. Connect VUSB from the breadboard to + on the stepper
  7. Finally, connect a wire from the blue line on the breadboard to - on the stepper

The blue power rail will be used more later, and it is far more convenient to use it instead of connecting everything directly to GND.

Now, the stepper should work!

Wiring (Soil Moisture Sensor)

494_Capacitive soil moisture sensor V2.0.....4.jpg
download.png
454325_850883_02_front_comping.jpg

Next up is the Capacitive Soil Moisture Sensor. The Moisture Sensor is surprisingly simple to set up, only needing 3 M2M jumper wires. This step requires 4.

First things first, remember that blue rail on the breadboard with a "-" above it? Notice the rail next to it, with a "+" above it. You will need to use both rails for this step.

  1. Connect "3V3" from the Argon to the red power rail. This will be used later.
  2. Connect a wire from the "+" power rail to "VCC" on the Sensor. This should be the red wire on the Moisture Sensor.
  3. Connect a wire from the "-" power rail to "GND" on the Sensor. This should be the black wire.
  4. Connect A0 from the Argon to "AUOT" on the Sensor. This should be the yellow wire.


Now, the Moisture Sensor should work! In this project, it will measure soil moisture as a percentage value from 0-100, with 0 being completely dry.

Wiring (potentiometer)

images.jpg
argon-top.png
454325_850883_02_front_comping.jpg

One last part to set up. Then the hard part is over, hopefully. This step requires 3 M2M wires.

  1. Place the potentiometer's 3 pins into the breadboard.
  2. Connect the leftmost pin of the potentiometer to the red power rail on the breadboard.
  3. Connect the rightmost pin of the potentiometer to the blue power rail on the breadboard.
  4. Connect the middle pin of the potentiometer to A4 on the breadboard.

Now your potentiometer outputs a value! Spin the dial from left to right to get a value (0-100 for this project, where 0 is when the dial is turned as far left as possible.)

Warning: Potentiometers are fickle. Turn the dial too hard and it will break. Also, if you wire things incorrectly, the potentiometer may short-circuit. This can cause the potentiometer to become extremely hot.


Final Wiring Check

IMG_9899.jpg
IMG_9900.jpg

It may become difficult to follow, but your wiring should look vaguely similar to these images.

Cardboard Box Setup

24x18x6_200lb_ECT-32_Flat_Kraft_Corrugated_Cardboard_Shipping_Boxes__41957.jpg

Now, you must construct a "wall" that can support the parts. The way I did this was counterintuitive. I would recommend using an empty cardboard box and removing the flaps from one side. The box should be able to stand on one of its shorter sides.

Putting the Argon and the Box Together

IMG_9895.jpg
IMG_9894.jpg

As you can see, I put my Argon and stepper motor on platforms, while the soil moisture sensor hangs down into the plant.

Starting off with the Argon's platform:

  1. Cut a piece of cardboard out of a sheet. It should be significantly longer and wider than the breadboard, so additional parts and wiring can rest on it without falling off. This will be the platform.
  2. (optional) Hot glue the piece of cardboard relatively high on the wall, in the fashion shown. This should remove the need to put an extra railing on the bottom or on the side.
  3. Using your tape, tape the platform to the wall in the fashion shown. Make sure to crease the tape at the corner between the box and the platform using your fingernail. This will ensure the platform stays up.
  4. Cut two pieces of cardboard, one that is roughly as wide as the platform and the other being roughly as long. These will serve as railings, just in case the platform tilts.
  5. Tape the wide railing underneath the platform in the fashion shown, making sure to crease the tape at the corner between the box and the railing. Then, tape the long railing to the side of the platform in a similar fashion to the image.
  6. (optional) Cut a hole through the wall, so the Argon's USB cable can go outside of the box. This step is not needed if your power supply can fit on the platform along with the Argon.
  7. Place the soil moisture sensor in the soil of your plant's pot.


Putting the Argon and the Box Together (continued)

IMG_9896.jpg
IMG_9897-7.jpg
IMG_9898.jpg

These steps become a little difficult to explain. Please use the pictures for reference.

Bottle setup and water blocking:

  1. Obtain a plastic bottle and poke holes into the bottom of it. Make sure that the holes can be entirely covered by one surface.
  2. Trace the bottom of the bottle onto cardboard. Add a 1-1.5 inch rectangle to the end of the circle as a "handle." Cut the cardboard along the handle and the tracing. This piece of cardboard will serve to block water from coming out of the bottle.
  3. Cover the cardboard cutout with tape, so the cardboard becomes more resistant to water seeping through.
  4. Use the box cutter to carve a small hole at the end of the "handle," on the flat side. Fill this hole with hot glue and attach it to the stepper motor in a way that the water blocker is touching the wall. When the motor rotates, the water-blocker will also rotate.


Stepper motor platform and bottle placement:

  1. Make a platform in the same way as the previous platforms. This platform should be slightly larger than the stepper motor. You may hot glue parts directly to the wall.
  2. Once the platform is made, hot glue the stepper motor to the platform. This ensures the motor does not move during rotation.
  3. When the water-blocking cardboard is touching the wall, mark a line where the top of it is.
  4. Put a line of hot glue onto the side of the bottle. Then glue the bottle in a way where the bottom of the bottle is in contact with where you marked the line in the previous step.

When the motor turns, the water blocker may tilt in a way that it is unable to properly block water. Here is how to fix it.

  1. When the water blocker is underneath the bottle, quickly mark a line where the bottom of the blocker is.
  2. Hot glue a piece of cardboard on or very slightly above the line.
  3. Now, the new piece of cardboard should push the water-blocking cardboard flush against the bottle.

Congratulations! The project is finished. Hope you and your plant enjoy :)