Introduction: Plant Soil Moisture Tool
In this project we'll explain how to remake a soil moisture measurment tool with an RGB LED output. The LED's task is to signal when the plant needs water.
Step 1: STEP 1: the Parts
1 Arduino Uno
1 Breadboard
1 RGB light
3 Resistors (R= 560Ω)
8 male-to-male cables
3 male-to-female cables
Step 2: Step 2: Construction
How to setup the build for the moist sensor.
- Connecting the VMA303 moistsensor
- Connect the breadboard red + track to the UNO 5V and the black - track to the UNO GND.
- From the breadboard + track connect a red wire to + socket of the VMA303 moistsensor and a black wire from the - track of the breadboard to the - socket on the VMA303 moistsensor.
- From the S socket use a white wire to connect it to the A0 socket on the UNO.
- Connecting the RGB LED common anode
- Place the RGB LED on the breadboard and make sure the pins are each in a separate track.
- The longest pin on the RGB LED is the anode. Connect this one to the + track of the breadboard.
- The remaining pins need each a 560Ω resistor to a new track on the breadboard. Make sure these tracks are separated.
- The track now leading to single pin next to the anode needs to be connected to the INPUT ~9 socket on the UNO, use a white wire.
- The track leading to the pin between the outer pin and anode of the RGB needs to be connected to INPUT ~10 socket on the UNO, use a yellow wire.
- The track leading to the last pin connects to the INPUT ~11 socket on the UNO, use a green wire.
Now you finished the build and can start coding!
Step 3: STEP 3: the Code
const int analogInPin = A0;
int sensorValue = 0;
int red = 9; int green = 10;
int blue = 11;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
if(sensorValue <=300){
map(sensorValue, 0, 300, 0, 255);
digitalWrite(blue,HIGH);
digitalWrite(green,HIGH);
digitalWrite(red,LOW);
}
if(sensorValue >300){
map(sensorValue, 300, 600, 0, 255);
digitalWrite(blue,HIGH);
digitalWrite(green,LOW);
digitalWrite(red,HIGH);
}
if(sensorValue >=600){ map(sensorValue, 600, 700, 0, 255);
digitalWrite(blue,LOW);
digitalWrite(green,HIGH);
digitalWrite(red,HIGH);
}
}
Step 4: STEP 4: the Result
This project was build by WGEJB and Sanvo.
We hope you enjoy it!