Mini Project
Mini Project
BELAGAVI-590 018
BACHELOR OF ENGINEERING
in
ELECTRONICS & COMMUNICATION
Mini Project Associates
Mrs. SWETHA B
M.Tech.
Mini Project Guide
Certificate
Certified that the Mini-Project work entitled “AUTOMATIC WASHING MACHINE USING
VERILOG HDL” carried out by, Mr. SAI PRATHAM K H. USN 4BD22EC074, Mr.
SAMARTH P WALI. USN 4BD22EC076, Ms. SANGEETHA H K. USN 4BD22EC078, Mr.
SANKALP KAMATE. USN 4BD22EC080, bonafide students of this institution in partial
fulfillment for the award of degree of Bachelor of Engineering in Electronics &
Communication by Visvesvaraya Technological University, Belagavi during the academic year
2024-25. It is certified that all corrections / suggestions indicated for continuous internal
evaluation have been incorporated in the report.
Mrs. SWETHA B
M.Tech.
Mini-Project Guide
This mini project proposes to demonstrate the capabilities and scope of Verilog HDL by implementing the
control system of an automatic washing machine. This mini project accomplishes the above mentioned
objective by implementing the Control System of an automatic washing using the Finite State Machine
model. The Control System generates the control signals to control the overall operation of the washing
machine.
ACKNOWLEDGEMENTS
We would like to acknowledge the help and encouragement given by various people during the
course of this Mini project.
We are deeply indebted and very grateful to the invaluable guidance given by project guide
Mrs. SWETHA B, Assistant professor during this Mini-Project work.
We would like to thank Mini-Project coordinator Suma K G, Professor for the kind
co-ordination during the course of the work.
We would like to express our sincere gratitude to Dr. G S Sunitha, Professor and Head,
Department of Electronics & Communication Engineering, BIET, Davangere, for her kind support,
guidance and encouragement throughout the course of this work.
We are thankful to our beloved principal Dr. H B Aravind for providing excellent academic
climate.
We would like to thank all the teaching and non-teaching staff of Dept. of E&CE for their kind
co-operation during the course of the work. The support provided by the college and departmental
library is greatly acknowledged.
Finally, we are thankful to our parents and friends, who helped us in one way or the other
throughout our project work.
Project Associates:
Sai Pratham K H
Samarth P Wali
Sangeetha H K
Sankalp Kamate
TABLE OF CONTENTS
Acknowledgements
Abstract
Table of contents
List of Figures
1. CHAPTER 1: INTRODUCTION
2. CHAPTER 2: LITERATURE SURVEY
3. CHAPTER 3: OBJECTIVES
4. CHAPTER 4: METHODOLOGY
4.1. BLOCK DIAGRAM
5. CHAPTER 5: HARDWARE DESCRIPTION
5.1. CPLD KIT
6. CHAPTER 6: SOFTWARE DESCRIPTION
6.1. XILINX ISE(CHECK ITS VERSION)
7. CHAPTER 7: RESULT AND DESCRIPTION
8. CHAPTER 8: APPLICATIONS
9. CHAPTER 9: ADVANTAGES
LIMITATIONS
CONCLUSIONS
FUTURE SCOPE
REFERENCE
APPENDIX-A: CODE
COURSE OUTCOMES
CONTACT DETAILS
LIST OF FIGURES
Fig 4.1.1: Block Diagram…...................................................................................6
Fig 5.8.1:Battery...................................................................................................16
CHAPTER 1
INTRODUCTION
A washing machine automates the cleaning of clothes through stages like filling, washing, rinsing,
and spinning.
Using Verilog HDL (Hardware Description Language), we can design a digital control unit for this
process, implementing it as a Finite State Machine (FSM).
Verilog allows us to create timers and counters to control the duration of each stage, as well as
interface with sensors and actuators to manage water levels, spin cycles, and other operations.
CHAPTER 2
LITERATURE SURVEY
Paper 1: Gas leakage detector using Arduino
Author: Chetan B V, Gururaj E Yadav
Year of Publication:2023
Technology used: “Gas Leakage Detector with SMS Alert using ARDUNIO and GSM module”,
will be a great help in terms of preventing any danger caused by gas leakage. The purpose of this
project is to detect the presence of Gas leakage in the homes and working places. Apart from sound
alarm and SMS alert it will call the owner. which is used in case of the nobody is present when the
leakage occurs and to prevent accidents and property damage. In this gas detector system it senses
the gas leakage. If the gas in air is normal then the LED on the circuit will glow green giving a safe
sign and whenever sensor senses the gas then the red led glow i.e., green goes off, sends a message
and make a phone call to the owner and power goes off.
Keywords: Arduino UNO, MQ2 Gas Sensor, GSM
Citations:10
CHAPTER 3
OBJECTIVES
To Create an efficient, fully automated sequence of operations (fill, wash, rinse, and spin) for the washing
machine, minimizing user intervention.
To Implement a robust FSM to handle transitions between different stages of the wash cycle based on
To Use timers in Verilog to precisely control the duration of each stage, ensuring optimal cleaning and
energy efficiency.
Allow for digital simulation and testing in Verilog, enabling verification and debugging of the washing
machine’s behavior before physical implementation.
CHAPTER 4
METHODOLOGY
MQ-2 GAS SENSOR: The MQ-2 is a smoke and combustible gas sensor from Winsen. It can
detect flammable gas in a range of 300 - 10000ppm. It's most common use is domestic gas leakage
alarms and detectors with a high sensitivity to propane and smoke.
LED: The LED blinks as a visual indicator of the leak.
BUZZER: A buzzer or beeper is an audio signaling device. It beeps when there is leak.
SERVO MOTOR: A servo motor is an electrical device which can push or rotate an object with
great precision. If you want to rotate and object at some specific angles or distance, then you use
servo motor. It is just made up of simple motor which run through servo mechanism. The servo
motor rotates by 90 degree, simulating the turning off of the gas cylinder valve to prevent further
leakage. After this, the system remains in a “safe” mode until the gas level drops below the
threshold.
EXHAUST FAN: The exhaust fan is given a power supply of 12 volts which turns on when the gas
is detected.
BATTERY: This would be the primary supply for the system which will provide power to the
exhaust fan for its operation. The source supply is limited to 12V max as the system doesn’t require
much power during its operation.
ESP32 ESP32
CHAPTER 5
HARDWARE DESCRIPTION
5.1 ESP32:
ESP32 is a powerful, generic Wi-Fi module that targets a wide variety of applications, ranging from
low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming
and MP3 decoding.
The integration of Bluetooth, Bluetooth LE and Wi-Fi ensures that a wide range of applications can
be targeted, and that the module is all-around: using Wi-Fi allows a large physical range and direct
connection to the Internet through a Wi-Fi router, while using Bluetooth allows the user to
conveniently connect to the phone or broadcast low energy beacons for its detection.
Core Functionality:
Wireless Connectivity:
Wi-Fi: Supports Wi-Fi protocols like 802.11 b/g/n, enabling connection to local Wi-Fi networks for
internet access or data transfer.
o Bluetooth: Offers classic Bluetooth capabilities for legacy device connections, supporting profiles
like L2CAP, SDP, GAP, SMP, and more.
o Bluetooth Low Energy (BLE): Supports BLE for connecting to low-power devices like
smartphones and wearables. This technology is ideal for battery-powered applications as it
consumes less energy compared to classic Bluetooth.
Additional Features:
Integrated Onboard Memory: The ESP32 WROOM module typically includes built-in flash
memory, allowing for program and data storage.
Rich Peripheral Set: It offers a variety of peripherals like GPIO pins, ADC (Analog-to-Digital
Converter), SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), and more. These
features enable interaction with various sensors, displays, and other external components.
Low Power Consumption: Designed with power efficiency in mind, the ESP32 WROOM module
can operate in different power modes, allowing developers to optimize battery life for specific
applications.
Compact Size: The module is relatively small and lightweight, making it suitable for integration
into space-constrained projects.
Applications:
The ESP32 WROOM module's versatility makes it ideal for various IoT (Internet of Things)
applications, including:
The MQ2 sensor is one of the most widely used in the MQ sensor series. It is a MOS (Metal Oxide
Semiconductor) sensor. Metal oxide sensors are also known as Chemiresistors because sensing is
based on the change in resistance of the sensing material when exposed to gasses. The MQ2 is a
heater-driven sensor. It is therefore covered with two layers of fine stainless steel mesh known as an
“anti-explosion network”. It ensures that the heater element inside the sensor does not cause an
explosion because we are sensing flammable gasses.
Specifications
1.Operating voltage 5V
2.Load resistance 20 KΩ
5.Sensing Resistance 10 KΩ – 60 KΩ
5.3 BUZZER
An audio signaling device like a beeper or buzzer may be electromechanical or piezoelectric or mechanical type.
The main function of this is to convert the signal from audio to sound. Generally, it is powered through DC
voltage and used in timers, alarm devices, printers, alarms, computers, etc. Based on the various designs, it can
generate different sounds like alarm, music, bell & siren. A buzzer is an efficient component to include the
features of sound in our system or project. It is an extremely small & solid two-pin device thus it can be simply
utilized on breadboard or PCB. So in most applications, this component is widely used. t includes two pins
namely positive and negative. The positive terminal of this is represented with the ‘+’ symbol or a longer
terminal. This terminal is powered through 6Volts whereas the negative terminal is represented with the
‘-‘symbol or short terminal and it is connected to the GND terminal.
Specifications
Colour is black
5.4 LED
Light-emitting diodes are heavily doped p-n junctions. Based on the semiconductor material used and the
amount of doping, an LED will emit colored light at a particular spectral wavelength when forward biased. As
shown in the figure, an LED is encapsulated with a transparent cover so that emitted light can come out. The
colour of an LED is determined by the material used in the semiconducting element. The two primary materials
used in LEDs are aluminium gallium indium phosphide alloys and indium gallium nitride alloys. Aluminium
alloys are used to obtain red, orange and yellow light, and indium alloys are used to get green, blue and white
light. Slight changes in the composition of these alloys change the colour of the emitted light.
The servo motor is specialized for high-response, high-precision positioning, As a motor capable of accurate
rotation angle and speed control it can be used for a variety of equipment.
A rotation detector (encoder) is mounted on the motor and feeds the rotation position/speed of the motor shaft
back to the driver. The driver calculates the error of the pulse signal or analog voltage (position commands/speed
command) from the controller and the feedback signal (current position/speed) and controls the motor rotation so
the error becomes zero. The closed loop control method is achieved with a driver motor and encoder, so the
motor can carry out highly accurate positioning operations. An END signal is obtained that communicates the
completion of the positioning operation. An alarm can be output if there is an abnormality such as an overload,
making it possible to communicate equipment abnormalities.
SPECIFICATIONS
1. Power: 4.8V-6V DC max (5V works well)
2. Average speed: 60 degrees in 0.20 sec (4.8V),60 degrees in 0.16 sec (6.0V)
Its working voltage is 12V DC. It can work with a simple 12V battery without any difficulty. This fan has the
ability to run at a speed of 6800 rpm. The body of the fan is built from a combination of resin and plastic
material. The combination provides strength and insulation to the fan. Due to its manufacturing, It is light in
Dept. of E&CE, BIET, Davangere Page
14
LPG gas leakage detection using ESP32
weight and strong enough to bear some falls on the ground. So if you are looking for a perfect combination of
strength and insulation in a single fan, then you are in the right place.
Specification:-
4. Lightweight
5. Durable
A relay module is an electrical device that acts as a switch controlled by an external electrical signal. It is widely
used in electronic and electrical applications to control high-power circuits using low-power signals. Key
Components
1. Relay: An electromagnetic switch that toggles between states when a control signal is applied. It typically
includes:
2. Driver Circuit: Often includes a transistor or MOSFET to amplify the control signal.
3. Protection Components:
o Diode (Flyback Diode): Protects the circuit from voltage spikes generated when the relay coil is
turned off.
o Optoisolator (in some modules): Provides electrical isolation between the control circuit and the
relay.
Key Features
1. Control Voltage: The voltage required to activate the relay (commonly 3.3V, 5V, or 12V).
2. Contact Ratings: Defines the maximum voltage and current the relay can handle (e.g., 10A at 250V AC
or 30V DC).
4. Isolation: Provides electrical isolation between the low-power control circuit and the high-power circuit.
5.8 BATTERY
The battery provides the necessary power for the robot's motors and electronics. Separate power supplies may be
used for the motors and control circuitry to ensure stable operation.
Specifications:
CHAPTER 6
SOFTWARE REQUIREMENT
Arduino uno for programming Arduino microcontroller. Arduino uno can be implemented within
Windows, Mac and Linux operating systems. Most of its components are written in c language for
easy editing and compiling. Users can modify internal layouts and schematics when required.
It is an official Arduino software, making code compilation too easy that even a common person
with no prior technical knowledge can get their feet wet with the learning process. It is easily
available for operating systems like MAC, Windows, Linux and runs on the Java Platform that
comes with inbuilt functions and commands that play a vital role for debugging, editing and
compiling the code in the environment.
Tools
Auto Format This formats your code nicely: i.e., indents it so that opening and closing curly braces
line up, and that the statements inside curly braces are indented more. Archive Sketch Archives a
copy of the current sketch in .zip format. The archive is placed in the same directory as the sketch.
Fix Encoding & Reload Fixes possible discrepancies between the editor char map encoding and
other operating systems char maps. Serial Monitor Opens the serial monitor window and initiates
Dept. of E&CE, BIET, Davangere Page 19
LPG gas leakage detection using ESP32
the exchange of data with any
connected board on the currently selected Port. This usually resets the board, if the board supports
Reset over serial port opening.
Board Select the board that you're using. See below for descriptions of the various boards. Port This
menu contains all the serial devices (real or virtual) on your machine. It should automatically
refresh every time you open the top-level tools menu. Programmer For selecting a hardware
programmer when programming a board or chip and not using the onboard USB serial connection.
Normally you won't need this, but if you're burning a bootloader to a new microcontroller, you will
use this. Burn Bootloader The items in this menu allow you to burn a bootloader onto the
microcontroller on an Arduino board. This is not required for normal use of an Arduino board but is
useful if you purchase a new ATmega microcontroller (which normally come without a bootloader).
Ensure that you've selected the correct board from the Boards menu before burning the bootloader
on the target board. This command also set the right fuses.
Writing Sketches
Programs written using Arduino Software (IDE) are called sketches. These sketches are written in
the text editor and are saved with the file extension. ino. The editor has features for cutting/pasting
and for searching/replacing text. The message area gives feedback while saving and exporting and
also displays errors. The console displays text output by the Arduino Software (IDE), including
complete error messages and other information. The bottom righthand corner of the window
displays the configured board and serial port. The toolbar buttons allow you to verify and upload
programs, create, open, and save sketches, and open the serial monitor. Arduino IDE is used to
control all the input and output devices that are connected to the Arduino uno with programming.
For code, the following libraries are installed:
WiFi.h: Handles Wi-Fi connectivity on the ESP32.
WiFiClient.h: Used for creating a Wi-Fi client connection.
BlynkSimpleEsp32.h: Enables communication with the Blynk IoT platform on the ESP32.
Adafruit_MPU6050.h: Provides support for the MPU6050 sensor, allowing reading of the data
from the sensor.
Adafruit_Sensor.h: Includes sensor event data types and helper functions used with the Adafruit
sensor libraries.
Wire.h: For I2C communication, used for connecting and communicating with the MPU6050
sensor.
6.2 Zapier
Zapier is a cloud-based automation tool that enables users to connect apps and services without requiring
technical expertise. It uses triggers (events in one app) to initiate actions in other apps, helping users
automate repetitive tasks. For example, when a new lead is added in Google Sheets, Zapier can
automatically create a contact in Salesforce or send a notification in Slack.
1. Multi-Step Zaps: Create workflows that involve multiple steps, such as collecting data, processing
it, and sending it to different apps.
2. Conditional Logic (Paths): Execute different actions based on conditions, such as splitting
workflows depending on whether a lead is from one region or another.
3. Filters: Set specific conditions for Zaps to execute only when certain criteria are met.
4. Data Formatting: Use built-in tools to format dates, numbers, or text, and prepare data for other
apps.
5. Webhooks: Advanced users can trigger Zaps or send data to apps that support webhooks.
6. App Extensions: Integrations cover various domains, including project management, email
marketing, CRM, social media, and more.
Benefits in Detail:
1. Increased Productivity:
Automates repetitive tasks like data entry, email notifications, and syncing information across apps, saving
time for higher-value activities.
2. No Coding Required:
Zapier’s intuitive interface enables anyone to set up workflows, making automation accessible even for
non-technical users.
3. Scalable Automations:
From single-trigger workflows to complex multi-step Zaps with filters and logic, it accommodates
businesses of all sizes.
4. Improved Accuracy:
Zapier supports over 5,000 apps, including popular tools like Gmail, Slack, Trello, HubSpot, and Shopify.
6. Custom Workflows:
Build workflows tailored to unique business processes without needing custom software development.
Limitations in Detail:
Free plans have limited Zaps and monthly tasks (100 tasks per month).
Paid plans can be expensive for businesses requiring a high volume of tasks or advanced features
like multi-step Zaps and webhooks.
2. Dependency on Triggers:
Workflows are reactive, meaning they only activate when a trigger event occurs. This can limit proactive
automation.
Requires a stable internet connection, and offline workflows are not supported
Dept. of E&CE, BIET, Davangere Page 23
LPG gas leakage detection using ESP32
4. Latency in Execution:
On free and lower-tier plans, Zaps might take several minutes to execute, which could be an issue
for time-sensitive workflows.
Real-time execution is available only in higher-tier plans.
Some app integrations do not support all features available in the app itself. For example, Zapier might
allow creating new entries but not retrieving or modifying existing ones.
While simple tasks are easy to set up, complex workflows involving conditions, multi-step actions, or
API/webhooks may require technical knowledge.
As a cloud-based tool, data is transferred through Zapier, which could raise concerns about privacy
and compliance with regulations like GDPR or HIPAA.
Requires a stable internet connection, and offline workflows are not supported.
CHAPTER 7
RESULT AND DISCUSSION
The results of this project LPG gas leakage detection using ESP32 are discussed in the following
cases in detailed manner as explained in the methodology.
After uploading the code, open the monitor. The Monitor will display the initialization message.
Figure 7.1.1 Arduino IDE software with Embedded C code and Initialization
When gas is detected by MQ-2 gas sensor ,the following events take place:
the servo motor turns off the LPG regulator.
LED blinks as a visual indicator of the leak.
Buzzer or beeper beeps when there is leak.
Exhaust Fan turns on
Triggers email notification. Below figure 7.1.2 Shows the circuit connections and mobile
app notification.
Figure 7.1.2.1 email notification when high gas Figure 7.1.2.1 email notification when all
level is detected. conditions are good
CHAPTER 8
APPLICATIONS
1. Gas Storage Areas
Homes: Protects households by detecting LPG leaks in kitchens and storage rooms, minimizing the risk of
fire and explosion.
Factories and Industries: Useful in industrial facilities where gases like propane, butane, or other volatile
compounds are stored or used in processes.
Hotels: Ensures the safety of staff and guests by monitoring gas usage in kitchens and maintenance areas.
2. Fire Hazard Prevention
Effective in early detection of gas leaks that could lead to explosions or fires, enabling swift action to
prevent large-scale property damage and loss of life.
3. Harmful Gas Detection
Detects not just flammable gases but also toxic gases (e.g., methane, carbon monoxide) in various
environments, improving safety standards in workplaces and living spaces.
4. Domestic Gas Leakage Detection
Aims to reduce the increasing number of kitchen-related accidents caused by LPG leaks. The system
alerts residents via alarms, SMS, and phone calls.
5. Portable Gas Detector
Compact and lightweight, the device is easy to transport and deploy in various locations, such as:
o Construction sites
o Temporary storage units
o Outdoor environments where gases are used or stored.
6. Industrial Combustible Gas Detection
Provides safety in industries like:
o Chemical manufacturing: Ensures processes involving volatile chemicals are monitored for leaks.
o Petrochemical refineries: Detects gas leaks in high-risk areas.
o Automotive: Monitors compressed natural gas (CNG) systems in vehicles.
LIMITATIONS
The limitations of LPG gas leakage detection using ESP32 are:
1. Limited Detection Range
The gas sensor, such as the MQ2, has a specific sensitivity range and may fail to detect leaks in
larger or open areas where the gas may dissipate quickly before reaching the sensor.
2. False Positives
The system may generate false alarms due to:
o Detection of non-hazardous gases or fumes similar to the targeted gases (e.g., cooking odors
or smoke).
o Environmental factors like high humidity, dust, or temperature fluctuations, which can affect
sensor accuracy.
3. Dependency on Power Supply
The system relies on an uninterrupted power source to function. In case of power outages, the gas
detector and its alert mechanisms may fail unless equipped with a backup power supply (e.g.,
battery or UPS).
4. Maintenance Requirements
Sensors require regular calibration and maintenance to maintain accuracy. Over time, the sensor's
sensitivity may degrade, leading to reduced performance or false readings.
5. Lack of Advanced Data Integration
The current system may not integrate well with advanced analytics or cloud-based systems for real-
time monitoring and trend analysis, which are critical for industrial applications.
6. Initial Installation and Costs
While cost-effective in the long run, the initial installation, including purchasing multiple sensors
and integrating them into existing infrastructure, may be expensive for larger setups.
CONCLUSION
The LPG gas leakage detection system using the ESP32 microcontroller represents a significant
advancement in safety technology for both residential and industrial environments. It addresses the
growing need for effective gas leak detection and prevention, which is crucial given the potential
hazards posed by LPG, such as fires, explosions, and poisoning. The system utilizes a highly
sensitive MQ-series sensor that detects LPG concentrations in the air. This data is processed by the
ESP32 microcontroller, which triggers real-time email notifications when gas levels exceed a
predefined threshold, alerting users immediately and allowing for prompt intervention. This email
notification system provides a key advantage, as it enables remote monitoring of gas levels,
reducing the need for physical presence and enhancing safety.
In conclusion, this research highlights the potential of a safety systems to improve public safety and
reduce the risks associated with LPG usage. By leveraging affordable, accessible technology, this
system offers a practical solution to a widespread problem. The system’s ability to detect gas leaks
early and provide real-time alerts is a vital step toward creating safer living and working
environments. As technology advances, further improvements and integrations will likely expand
the system’s capabilities, offering even greater safety and convenience for users across different
industries.
FUTURE SCOPE
The future of LPG gas leakage detection using ESP 32 holds exciting possibilities for enhancing
safety and promoting well-being. Here are some key areas of exploration:
1.Multi-Gas Detection :
The system currently focuses on LPG detection. However, integrating additional sensors for other
hazardous gases such as carbon monoxide (CO), methane (CH4), and hydrogen sulfide (H2S) could
provide more comprehensive safety coverage, especially in industrial environments where multiple
gases may be present. This would enhance the system’s ability to detect a wider range of risks.
2.Improved Sensor Technology:
The performance of the gas sensors could be enhanced with the development of more sensitive and
durable sensors that can detect lower concentrations of gases. Future sensor technology may offer
higher accuracy, faster response times, and better resistance to environmental factors such as
humidity, dust, or temperature fluctuations.
3. Energy-Efficient and Solar-Powered Options:
For remote or off-grid locations, the system could be upgraded with solar-powered solutions or
energy-efficient sensors, reducing dependence on the electrical grid. This would make the system
suitable for rural areas, outdoor applications, or locations with limited access to power.
REFRENCES
1. OM Ghodke, S. Kadam, C. Jhoshi, S. Shitole, and N. V. Pandhare, "LPG gas leakage detection
using ESP32," International Scientific Journal of Engineering and Management, vol. 3, no. 4, pp. 1–
3, Apr. 2024, doi: 10.55041/ISJEM01434.
2. S. Lakshmi Lavanya, M. D. V. Prasad, A. Sravya, C. D. Prasad, A. Seshadri, and R. K. S. Kumar,
"Gas Leakage Detector Using Arduino," International Research Journal of Engineering and
Technology (IRJET), vol. 10, Special Issue, pp. 350–353, Apr. 2023.
3. M. Abdullah Khan, "Gas Detection Using ESP32 and Fire Alarm," Department of Electrical and
Electronic Engineering, United International University, Project Report, Sept. 2023, doi:
10.13140/RG.2.2.18846.31041.
APPENDIX A
DATASHEET
Parameter Specifications
Sensor Type Semiconductor Gas Sensor
Sensing Material SnO2 (Tin Dioxide)
Target Gases LPG, Methane, Butane, Hydrogen, Smoke,
Alcohol, Propane, Carbon Monoxide
Output Type Analog and Digital (via onboard comparator)
Heater Voltage (VH) 5V ± 0.1V
Circuit Voltage (VC) 5V ± 0.1V
Load Resistance (RL) Adjustable (2kΩ–20kΩ, typical)
B: SOURCE CODE
#include <WiFi.h>
#include <ESP32Servo.h>
// Pin configuration
const int servoPin = 13; // GPIO13 for servo motor PWM control
// Wi-Fi credentials
// Threshold value
Servo gasValveServo;
void setup() {
Serial.begin(115200);
// Initialize pins
pinMode(relayPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(relayPin, LOW);
digitalWrite(buzzerPin, LOW);
digitalWrite(ledPin, LOW);
connectToWiFi();
Serial.print("Connecting to Wi-Fi...");
WiFi.begin(ssid, password);
delay(1000);
Serial.print(".");
Serial.println("\nConnected to Wi-Fi");
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
if (httpResponseCode > 0) {
Serial.println(httpResponseCode);
} else {
Serial.println(http.errorToString(httpResponseCode).c_str());
}
Dept. of E&CE, BIET, Davangere Page 39
LPG gas leakage detection using ESP32
sSP32
http.end();
} else {
void loop() {
Serial.println(gasValue);
Serial.println("Gas detected! Fan ON, Buzzer ON, LED ON, Gas valve CLOSED.");
if (!gasAlertSent) {
sendHttpAlert(highAlertURL, highGasMessage);
gasAlertSent = true;
} else {
Serial.println("No gas detected. Fan OFF, Buzzer OFF, LED OFF, Gas valve OPEN.");
if (!gasNormalSent) {
sendHttpAlert(normalAlertURL, lowGasMessage);
gasNormalSent = true;
CONTACT DETAILS