Gas Leak Detection and Warning System

Gas Leak Detection and Warning System:

This project focuses on creating a Gas Leak Detection and Warning System using an Arduino Uno and various components. The main goal is to enhance safety by detecting potentially dangerous gasses like methane and propane. When gas levels exceed safe limits, the system provides clear visual and audible warnings to alert users and mitigate potential hazards.

diagram

What makes this project especially appealing is its user-friendly nature. The kit is designed for ease of assembly, with comprehensive instructions provided. All the necessary details, including circuit diagrams, pinout connections, and Arduino programming code, are included. Uploading the code to the Arduino is a straightforward process, ensuring that even beginners can quickly assemble and deploy this gas detection system for enhanced safety.

Components Required:-

 

1.One Arduino UNO 2.One MQ-5 Gas Sensor 3.One Buzzer

4.One White LED 5.One Red LED

  1. One Jumper Wires (Set of 10)
  2. One 12V Li-ion 1200mah Rechargeable Battery Pack

Components and Their Functions:

  1. Arduino UNO:-

Function: The Arduino Uno is a microcontroller board that serves as the brain of your project. It’s responsible for controlling all other components based on the code you program it with.

Specifications:-

  1. Microcontroller: The Arduino Uno is based on the ATmega328P microcontroller from Atmel (now a part of Microchip Technology). It operates at a clock speed of 16
  2. Digital I/O Pins: It has a total of 14 digital input/output These pins can be used for both digital input and output operations.
  3. Analog Input Pins: The board has 6 analog input pins marked A0 through A5, which can be used for reading analog
  4. PWM (Pulse Width Modulation) Pins: There are 6 PWM output pins, which can be used for tasks such as controlling the brightness of LEDs or the speed of
  5. Operating Voltage: The Arduino Uno can be powered either via a USB connection (5V) or an external power supply (7-12V). It has a built-in voltage regulator that regulates the voltage to 5V for the
  6. Flash Memory: It comes with 32KB of flash memory for storing your
  1. SRAM: The Uno has 2 KB of SRAM for storing variables and runtime
  2. EEPROM: It has 1KB of EEPROM, which can be used for storing non-volatile
  3. Clock Speed: The Arduino Uno operates at 16 MHz, which determines the execution speed of your
  4. USB Interface: It features a USB Type-B connector for connecting to a computer for programming and serial
  5. Reset Button: The board includes a reset button for restarting your
  6. LEDs: There are built-in LEDs on the board, including a power LED and a built-in LED on pin 13, which is often used for testing and
  7. Size: The Arduino Uno board has dimensions of approximately 7 x 2.1 inches (68.6 x

53.3 mm).

  1. Operating Voltage Range: The recommended operating voltage range for the Arduino Uno is 7-12V, although it can tolerate a wider
  2. Communication: The Arduino Uno can communicate with other devices via UART, SPI, and I2C
  3. Software: Arduino Uno is programmed using the Arduino IDE (Integrated Development Environment), which is based on the C++ programming It has a vast library of pre-built functions and examples for various sensors and modules.
  4. Open Source: The Arduino platform is open-source, which means that the hardware and software designs are available for anyone to use and

The Arduino Uno is a versatile and beginner-friendly board that is widely used for prototyping and learning electronics and programming. Its simplicity and strong community support make it a popular choice for makers and hobbyists.

Pin Out :-

Digital Pins (D0-D13):

  • D0 to D13 are digital input/output pins. These pins can be used for both digital input (reading digital signals like a button press) and digital output (controlling LEDs, relays, ). Pin D13 also has an onboard LED that can be used for testing and debugging.

Analog Pins (A0-A5):

  • A0 to A5 are analog input These pins can be used to read analog voltage levels (0-5V). They are often used to interface with sensors or read analog data.

Power Pins:

  • 5V: This pin provides a regulated 5V output, which can be used to power external
  • 3V: This pin provides a 3.3V regulated output.
  • GND (Ground): There are several GND pins on the board, which are the ground reference for your

