ARDUINO WITH MOISTURE SENSOR

In this tutorial you will get to know that how you can create an moisture detection system .



Material requirements are given below :-
  • MOISTURE SENSOR
  • ARDUINO
  • GREEN LED
  • RED LED
  • BRAEDBOARD
  • JUMPER WIRES
Working
whenever the sensor detects moisture in the soil red LED glows otherwise green LED glows indicating no moisture .This can be used in gardens to make automatic watering system.

CONNECTIONS
ARDUINO
GND          =     -ve of green , red LED and
                          GND of moisture sensor
5V              =     VCC of moisture sensor
2                =      +ve of red LED
3                =      +ve of green LED 
4                =      OUT/DC of moisture sensor


CODE OF THE PROJECT :-

const int moisture = 4;
const int green = 3;
const int red = 2;

void setup() {
pinMode(moisture, INPUT);
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
}


void loop() {
if(digitalRead(moisture) == HIGH){
  digitalWrite(green,LOW);
  digitalWrite(red,HIGH);
}


else{
  digitalWrite(green,HIGH);
  digitalWrite(red,LOW);
 
}
}

Popular posts from this blog

ARDUINO WITH PCA9685

ARDUINO WITH KEYPAD