Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create an Environmental Monitoring System with Arduino

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.

Components Needed

  1. Arduino Board (e.g., Arduino Uno)
  2. DHT11 or DHT22 Sensor (for temperature and humidity)
  3. MQ-135 Sensor (for air quality)
  4. BMP180 or BMP280 Sensor (for atmospheric pressure)
  5. Jumper Wires
  6. Breadboard
  7. Power Supply (USB cable or battery)

Step-by-Step Guide

1. Setting Up the Hardware

Temperature and Humidity Sensor (DHT11/DHT22)

  • Connect the VCC pin of the DHT sensor to the 5V pin on the Arduino.
  • Connect the GND pin of the DHT sensor to the GND pin on the Arduino.
  • Connect the DATA pin of the DHT sensor to digital pin 2 on the Arduino.

Air Quality Sensor (MQ-135)

  • Connect the VCC pin of the MQ-135 sensor to the 5V pin on the Arduino.
  • Connect the GND pin of the MQ-135 sensor to the GND pin on the Arduino.
  • Connect the A0 pin of the MQ-135 sensor to the A0 analog pin on the Arduino.

Atmospheric Pressure Sensor (BMP180/BMP280)

  • Connect the VCC pin of the BMP sensor to the 3.3V pin on the Arduino.
  • Connect the GND pin of the BMP sensor to the GND pin on the Arduino.
  • Connect the SCL pin of the BMP sensor to the A5 pin on the Arduino.
  • Connect the SDA pin of the BMP sensor to the A4 pin on the Arduino.

2. Writing the Code

Libraries Needed

  • DHT.h for the DHT11/DHT22 sensor
  • Adafruit_BMP085.h or Adafruit_BMP280.h for the BMP180/BMP280 sensor
  • MQ135.h for the MQ-135 sensor

Sample 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
}

3. Uploading the Code

  1. Open the Arduino IDE.
  2. Copy and paste the sample code into the IDE.
  3. Connect your Arduino board to your computer via USB.
  4. Select the correct board and port from the Tools menu.
  5. Click the Upload button to upload the code to the Arduino board.

Conclusion

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.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.