Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano-Based Environmental Monitoring System with DHT11 and MQ-2 Sensors

View and Edit Project In Cirkit DesignerImage of Arduino Nano-Based Environmental Monitoring System with DHT11 and MQ-2 Sensors

Circuit Documentation

Summary

This circuit involves two Arduino Nano microcontrollers, a DHT11 humidity and temperature sensor, a green LED, a red LED, an MQ-2 gas sensor, a 16x2 I2C LCD, and a TP4056 battery charger. The circuit is designed to read environmental data (temperature, humidity, and gas levels) and display it on the LCD. The LEDs provide visual indicators based on certain conditions.

Component List

  1. Arduino Nano

    • Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
    • Pins: D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, GND, D13, 3V3, AREF, A0, A1, A2, A3, A4 (SDA), A5 (SCL), A6, A7, 5V, RST, VIN, RX0, TX1, 13, 11, 12
  2. DHT11 Humidity and Temperature Sensor

    • Description: A basic, low-cost digital temperature and humidity sensor.
    • Pins: VDD, DATA, NULL, GND
  3. LED: Two Pin (red)

    • Description: A standard red LED.
    • Pins: Cathode, Anode
  4. LED: Two Pin (green)

    • Description: A standard green LED.
    • Pins: Cathode, Anode
  5. 16x2 I2C LCD

    • Description: A 16x2 character LCD display with I2C interface.
    • Pins: GND, VCC, SDA, SCL
  6. MQ-2 Gas Sensor

    • Description: A gas sensor that can detect various gases including LPG, i-butane, propane, methane, alcohol, hydrogen, and smoke.
    • Pins: GND, VCC, ANALOG, Digital
  7. TP4056

    • Description: A lithium battery charger module.
    • Pins: OUT-, B-, B+, OUT+, IN-, IN+

Wiring Details

Arduino Nano (Microcontroller 1)

Arduino Nano (Microcontroller 2)

DHT11 Humidity and Temperature Sensor

LED: Two Pin (red)

LED: Two Pin (green)

16x2 I2C LCD

MQ-2 Gas Sensor

TP4056

Code Documentation

Arduino Nano (Microcontroller 1)

#include <DHT.h>

#define DHTPIN 2     // Pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT 11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  delay(2000); // Wait 2 seconds between measurements
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();

  if (isnan(humidity) || isnan(temperature)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");
}

This code initializes the DHT11 sensor and reads the temperature and humidity every 2 seconds. The data is then printed to the serial monitor.