Other Pins:

  • Vin: This pin allows you to provide an external voltage supply to power the Arduino It should be in the range of 7-12V.
  • ARef: This pin can be used as a reference voltage for analog
  • RESET: The RESET pin is used to reset the Communication Pins:
  • TX (Transmit): Used for serial communication (transmit data).
  • RX (Receive): Used for serial communication (receive data).
  • SCL (I2C Clock): Used for I2C
  • SDA (I2C Data): Used for I2C
  • SCK (SPI Clock): Used for SPI
  • MISO (SPI Data In): Used for SPI
  • MOSI (SPI Data Out): Used for SPI
  • SS (SPI Slave Select): Used for SPI

These pins are essential for connecting sensors, actuators, and other components to your Arduino Uno and for communication with other devices. Remember to consult the Arduino documentation and your specific project requirements to determine how to use these pins effectively.

image

  1. MQ-5 Gas Sensor:

Function: The MQ-5 Gas Sensor is designed to detect various gases, such as methane, propane, and other combustible gases.

Use: While it’s not typically used for obstacle avoidance, you can employ it to detect gas leaks in a specific area.

Specifications:-

  1. Operating Voltage: The MQ-5 sensor module typically operates at a voltage between 5V and 12V DC. It’s essential to provide the correct voltage within this range for proper
  1. Power Consumption: The power consumption of the MQ-5 sensor is relatively low, typically in the range of 150mW to 800mW, depending on the operating conditions and the specific
  2. Sensitivity: The MQ-5 sensor is highly sensitive to a range of combustible gases, including LPG (liquefied petroleum gas), methane, propane, and It can detect concentrations of these gases in the air.
  3. Response Time: The response time of the MQ-5 sensor is generally in the range of a few It can quickly detect changes in gas concentrations in its vicinity.
  4. Heating Element: The sensor module contains a built-in heating element that is used to heat the sensor’s sensing element, which is usually a tin dioxide (SnO2)
  5. Analog Output: The MQ-5 sensor provides an analog output voltage that varies with the gas This output can be read by an analog-to-digital converter (ADC) on a microcontroller or other control systems.
  6. Digital Output: Some MQ-5 sensor modules also come with a digital output pin that provides a high or low signal based on a predefined gas concentration
  7. Operating Temperature Range: The sensor is typically designed to operate within a temperature range of -20°C to +50°C (-4°F to +122°F). Operating the sensor outside of this range can affect its accuracy and
  8. Storage Temperature Range: It can be stored within a broader temperature range, often from -20°C to +70°C (-4°F to +158°F).
  9. Operating Humidity Range: The MQ-5 sensor can operate in relative humidity conditions of up to 95% RH (non-condensing).
  10. Dimensions: The physical dimensions of the MQ-5 sensor module can vary between manufacturers, but they are typically small and
  11. Calibration: Calibrating the sensor may be necessary for accurate gas concentration This process involves exposing the sensor to a known concentration of the target gas and adjusting the readings accordingly.
  12. Lifespan: The lifespan of the sensor can vary depending on usage, environmental conditions, and the quality of the sensor Regular calibration and maintenance can help prolong its lifespan.

Pin Out:-

  • AO (Analog Output): This pin provides an analog output voltage that varies with the concentration of the detected gas. You can connect this pin to an analog-to-digital converter (ADC) on a microcontroller to measure the gas
  • DO (Digital Output): Some MQ-5 sensor modules include a digital output pin that provides a high or low signal based on a predefined gas concentration You can connect this pin directly to a digital input pin on a microcontroller for digital gas detection.
  • VCC (Voltage Supply): This pin is used to provide power to the sensor module. It typically operates at 5V, but some modules may accept a voltage range between 5V and 12V, so check the datasheet or module specifications for the exact voltage
  • GND (Ground): This pin is connected to the ground (0V) of your power supply or microcontroller to complete the

image 2

Buzzer:

Function: The buzzer generates audible alerts or alarms when specific events, such as gas detection or obstacle avoidance, occur.

Specifications:-

  1. Operating Voltage: Ensure the buzzer’s voltage rating matches your power
  2. Sound Output Level: Consider the sound output level (measured in dB) to determine how loud the buzzer
  3. Tone Type: Check if the buzzer produces a continuous sound or specific
  4. Frequency: Look at the buzzer’s frequency to ensure it produces the desired
  5. Current Rating: Ensure your power supply can provide the required current for the
  6. Size and Dimensions: Consider the physical size and form factor to fit your
  7. Operating Life: Check the expected operating life to assess
  8. Sound Pattern: Determine if the buzzer can produce the desired sound
  9. Housing Material: Consider the housing material for
  10. Termination Type: Choose a termination type that suits your wiring

