How to Build Your Own Automatic Plant Watering Machine

8 143
Avatar for Moronuttom
3 years ago

First off, let's start with what is an automatic plant watering machine. It's any machine that automatizes the work of watering the plants. It could be as simple as a bamboo lever contraption or as sophisticated as AI-powered robots. But, today we are going to learn how to build the simplest forms of coding instruction based automatic plant watering machine aka dumb robots. We are going to base our work on Arduino.

Why we should use it

Plant maintenance is very labour intensive work and with the increase of the overall world population, it's only going to get even harder. On the other hand, people are increasingly moving away from the sacred profession of farming as most people are becoming more city-bound. So, we need to automatize as much of the work as possible to feed our growing population and give much leisure as possible to farmers.

What can it do

Automatic plant watering machines with help of few sensors can determine the soil quality and the soil moisture level and water the plant as much as needed at just the right time. It can also give us an overview of the plant health

What we need to build

This is going to be an Arduino based project. So, the first thing we need is an Arduino Uno R3.

Depending on how many different pots or fields we want to water we can use a channel relay module.

We are going to need a few different soil sensors as we need to know the moisture to water the soil.

Pumps or solenoid valves for controlling the water flow.

Power adapter.

So in short, we need

Arduino Uno R3
Soil Sensor
AC Solenoid Valve
4 Channel Relay Module
AC/DC Adapter

Circuit Diagram

The Coding for Work

We need to use Arduino IDE software for the coding. We can use any language we want. I am going to use C++.

First, we need to set out the algorithm for the coding.

Algorithm

  1. Set Arduino

  2. Indicate sensor pin 1= A0 , sensor pin 2= A3

  3. Define output value 1; output value 2;

  4. Save sensor pin 1= output value 1; sensor pin 2=output value 2

  5. display soil sensor 1 value; soil sensor 2 value

  6. If output value1>800; Pin 4= high

  7. If output value 2>800; Pin5=high

This is the basic algorithm that we needed for setting up a 2 field or 2 pot system. But, following this basic algorithm, we can also do much higher fields. As long as we increase the number of sensor pins, modules, output values and the number of channels in relay modules.

Technically you don't need to know how to code for this to work if you use the code that I am going to provide. But, you will need to know some basic coding if you want it to work for higher field numbers. But, it is still very simple as long as you follow my algorithm.

Code

int sensor_pin1 = A0;

int sensor_pin2 = A3;

int output_value1;

int output_value2;

void setup()

{

pinMode(4, OUTPUT);

pinMode(5,OUTPUT);

Serial.begin(9600);

Serial.println("Reading from the Moisture sensor…");

delay(1000);

}

void loop(){

output_value1= analogRead (sensor_pin1);

output_value2= analogRead (sensor_pin2);

//output_value1= map (output_value1,550,10,0,100);

//output_value2= map (output_value2,550,10,0,100);

Serial.println("Moisture for Soil Sensor 1: ");

Serial.print(output_value1);

//Serial.println("% ");

Serial.println(", ");

Serial.println("Moisture for Soil Sensor 2: ");

Serial.print(output_value2);

//Serial.println("% ");

Serial.println(" || ");

if (output_value1>800)

{

digitalWrite(4, LOW);

}

else{

digitalWrite (4,HIGH);

}

delay (1000);

if (output_value2>800)

{

digitalWrite(5, LOW);

}

else{

digitalWrite (5,HIGH);

}

delay (1000);

}

*You can use this code as is or make changes as you want for if you want different number of fields. The moisture value has already been calibrated but you can also change that depending on you crops water need or drought resistance. (It's the 800 value).

What can this device do?

This watering machine can perform a multitude of tasks and depending on how many accessories you use the tasks it can do can even go higher.

  1. It can water your plants or fields at the right time without any human assistance.

  2. It will also accurately give the needed amount and not more.

  3. It can water your fields on time. (with a slight change of code)

  4. It can also measure the amount of sunlight and plant health( With CDS photoresistor cell and soil temperature sensor.

  5. It can also detect the amount of nutrient in the soil and provide needed nutrients. (With a soil nutrient sensor)

  6. This can also be used to feed farm animals in time.( by replacing soil sensor with RTC module).

As you can see this thing has a lot of potentials and by attaching solar panels to it you can make the entire process carbon neutral. It is very efficient. So, if you don't want to water your roof garden anymore or don't want to worry about your plants when you are on vacation or to lessen your workload on your small farm this might be just the solution for you. So, get building.

If you like my articles do check out my other articles. Thank you and good day.

5
$ 0.36
$ 0.26 from @TheRandomRewarder
$ 0.10 from @JTatlow
Sponsors of Moronuttom
empty
empty
empty
Avatar for Moronuttom
3 years ago

Comments

Nice, how much is the power consumption? Here is my article about how to build your own food dehydrator: https://read.cash/@Gigamegs/easy-diy-hack-mod-food-dehydrator-out-of-the-sankoo-baby-bottle-sterilizer-and-dryer-machine-2ff1965a

$ 0.00
3 years ago

Depends on the number of solenoid valves or pumps you plan to use. If you are just using one or two the costs are very negligible as they power down when not in use automatically.

$ 0.00
3 years ago

OK. I see. It would be nice if could the cost of your small project and a github repo if available. Very nice! Thanks!

$ 0.00
3 years ago

I don't have a github repo. It cost me around 40 dollars.But , I made it during the pandemic.You could probably make it far cheaper right now.

$ 0.00
3 years ago

$40? How? Arduino is like 20-25€. How much soil sensors, 4-channel relay module, valve, pump, power brick? Maybe you can used used ones or refurbished.

$ 0.00
3 years ago

Arduino= 20 dollars Solenoid valvesX2= 10 dollars 4channel relay module=7 dollars. Pipe= However much you need You don't need to use a pump if you use a solenoid valve and if you have a tank. You don't need a power brick if you use AC solenoid valve. You can connect them to the relay module and home current.

$ 0.00
3 years ago

But the Arduino needs a power source, isn't it?

$ 0.00
3 years ago

You can use an ac/dc adapter for that. That's like 2 dollars.

$ 0.00
3 years ago