Professional Documents
Culture Documents
Soil Moisture Sensor
Soil Moisture Sensor
Soil Moisture Sensor
Table of Contents
Step 1: Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Step 2: LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Step 3: Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
http://www.instructables.com/id/Soil-Moisture-Sensor/
Author:innovativetom Innovative Tom
As a young lad Tom spent most of his days at the heels of his father, working in their shop, also known as the basement. His dad was an extraordinary
cabinet maker and while working on their 1850’s home, one room at a time Tom got used to building things. Although woodworking did not interest him,
electricity, however, did. Around the age of five his dad had set him up with a motor, an old light switch, and a nine volt battery. He was hooked. As he got
older his fascination with the way things worked led him to take apart just about everything. Including his parent’s new five disc CD changer. He was almost
as good as putting them back together.
Step 1: Arduino
The Code:
/*
LED1 - Green LED2 - Green LED3 - Green LED4 - YELLOW LED5 - RED
Connect the Soil Mosture Sensor to anolog input pin 0, and your 5 led to digital out 2-6
*/ int led1 = 2; int led2 = 3; int led3 = 4; int led4 = 5; int led5 = 6;
int mostureSensor = 0;
void setup() { // Serial Begin so we can see the data from the mosture sensor in our serial input window. Serial.begin(9600); // setting the led pins to outputs
pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(led5, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(mostureSensor); // print out the
value you read:
Serial.println(sensorValue); if (sensorValue >= 820) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH);
digitalWrite(led5, LOW); } else if (sensorValue >= 615 & sensorValue < 820) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH);
digitalWrite(led4, LOW); digitalWrite(led5, LOW); } else if (sensorValue >= 410 & sensorValue < 615) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH);
digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); } else if (sensorValue >= 250 & sensorValue < 410) { digitalWrite(led1, HIGH);
digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); } else if (sensorValue >= 0 & sensorValue < 250) { digitalWrite(led1,
LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); } delay(1000); // delay 1 second between reads }
http://www.instructables.com/id/Soil-Moisture-Sensor/
Step 2: LEDs
Connecting the LEDs;
Connect the cathode or (-) lead from the LED to the Arduino.
Connect the anode or (+) lead from the LED to the + positive rail of the beadboard.
http://www.instructables.com/id/Soil-Moisture-Sensor/
Step 3: Wiring
In this step we connect the power and ground rails.
From the arduino ground pin connect a short jumper to the blue rail on the breadboard.
From the arduino 5v Pin we connect a short jumper to the red rail on the breadboard.
http://www.instructables.com/id/Soil-Moisture-Sensor/
Step 4: The Moisture Sensor
The moisture has very well defined pin out.
Connect the ground to the ground rail, power to the power rail.
*note, the moisture sensor I have has and "AC" and "DC" outputs. The AC, is a serial signal the when fully dry it outputs 5 volts, when fully wet, 0 volts. The DC, is
configured with the trim pot and is brought high when the moisture level reaches a certain point.
http://www.instructables.com/id/Soil-Moisture-Sensor/
http://www.instructables.com/id/Soil-Moisture-Sensor/
Step 5: Your Done.
Connect up the Arduino and load the code;
Code On Github
Innovative Tom
eBay Link
http://www.instructables.com/id/Soil-Moisture-Sensor/
Related Instructables
Advertisements
Comments
2 comments Add Comment
http://www.instructables.com/id/Soil-Moisture-Sensor/