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

Arduino-Based Air Quality Monitor with LED Indicators

View and Edit Project In Cirkit DesignerImage of Arduino-Based Air Quality Monitor with LED Indicators

Circuit Documentation

Summary

This circuit utilizes an Arduino UNO microcontroller to interface with an MQ-135 gas sensor and two LEDs (one red and one green). The MQ-135 sensor is used to detect air quality, while the LEDs provide visual feedback based on the sensor's output. The red LED indicates a dangerous air quality level, while the green LED indicates safe conditions. The circuit is designed to read analog and digital outputs from the sensor and display the results via the serial monitor.


Component List

Arduino UNO


LED Two Pin (Red)


LED Two Pin (Green)


Resistor (200 Ohm)


MQ-135


Wiring Details

Arduino UNO


LED Two Pin (Red)


LED Two Pin (Green)


Resistor (200 Ohm)


Resistor (200 Ohm)


MQ-135


Documented Code

const int PIN_AOUT = A0;
const int PIN_DOUT = 2;
const int LED_RED = 9;
const int LED_GREEN = 10;

void setup() {
  pinMode(PIN_DOUT, INPUT); // DOUT is active-low on LM393 modules
  pinMode(LED_RED, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, LOW);
  Serial.begin(115200);
}

void loop() {
  int raw = analogRead(PIN_AOUT);
  float volts = raw * (5.0f / 1023.0f);

  int doLevel = digitalRead(PIN_DOUT);      // LOW = danger (above threshold), HIGH = safe
  bool danger = (doLevel == LOW);

  digitalWrite(LED_RED, danger ? HIGH : LOW);
  digitalWrite(LED_GREEN, danger ? LOW : HIGH);

  Serial.print("AOUT=");
  Serial.print(raw);
  Serial.print(" (");
  Serial.print(volts, 3);
  Serial.print(" V)  DOUT=");
  Serial.println(doLevel == LOW ? "LOW (DANGER)" : "HIGH (SAFE)");

  delay(100);
}

This documentation provides a comprehensive overview of the circuit, detailing each component, its purpose, wiring connections, and the code used to operate the system.