Watering System - mako

Mako
Mako
nome
Go to content
Arduino > Projects

Arduino Watering System

About it
Another intresting project to consider is the Arduino Watering System. Everyone has at least one plant in their room, kitchen or balcony. Is essential keep them fed and keep the soil moist, and if you don't have a good memory this simple project will help you a lot.
Easy to understand and realize: you only need aa 5-9v pump, a soil moisture sensor (LM939 or v1.2), a relay module, and an Arduino Nano or UNO.
Here is a complete kit to get you started easly.



The soil moisture sensor value goes from 0 to 1023, when the sensor recive a value minor than 600, the relay turn on and the pump starts to irrigating the soil. To adapt the 220V home tension, i used a phone charger. Open it, remove the USB connector, find the VCC and GND pins (probably 1° and 4°) and connect it to the Arduino pins (like the wiring diagram)

Sketch analysis
The sketch is really simple, the first lines declears the variables, and set the inputs and the outputs. Two lines are very important: "sensorValue = analogRead(sensorPin);" and "if (sensorValue<limit){
digitalWrite(pump, LOW);". The first reads the value detected by the moisture sensor, the second one turns on the pump if the value perceived is below the limit (600).

Once understand the code, paste it in your Arduino IDE!


sketch

int pump = 4;
int sensorPin = A0;
int sensorValue;  
int limit = 600;

void setup() {
Serial.begin(9600);
pinMode(pump, OUTPUT);
pinMode(sensorPin, INPUT);
digitalWrite(pump, LOW);
}

void loop() {

sensorValue = analogRead(sensorPin);
Serial.println("Analog Value: ");
Serial.println(sensorValue);
if (sensorValue<limit) {
digitalWrite(pump, LOW);
}
else {
digitalWrite(pump, HIGH);
}
delay(1000);
}

There are no reviews yet.
0
0
0
0
0
Back to content