

This circuit is designed to monitor gas levels using an MQ6 sensor and display the readings on an OLED 1.3" display via an ESP32 microcontroller. The ESP32 also controls a Piezo Buzzer for audible alerts and a Servo motor for physical responses. A SIM800L GSM Module is included for communication capabilities. Power management is handled by a Buck converter connected to a 2.1mm DC Barrel Jack. The circuit includes resistors for current limiting and voltage division.
SP connected to Resistor (10 Ohms)G14 connected to Piezo BuzzerGND connected to the ground network5V connected to the 5V networkG22 (SCL) connected to OLED 1.3" SCLTXD connected to SIM800L GSM Module SIM_TXDRXD connected to SIM800L GSM Module SIM_RXDG21 (SDA) connected to OLED 1.3" SDAG18 connected to Servo pulsepin 1 connected to ESP32 G14pin 2 connected to the ground network5V connected to the 5V networkGND connected to the ground networkSIM_TXD connected to ESP32 TXDSIM_RXD connected to ESP32 RXDpin1 connected to ESP32 SPpin2 connected to MQ6 A0pin1 connected to the ground networkpin2 connected to MQ6 A0gnd connected to the ground networkvcc connected to the 5V networkpulse connected to ESP32 G18VCC connected to the 5V networkGND connected to the ground networkA0 connected to Resistor (10 Ohms) and Resistor (20 Ohms)IN+ connected to 2.1mm DC Barrel Jack switchIN- connected to 2.1mm DC Barrel Jack sleeveOUT+ connected to the 5V networkOUT- connected to the ground networkGND connected to the ground networkVCC connected to the 5V networkSCL connected to ESP32 G22SDA connected to ESP32 G21switch connected to Buck Converter IN+sleeve connected to Buck Converter IN-center connected to Buck Converter IN-/*
* This Arduino Sketch monitors the gas level using the MQ6 sensor and
* displays the gas level on an I2C OLED screen. The MQ6 sensor's analog
* output is connected to pin SP of the ESP32, and the OLED is connected
* via I2C to pins G21 (SDA) and G22 (SCL) of the ESP32.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialize the OLED with the I2C address 0x27 and 16x2 display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define the pin for the MQ6 sensor
const int mq6Pin = 34; // SP pin on ESP32
void setup() {
// Initialize the OLED
lcd.begin();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Gas Level:");
// Initialize the serial communication for debugging
Serial.begin(115200);
}
void loop() {
// Read the analog value from the MQ6 sensor
int gasLevel = analogRead(mq6Pin);
// Print the gas level to the serial monitor
Serial.print("Gas Level: ");
Serial.println(gasLevel);
// Display the gas level on the OLED
lcd.setCursor(0, 1);
lcd.print("Level: ");
lcd.print(gasLevel);
// Wait for a short period before the next reading
delay(1000);
}
Note: The code provided is for an Arduino sketch that uses the LiquidCrystal_I2C library to interface with an I2C OLED display. The MQ6 sensor's analog output is read by the ESP32 and displayed on the OLED. Serial communication is also initialized for debugging purposes.