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

Arduino UNO-Based Smart Gas Detection and Monitoring System with LCD Display and Servo Control

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Gas Detection and Monitoring System with LCD Display and Servo Control

Circuit Documentation

Summary

This circuit is designed to interface an Arduino UNO with various sensors and modules, including an MQ-2 gas sensor, a 16x2 I2C LCD, a servo motor, a MAX30102 HR + SpO2 sensor, an Adafruit LPS35HW sensor, a 4x4 Keypad, a buzzer module, and a tap switch. The Arduino UNO reads data from the sensors, displays information on the LCD, and controls the servo and buzzer based on sensor inputs.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. MQ-2

    • Description: Gas sensor for detecting LPG, i-butane, propane, methane, alcohol, hydrogen, and smoke.
    • Pins: GND, VCC, ANALOG, Digital
  3. 16x2 I2C LCD

    • Description: 16x2 character LCD display with I2C interface.
    • Pins: GND, VCC, SDA, SCL
  4. Servo

    • Description: Servo motor for precise control of angular position.
    • Pins: GND, VCC, PWM
  5. MAX30102 HR + SpO2 sensor

    • Description: Heart rate and SpO2 sensor.
    • Pins: INT, IRD, RD, GND, SCL, SDA, VIN
  6. Adafruit LPS35HW

    • Description: Pressure sensor.
    • Pins: VCC, 3.3V, GND, SCK/SCL, SDO/ADR, SDI/SDA, CS, INT
  7. 4x4 Keypad (Simulator)

    • Description: 4x4 matrix keypad.
    • Pins: R1, C4, R2, C2, R3, R4, C1, C3
  8. Buzzer Module

    • Description: Buzzer for sound output.
    • Pins: GND, Vcc, I/O
  9. Tap Switch

    • Description: Tap switch for detecting touch.
    • Pins: GND, VCC, OUTPUT
  10. GND

    • Description: Ground connection.
    • Pins: GND

Wiring Details

Arduino UNO

MQ-2

16x2 I2C LCD

Servo

MAX30102 HR + SpO2 sensor

Adafruit LPS35HW

4x4 Keypad (Simulator)

Buzzer Module

Tap Switch

GND

Code Documentation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Initialize Servo
Servo myServo;

void setup() {
  // Initialize LCD
  lcd.begin();
  lcd.backlight();
  
  // Initialize Servo
  myServo.attach(9);
  
  // Initialize other sensors and modules
  pinMode(A0, INPUT); // MQ-2
  pinMode(10, OUTPUT); // Buzzer
  pinMode(11, INPUT); // Tap Switch
  
  // Setup code for other sensors (MAX30102, LPS35HW, etc.)
}

void loop() {
  // Read sensors
  int gasValue = analogRead(A0);
  int tapSwitchState = digitalRead(11);
  
  // Display values on LCD
  lcd.setCursor(0, 0);
  lcd.print("Gas: ");
  lcd.print(gasValue);
  
  // Control Servo based on sensor values
  if (gasValue > threshold) {
    myServo.write(90); // Adjust angle as needed
  } else {
    myServo.write(0);
  }
  
  // Sound buzzer if needed
  if (tapSwitchState == HIGH) {
    digitalWrite(10, HIGH);
  } else {
    digitalWrite(10, LOW);
  }
  
  // Add code for other sensors and functionalities
}

This code initializes the LCD, servo, and other sensors. It reads the gas value from the MQ-2 sensor and the state of the tap switch. The gas value is displayed on the LCD, and the servo is controlled based on the gas value. The buzzer is activated if the tap switch is pressed. Additional code for other sensors and functionalities can be added as needed.