Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Greenhouse automation can significantly enhance the efficiency and productivity of your gardening efforts by controlling environmental factors such as temperature, humidity, lighting, and irrigation. Arduino, with its flexibility and affordability, is an excellent platform for creating a custom greenhouse automation system. In this article, we'll explore how to set up a basic automated greenhouse system using Arduino.
Connect the DHT22 Sensor:
Connect the Light Sensor (LDR):
Connect the Relay Module:
Connect the Water Pump and LED Lights:
#include <DHT.h>
#define DHTPIN 2 // Pin where the DHT22 is connected
#define DHTTYPE DHT22
#define LIGHT_SENSOR A0
#define RELAY_PIN 3
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(RELAY_PIN, OUTPUT);
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
int lightIntensity = analogRead(LIGHT_SENSOR);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" *C\t");
Serial.print("Light Intensity: ");
Serial.println(lightIntensity);
// Example conditions to turn on the relay
if (temperature > 30 || humidity < 40 || lightIntensity < 300) {
digitalWrite(RELAY_PIN, HIGH); // Turn on the relay
} else {
digitalWrite(RELAY_PIN, LOW); // Turn off the relay
}
delay(2000); // Wait for 2 seconds before the next reading
}
This setup can be expanded with additional sensors and actuators to further automate and optimize your greenhouse environment.