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

Arduino Leonardo Gas Detection System with LCD Feedback and Buzzer Alert

View and Edit Project In Cirkit DesignerImage of Arduino Leonardo Gas Detection System with LCD Feedback and Buzzer Alert

Circuit Documentation

Summary

This circuit is designed to interface an Arduino Leonardo with an LCD screen and an MQ-5 gas sensor, with the addition of a buzzer for alerting purposes. The Arduino Leonardo serves as the central processing unit, reading the analog output from the MQ-5 sensor to detect the presence of gases and displaying the sensor value on the LCD screen. If the gas concentration exceeds a certain threshold, the buzzer is activated as an alarm.

Component List

LCD Screen 16x2 I2C

MQ-5 Gas Sensor

Buzzer

Arduino Leonardo (Rev3b)

Wiring Details

LCD Screen 16x2 I2C

MQ-5 Gas Sensor

Buzzer

Documented Code

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define Buzzer 3
#define Sensor A0

void setup() {
  Serial.begin(9200);
  lcd.init();
  lcd.backlight();
  
  pinMode(Buzzer, OUTPUT);
  Serial.println("MQ5 Heating Up!");
  delay(20000);
}

void loop() {
  int value = analogRead(Sensor);
  lcd.setCursor(0, 0);
  lcd.print("VALUE:");
  lcd.print(value);
  lcd.print("  ");

  if (value > 400) {
    digitalWrite(Buzzer, HIGH);
    lcd.setCursor(0, 1);
    lcd.print("GAS DETECTED!");
  } else {
    digitalWrite(Buzzer, LOW);
    lcd.setCursor(0, 1);
    lcd.print("             ");
  }
}

Code Explanation