Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Gardening is a popular hobby that not only provides relaxation but also allows individuals to grow their own plants and vegetables. However, maintaining a garden can be time-consuming and requires constant attention. This is where Arduino comes in, offering a solution to automate various gardening tasks. By integrating Arduino with sensors and actuators, you can create a smart garden that monitors and controls essential parameters such as soil moisture, temperature, and light levels. In this article, we will explore how Arduino can revolutionize gardening and provide step-by-step examples to get you started.
Project: Smart Irrigation System The project aims to create an automated irrigation system that waters plants when the soil moisture level drops below a certain threshold. This ensures that the plants receive adequate water without the need for manual intervention.
List of Components:
Examples:
int moisturePin = A0; // Analog pin for soil moisture sensor
void setup() { Serial.begin(9600); // Initialize serial communication }
void loop() { int moistureValue = analogRead(moisturePin); // Read moisture level Serial.print("Moisture Level: "); Serial.println(moistureValue); delay(1000); // Delay for 1 second }
This code reads the analog value from the soil moisture sensor connected to pin A0 and prints the moisture level to the serial monitor.
2. Controlling Water Pump:
```cpp
int moisturePin = A0; // Analog pin for soil moisture sensor
int pumpPin = 2; // Digital pin for water pump
void setup() {
pinMode(pumpPin, OUTPUT); // Set pumpPin as output
}
void loop() {
int moistureValue = analogRead(moisturePin); // Read moisture level
if (moistureValue < 500) { // Check if moisture level is below threshold
digitalWrite(pumpPin, HIGH); // Turn on water pump
delay(5000); // Keep pump on for 5 seconds
digitalWrite(pumpPin, LOW); // Turn off water pump
}
delay(1000); // Delay for 1 second
}
This code controls a water pump connected to digital pin 2 based on the soil moisture level. If the moisture level drops below 500 (adjustable threshold), the pump is turned on for 5 seconds.