image3

Pin Out:-

  • Positive Terminal (+): This terminal is connected to the positive voltage supply, typically your power source’s positive
  • Negative Terminal (-): This terminal is connected to the ground (0V) of your power

White LED:

Function: The white LED provides illumination and can be used for signaling.

Use: You can use the white LED to indicate when the gas sensor detects a specific gas. Specifications:-

  1. Luminous Flux (Brightness): Indicates how much visible light the LED emits, measured in lumens (lm). Choose the appropriate brightness level for your lighting
  2. Color Temperature: Determines the warmth or coolness of the white Select a color temperature that suits your lighting application, such as warm white for a cozy atmosphere or cool white for task lighting.
  3. Forward Voltage (Vf): The voltage required to operate the Ensure your power supply voltage matches or exceeds the LED’s forward voltage to prevent damage.
  4. Forward Current (If): The current flowing through the LED when it’s Use an appropriate current-limiting resistor or driver to control the current.

Pin Out:-

  • Anode (A or +): This is the positive terminal of the It connects to the positive side of your power supply.
  • Cathode (K or -): This is the negative terminal of the It connects to the ground (0V) of your power supply.

image4

Red LED:

Function: The red LED serves as a warning or indicator. Specifications:-

  1. Color Wavelength: Red LEDs typically emit light in the red portion of the visible spectrum, with a wavelength around 620-750 nanometers (nm).
  2. Forward Voltage (Vf): The voltage required to make the LED emit red light, typically around 8 to 2.2 volts.
  3. Forward Current (If): The current flowing through the LED when it’s lit, typically in the range of 5mA to
  4. Luminous Intensity: Measures the brightness of the LED, specified in millicandelas (mcd) or candelas (cd).

Pin Out:

  • Anode (A or +): This is the positive terminal of the Connect it to the positive side of your power supply or circuit.
  • Cathode (K or -): This is the negative terminal of the Connect it to the ground (0V) or the negative side of your power supply or circuit.

image5

9V Li-ion Battery:

Function: The battery provides a power source for the Arduino and components, ensuring portability.

Specifications:-

  1. Voltage: A 9V Li-ion battery provides a nominal voltage of 9 volts, which is suitable for devices designed for 9V power
  2. Capacity (mAh): Capacity indicates how long the battery can power a Higher milliampere-hour (mAh) ratings mean the battery can provide power for a longer duration.
  3. Chemistry: Li-ion (Lithium-ion) chemistry provides a high energy density, making it an efficient and long-lasting power
  1. Rechargeability: 9V Li-ion batteries are rechargeable, allowing you to use them multiple times and reduce
  2. Cycle Life: The cycle life specifies how many charge and discharge cycles the battery can endure before its capacity significantly Longer cycle life is desirable for extended use.
  3. Operating Temperature Range: Check the temperature range within which the battery can operate Typically, it’s around -20°C to +60°C (-4°F to +140°F).
  4. Self-Discharge Rate: A low self-discharge rate means the battery can hold its charge for extended periods when not in use, ensuring it’s ready when
  5. Safety Features: Some 9V Li-ion batteries include safety features like overcharge protection and short-circuit protection to prevent accidents during charging and

Pin Out:

  • Positive Terminal (+): This terminal is the positive side of the battery, and you connect your device’s positive input or load to this
  • Negative Terminal (-): This terminal is the negative side of the battery, and you connect your device’s negative input or ground to this

Circuit Diagram:

image6

Connections:

 

MQ-5 Gas Sensor Connections with Arduino:

Vcc: Connect to 5V on the Arduino for power.

Ao (Analog Output): Connect to an analog pin on the Arduino (e.g., A0) for reading the gas sensor’s analog output.

Gnd: Connect to the ground (GND) on the Arduino for reference. Buzzer Connections with Arduino:

Vcc: Connect to a digital pin on the Arduino (e.g., D4) for controlling the buzzer. Gnd: Connect to the ground (GND) on the Arduino for reference.

