Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Creating an automated plant watering system with Arduino is a practical and educational project that combines electronics, programming, and gardening. This system ensures your plants receive the right amount of water even when you're not around. Here's how you can build one using an Arduino board.
Components Needed:
Step-by-Step Guide:
Set Up the Soil Moisture Sensor:
Connect the Relay Module:
Set Up the Water Pump:
Write the Arduino Code:
const int sensorPin = A0; // Soil moisture sensor connected to A0
const int relayPin = 7; // Relay module connected to pin 7
int sensorValue = 0; // Variable to store the sensor value
int threshold = 300; // Threshold value for soil moisture
void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Turn off the pump initially
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the sensor value
Serial.print("Soil Moisture Level: ");
Serial.println(sensorValue);
if (sensorValue < threshold) {
digitalWrite(relayPin, LOW); // Turn on the pump
Serial.println("Pump ON");
} else {
digitalWrite(relayPin, HIGH); // Turn off the pump
Serial.println("Pump OFF");
}
delay(2000); // Wait for 2 seconds before the next reading
}
Upload the Code:
Test the System:
Adjustments:
Safety Note: