Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Environmental monitoring is crucial for various applications, from agricultural management to smart home systems. With Arduino, you can create a cost-effective and customizable environmental monitoring system that measures parameters like temperature, humidity, air quality, and more. This article will guide you through the process of setting up an environmental monitoring system using Arduino.
Temperature and Humidity Sensor (DHT11/DHT22)
Air Quality Sensor (MQ-135)
Atmospheric Pressure Sensor (BMP180/BMP280)
Libraries Needed
DHT.h
for the DHT11/DHT22 sensorAdafruit_BMP085.h
or Adafruit_BMP280.h
for the BMP180/BMP280 sensorMQ135.h
for the MQ-135 sensorSample Code
#include <DHT.h>
#include <Adafruit_BMP085.h>
#include <MQ135.h>
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 bmp;
MQ135 gasSensor = MQ135(A0);
void setup() {
Serial.begin(9600);
dht.begin();
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
while (1) {}
}
}
void loop() {
// Reading temperature and humidity
float h = dht.readHumidity();
float t = dht.readTemperature();
// Reading air quality
float airQuality = gasSensor.getPPM();
// Reading atmospheric pressure
float pressure = bmp.readPressure();
// Print values to Serial Monitor
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C\t");
Serial.print("Air Quality: ");
Serial.print(airQuality);
Serial.print(" PPM\t");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" Pa");
delay(2000); // Wait for 2 seconds before next reading
}
By following these steps, you can create a functional environmental monitoring system using Arduino. This system can be expanded with additional sensors or integrated into larger projects for more complex applications.