Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Nano-Based Environmental Monitoring System with I2C LCD Display

Image of Arduino Nano-Based Environmental Monitoring System with I2C LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor environmental parameters such as temperature, humidity, air quality, and atmospheric pressure, as well as electrical parameters like voltage and current. It includes an Arduino Nano as the central microcontroller, interfaced with a variety of sensors and output devices. The circuit can trigger a fan and a buzzer based on temperature, voltage, and current thresholds. Sensor readings are displayed on an I2C LCD display, and the system is powered by a Li-ion battery managed by a TP4056 charging module.

Component List

Arduino Nano

  • Microcontroller board based on the ATmega328P
  • Provides GPIO pins for interfacing with sensors and output devices
  • Includes analog and digital pins, power supply pins, and communication interfaces

16x2 LCD Display (I2C)

  • Alphanumeric liquid crystal display
  • I2C interface for communication with the Arduino Nano
  • Displays sensor readings and status messages

DHT22

  • Digital temperature and humidity sensor
  • Provides high-precision readings for environmental monitoring

Piezo Buzzer

  • Electronic device that produces sound
  • Used to alert or indicate threshold conditions

Fan

  • Electric fan for cooling
  • Activated by the Arduino Nano based on temperature readings

ACS712 Current Sensor (5A/20A/30A)

  • Hall-effect-based linear current sensor
  • Measures the current flowing through the circuit

Voltage Sensor DC

  • Module for measuring DC voltage in the circuit
  • Provides an analog output proportional to the voltage

BMP280

  • Digital barometric pressure sensor
  • Also measures temperature for atmospheric monitoring

MQ 135 Sensor

  • Gas sensor for detecting a wide range of gases, including NH3, NOx, alcohol, benzene, smoke, and CO2
  • Used for air quality monitoring

TSR-3386UT Square Trimming Potentiometer (x2)

  • Adjustable resistor for setting voltage and current reference levels
  • Used for calibration or adjustment purposes

TP4056

  • Lithium-ion battery charger module
  • Manages charging and protection of the Li-ion battery

Li-ion Battery, 2200 mAh 11.1 V

  • Rechargeable battery for powering the circuit
  • Provides a portable power source

Wiring Details

Arduino Nano

  • D8 connected to DHT22 DAT
  • D9 controls the Fan 5V
  • VIN connected to BMP280 VCC
  • GND connected to common ground net
  • 5V connected to common 5V net
  • A5 connected to BMP280 SCL and 16x2 LCD Display (I2C) SLC
  • A4 connected to BMP280 SDA, 16x2 LCD Display (I2C) SDA, and TSR-3386UT Potentiometer wiper
  • A3 connected to TSR-3386UT Potentiometer wiper
  • A2 connected to MQ 135 Sensor A0
  • A1 connected to voltage sensor dc signal
  • A0 connected to ACS712 Current Sensor OUT

16x2 LCD Display (I2C)

  • GND connected to common ground net
  • VCC connected to common 5V net
  • SDA connected to Arduino Nano A4
  • SLC connected to Arduino Nano A5

DHT22

  • GND connected to common ground net
  • VCC connected to common 5V net
  • DAT connected to Arduino Nano D8

Piezo Buzzer

  • pin 1 connected to common 5V net
  • pin 2 connected to common ground net

Fan

  • GND connected to common ground net
  • 5V controlled by Arduino Nano D9

ACS712 Current Sensor

  • GND connected to common ground net
  • VCC connected to common 5V net
  • OUT connected to Arduino Nano A0
  • 1 connected to voltage sensor dc GND
  • 2 connected to TSR-3386UT Potentiometer Leg1

Voltage Sensor DC

  • signal connected to Arduino Nano A1
  • vcc connected to common 5V net
  • gnd connected to common ground net

BMP280

  • SDO not connected
  • CSB not connected
  • SDA connected to Arduino Nano A4
  • SCL connected to Arduino Nano A5
  • GND connected to common ground net
  • VCC connected to Arduino Nano VIN

MQ 135 Sensor

  • VCC connected to common 5V net
  • GND connected to common ground net
  • D0 not connected
  • A0 connected to Arduino Nano A2

TSR-3386UT Square Trimming Potentiometer (x2)

  • Leg1 connected to common 5V net
  • wiper connected to Arduino Nano A4 and A3
  • Leg2 connected to TP4056 B+

TP4056

  • IN+ and IN- not specified
  • OUT- and OUT+ not specified
  • B- connected to voltage sensor dc GND
  • B+ connected to TSR-3386UT Potentiometer Leg2

Li-ion Battery, 2200 mAh 11.1 V

  • + connected to TP4056 B+
  • - connected to TP4056 B-

Documented Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <Adafruit_BMP280.h>

#define DHTPIN 8
#define DHTTYPE DHT22
#define FANPIN 9
#define BUZZERPIN 7

LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27 for a 16 chars and 2 line display
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP280 bmp;

int currentPin = A0; // ACS712 current sensor pin
int voltagePin = A1; // Voltage sensor pin
int airQualityPin = A2; // MQ135 sensor pin
int potVoltagePin = A3; // Potentiometer for voltage adjustment
int potCurrentPin = A4; // Potentiometer for current adjustment

void setup() {
  lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
  lcd.backlight();
  dht.begin();
  if (!bmp.begin(0x76)) { // Initialize BMP280 sensor
    lcd.print("BMP280 error");
    while (1);
  }
  pinMode(BUZZERPIN, OUTPUT);
  pinMode(FANPIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // Read sensors
  float voltage = analogRead(voltagePin) * (25.0 / 1023.0); // Assuming 0-25V range
  float current = (analogRead(currentPin) - 512) * (5.0 / 1023.0) / 0.1; // ACS712 calibration
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
  float pressure = bmp.readPressure() / 100.0F;
  int airQuality = analogRead(airQualityPin);
  int potVoltage = analogRead(potVoltagePin); // Potentiometer for simulating voltage
  int potCurrent = analogRead(potCurrentPin); // Potentiometer for simulating current

  // Display on LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("V:"); lcd.print(voltage); lcd.print("V");
  lcd.setCursor(8, 0);
  lcd.print("I:"); lcd.print(current); lcd.print("A");
  lcd.setCursor(0, 1);
  lcd.print("T:"); lcd.print(temperature); lcd.print("C ");
  lcd.print("H:"); lcd.print(humidity); lcd.print("%");

  // Check for conditions to trigger the buzzer and fan
  if (temperature > 30.0) { // Example temperature threshold (30°C)
    digitalWrite(FANPIN, HIGH); // Turn on the fan
  } else {
    digitalWrite(FANPIN, LOW); // Turn off the fan
  }

  // Check for overvoltage or overcurrent to trigger the buzzer
  if (voltage > 8.0 || current > 10.0) { // Example voltage and current thresholds
    digitalWrite(BUZZERPIN, HIGH);
  } else {
    digitalWrite(BUZZERPIN, LOW);
  }

  // Debugging output to Serial Monitor
  Serial.print("Voltage: "); Serial.print(voltage); Serial.println(" V");
  Serial.print("Current: "); Serial.print(current); Serial.println(" A");
  Serial.print("Temperature: "); Serial.print(temperature); Serial.println(" C");
  Serial.print