White LED Connection with Arduino:

Vcc: Connect to a digital pin on the Arduino (e.g., D3) for controlling the white LED. Gnd: Connect to the ground (GND) on the Arduino for reference.

Red LED Connection with Arduino:

Vcc: Connect to a digital pin on the Arduino (e.g., D2) for controlling the red LED. Gnd: Connect to the ground (GND) on the Arduino for reference.

Project Functionality:

The project uses the MQ-5 Gas Sensor to detect gas levels. When gas is detected, the Arduino can trigger various actions, such as illuminating the white LED to provide visibility in the area, activating the red LED as a warning indicator, and sounding the buzzer as an alarm.

While this project is primarily focused on gas detection and signaling rather than obstacle avoidance, you can adapt the code to perform actions based on gas sensor readings, providing safety alerts when certain gas levels are detected.

Code:

 

// GAS DETECTOR

int Input = A0; // Analog pin for gas sensor input int R_LED = 2;   // Red LED pin

int G_LED = 3;    // Green LED pin int Buzzer = 4; // Buzzer pin

int val;          // Variable to store the sensor reading

int MAX = 400;    // Maximum threshold for gas detection

void setup() {

Serial.begin(9600); // Initialize serial communication pinMode(Input, INPUT);    // Set gas sensor pin as input pinMode(R_LED, OUTPUT); // Set red LED pin as output pinMode(G_LED, OUTPUT); // Set green LED pin as output pinMode(Buzzer, OUTPUT); // Set buzzer pin as output

}

void loop() {

val = analogRead(A0); // Read the gas sensor value

if (val >= MAX) {

digitalWrite(R_LED, HIGH); // Turn on the red LED digitalWrite(Buzzer, HIGH); // Turn on the buzzer digitalWrite(G_LED, LOW);                                      // Turn off the green LED

Serial.println(“GAS LEAKING”); // Print gas leak message to serial monitor

} else {

digitalWrite(R_LED, LOW);    // Turn off the red LED digitalWrite(Buzzer, LOW);   // Turn off the buzzer digitalWrite(G_LED, HIGH); // Turn on the green LED Serial.println(“NORMAL”);      // Print normal message to serial monitor

}

}

Here’s an explanation of how this code works:

 

Setup Function:

The setup function initializes the following:

Serial communication at a baud rate of 9600, which allows debugging information to be printed to the serial monitor.

Configures the gas sensor pin (Input) as an input.

Sets the pins connected to the red LED (R_LED), green LED (G_LED), and buzzer (Buzzer) as outputs.

Loop Function:

The loop function runs continuously, repeatedly executing the following steps: Reading Gas Sensor:

It reads the analog value from the gas sensor connected to pin A0 and stores it in the val variable.

Gas Leak Detection:

If the val (the gas sensor reading) is greater than or equal to the predefined threshold MAX (400 in this case), it signifies a gas leak condition.

In this condition:

The red LED (R_LED) is turned on (HIGH).

The buzzer is activated, generating an audible alert by setting it to HIGH. The green LED (G_LED) is turned off (LOW).

A message “GAS LEAKING” is printed to the serial monitor. Normal Environment:

If the val is below the MAX threshold, it indicates a normal environment condition. In this case:

The red LED (R_LED) is turned off (LOW). The buzzer is turned off (LOW).

The green LED (G_LED) is turned on (HIGH).

A message “NORMAL” is printed to the serial monitor. Functionality Summary:

The code continuously monitors the analog output of the gas sensor.

If the sensor reading surpasses the predefined threshold, it activates the red LED and buzzer, indicating a gas leak.

In a normal environment, the green LED remains on, and no audible alert is generated.

The code provides real-time feedback via the serial monitor, making it useful for detecting and responding to gas leaks.

This gas detector system is a simple but effective way to monitor gas levels and provide immediate visual and audible alerts in the event of a gas leak, contributing to safety and early detection.

Obstacle Avoiding Robo Kit – ElectroGlobal
Electroglobal – Elevating Your Electronics Experience

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp
My Cart
Wishlist
Recently Viewed
Categories
Wait! before you leave…
Get 10% additional off on your next order
ELECTRO10
Use the code above to enjoy 10% additional off on your next order at checkout