Introduction
In this article I explain about finding soil moisture in plants using Arduino. These days everyone is busy and no one focuses on caring for plants. For this purpose let us see how to find soil moisture in plants.
Parts of list
- Arduino uno
- LED
- Resistor
- Flower pot
- Wires
Connection
It is a very simple connection for the process.
Step 1: Connection for led to Arduino board
- Take the positive pin in the led connected to the digital pin of 10 to the Arduino board.
- Take the negative pin in the led connected to the Gnd to the Arduino board.
Step 2: Connection for resistor to Flower pot and Arduino
- The positive side can be connected to the 5v of the Vcc from the Arduino board.
- The negative side can be connected to the Analog pin of the A0.
Step 3:
- Finally take separate wire from the Gnd to the plant.
Programming
- const int VAL_PROBE = 0;
- const int MOISTURE_LEVEL = 250;
-
- void setup() {
- Serial.begin(9600);
- }
-
- void LedState(int state) {
- digitalWrite(10, state);
- }
-
- void loop() {
- int moisture = analogRead(VAL_PROBE);
-
- Serial.println(moisture);
-
- if(moisture > MOISTURE_LEVEL) {
- LedState(HIGH);
- } else {
- LedState(LOW);
- }
- delay(100);
- }
Explanation
- In this case the soil can be filled with water and we can check the soil level in the serial monitor.
- We can see another way of soil level using the potentiometer.
- In this case it can work under the range to connect the wire in the soil and check the range.
Output
Figure 1: Output
Read more articles on Arduino: