Interfacing of MQ135 Sensor with Arduino :

interfacing

Use the slider to move smoke towards or away from MQ135 sensor.

Instructions

Objective:

Learn to use the MQ135 air quality sensor to detect harmful gases (CO2, ammonia, benzene, smoke) and display air quality levels with visual indicators (RGB LED) and audio alerts (buzzer).

Steps to Perform:

  1. Click 'Start Simulation' to power the circuit
  2. Click 'Add smoke to activate sensor' button to introduce pollutants
  3. Use the slider to move smoke closer or farther from the MQ135 sensor
  4. Observe the LCD display showing air quality data (0-100 scale)
  5. Watch the RGB LED color changes:
    • Green: Air quality acceptable (0-33)
    • Yellow/Orange: Air quality exceeded (33-66)
    • Red + Buzzer: Air quality dangerous (66-100)
  6. Notice the buzzer activates when pollution reaches dangerous levels

Key Concepts:

  • MQ135 Sensor: Gas sensor for air quality monitoring (detects CO2, NH3, NOx, alcohol, benzene, smoke)
  • Analog Reading: analogRead(A0) returns values from 306-756 based on gas concentration
  • map() Function: Converts sensor range (306-756) to percentage scale (0-100)
  • Threshold-based Control: Uses if-else conditions to trigger different alerts
  • LCD Display: 16x2 display shows real-time air quality data and status
  • RGB LED: Digital pins 2-4 control Red, Green, Blue LEDs for visual feedback
  • Buzzer Alert: tone() function generates 300Hz warning sound for dangerous levels
  • I2C Communication: LCD uses I2C protocol (Adafruit_LiquidCrystal library)

Arduino Code