Project Files of Gas Sensor Library for Proteus V2.0 (MQ-2 + Arduino)
gas-sensor-mq2-tep-v2-0-0b3dafb38c5d4a9c9994e3cad34056ba.zip

Gas Sensor Library for Proteus V2.0
Gas Sensor Library for Proteus V2.0 comes as a ZIP archive of 12 files (1.4 MB, 3.0 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, an Arduino sketch and compiled HEX firmware.
- LIBProteus library
- IDXProteus library index
- DLLProteus model
- DSNProteus simulation
- INOArduino sketch
- HEXHEX firmware
Description
Looking for the files of Gas Sensor Library for Proteus V2.0 (MQ-2 + Arduino)? Gas Sensor Library for Proteus V2.0 is the ZIP package (1.4 MB) you need. It holds the Proteus library files (LIB and IDX), the simulation model (DLL), a ready Proteus simulation, an Arduino sketch and the compiled HEX firmware. Below are the file structure, the README and the installation steps, so you can go from download to a working Proteus simulation in a few minutes.
What this library is
Gas-Sensor-MQ2-Library-for-Proteus-v2.0.zip with MQ-2 Simple and Advance (TEPMQ2.LIB and TEPMQ2.DLL), the TEP Serial Monitor and Arduino UNO libraries for Proteus, the two-UNO gas leak alarm simulation with its HEX file, the demo sketch and a README.
This is version 2.0; older or newer releases, when they exist, are listed in the Development tab.
What is inside the ZIP file
- ArduinoV3TEP.LIB – Proteus library, 95.6 KB
- TEPMQ2.LIB – Proteus library, 122.3 KB
- TEPSERIALMON.LIB – Proteus library, 11.1 KB
- ArduinoV3TEP.IDX – Library index, 830 B
- TEPMQ2.DLL – Simulation model, 414.5 KB
- TEPSERIALMON.DLL – Simulation model, 978 KB
- and 6 more, all listed in the File Structure tab
The archive unpacks to 3.0 MB and carries its own README (README.txt), shown in the README tab above.
How to download
Use the download panel at the top of this page: after the counter (30 seconds for guests, 10 for members) the black button unlocks and the ZIP file comes straight from our content network. If the browser opens it instead of saving, use Save as; extract the whole archive before using anything inside it.
How to install
- Step 1: Extract the ZIP file with Windows (Extract All), 7-Zip or WinRAR, keeping its folders.
- Step 2: Close Proteus and copy ArduinoV3TEP.LIB, TEPMQ2.LIB and TEPSERIALMON.LIB and ArduinoV3TEP.IDX into its LIBRARY folder (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY).
- Step 3: Copy TEPMQ2.DLL and TEPSERIALMON.DLL into the MODELS folder next to it, so the part simulates.
- Step 4: Start Proteus, press P and search for "ArduinoV3TEP"; place and wire it as in the tutorial.
- Step 5: Open MQ2_Gas_Leak_Alarm.ino in the Arduino IDE, pick board and port and Verify (Export Compiled Binary gives the HEX).
- Step 6: In Proteus set the controller's Program File to MQ2_Gas_Leak_Alarm.hex; on hardware, flash the same file.
- Step 7: Open Gas-Sensor-MQ2-ArduinoUnoV3.pdsprj in Proteus and press Play.
Read the detailed guide
This page is for the files. The full tutorial, Gas Sensor Library for Proteus V2.0 (MQ-2 + Arduino), explains the circuit and the code step by step and shows the working results and the simulation; read it before you build. Questions about the download or the installation go in the comments below; more Proteus downloads are listed further down this page.
File Structure
10.5 KB830 B95.6 KB122.3 KB11.1 KB414.5 KB978 KB35.8 KB29.7 KB414.5 KB978 KB29.2 KBGallery12 images from the tutorialOpen the tutorial
The circuit, the board and the results as they appear in Gas Sensor Library for Proteus V2.0 (MQ-2 + Arduino). Open an image for its full size.












README
GAS SENSOR (MQ-2) LIBRARY FOR PROTEUS - V2.0
Designed by The Engineering Projects
www.TheEngineeringProjects.com
IMPORTANT LINKS
Article (read it first - pictures, step by step, every feature explained):
https://www.theengineeringprojects.com/2026/10/gas-sensor-library-for-proteus-v2-0.html
Report a bug or suggest a feature (our forum):
https://www.theengineeringprojects.com/forum/category/gas-sensor-proteus-library
The demo uses our TEP Serial Monitor Advance (included) instead of Proteus's
Virtual Terminal - its own article:
https://www.theengineeringprojects.com/2026/10/serial-monitor-advance-proteus-library.html
Support us (the libraries are free):
https://www.theengineeringprojects.com/donate
FILE STRUCTURE
MQ2-TEP-v2.0/
|-- Proteus Library Files/
| |-- ArduinoV3TEP.IDX 0.8 KB its index -> LIBRARY folder
| |-- ArduinoV3TEP.LIB 95.6 KB TEP Arduino UNO (demo) -> LIBRARY folder
| |-- TEPMQ2.LIB 122.3 KB MQ-2 Simple + Advance (2 devices) -> LIBRARY folder
| |-- TEPSERIALMON.LIB 11.1 KB TEP Serial Monitor Advance -> LIBRARY folder
|-- Proteus Model Files/
| |-- TEPMQ2.DLL 414.5 KB MQ-2 model -> MODELS folder
| |-- TEPSERIALMON.DLL 978.0 KB Serial Monitor model -> MODELS folder
|-- Proteus Simulation/
| |-- Gas-Sensor-MQ2-ArduinoUnoV3.pdsprj 35.8 KB demo: UNO 1 + MQ-2 Simple, UNO 2 + MQ-2 Advance
| |-- MQ2_Gas_Leak_Alarm.hex 29.7 KB both UNOs (demo sketch V2.0)
| |-- TEPMQ2.DLL 414.5 KB copy of the model so the demo runs as is
| |-- TEPSERIALMON.DLL 978.0 KB copy of the monitor model
|-- Arduino Code/
| |-- MQ2_Gas_Leak_Alarm/MQ2_Gas_Leak_Alarm.ino 10.5 KB the demo sketch (source of the .hex)
|-- README.txt 29.2 KB this file
Total: 3.05 MB (unzipped). The C++ source code of the model is not included.
WHAT IS IT?
A simulation model of the MQ-2 gas sensor module for Proteus 8: the MQ-2 SnO2
sensor in its stainless mesh cap on the common blue board with the LM393
comparator, the blue trimmer pot and the "102" load resistor. It is an ANALOG
model: A0 is a real voltage that your Arduino's analogRead() measures, made by the
board's own divider - the sensor Rs from VCC to A0 and the 1 k load resistor from
A0 to GND, so A0 = VCC x RL / (Rs + RL) and MORE gas = a HIGHER A0. Rs follows
the datasheet curves (Rs / R0 against ppm for LPG, smoke, alcohol, methane and
hydrogen; clean air = 9.83), D0 is the LM393's open-collector output (LOW while A0
is above the pot's voltage = gas, HIGH in clean air), and the 33 ohm heater draws
its 150 mA from VCC. The sensor is slow like the real one (the gas reaches it with
a 3 s response and a 10 s recovery) and a cold sensor reads far too high: at
power-on A0 starts near 3.7 V (ADC ~760, D0 may false-alarm) and falls to the
clean-air 0.46 V (ADC 95) while the heater warms up (WARMUPTIME, 20 s by
default). You set the gas in a kitchen scene - clean air or a leak of LPG, smoke,
alcohol, methane or hydrogen at 200 - 10000 ppm, VENTILATE, PUFFS - and turn the
D0 pot. The part looks like the blue MQ-2 module, drawn bold: the big sensor
whose gauze glows orange while the heater warms up and takes the colour of the
gas it breathes, the red PWR and green D0 LEDs (the real board's two LEDs), an
A0 LEVEL bar and an AIR AT THE SENSOR window above the board where the gas
drifts down into the sensor (both TEP additions, see the BOARD below).
TWO DEVICES IN ONE LIBRARY (search "MQ-2" or "MQ2" in Pick Devices):
MQ-2 Simple device MQ2TEP "Gas Sensor MQ-2 (TEP) - Simple"
On-Sheet Panel: the GAS SCENE panel on the schematic next to the
sensor - the state (CLEAN AIR / GAS DETECTED / HEATER WARMING UP
...), the kitchen (the gas source, puffs drifting to the sensor
on the wall, the window with an exhaust fan), the LEAK card (the
leak's setting on a log bar), the A0 vs POT gauge (the LM393's
comparison and the D0 LED), the readouts PPM (the gas at the
sensor), SKETCH (what the demo sketch computes from the ADC), A0,
ADC, D0, HEATER, and the buttons. The red X in the panel's header
closes it, the PANEL: SHOWN / CLOSED button on the board opens it
again.
MQ-2 Advance device MQ2ADVTEP "Gas Sensor MQ-2 (TEP) - Advance"
Pop-Up Panel: only the sensor board on the schematic; at Run a TEP
pop-up window "TEP MQ-2 Advance" opens - the same look as the TEP
Serial Monitor (move it by its header, resize it, minimise it).
The tabs Gas and Test sit in the header; the gear and ? icons
open Settings and Help; the palette icon switches the theme:
Gas the state, the kitchen picture, the A0 vs POT card,
six readouts (the gas at the sensor, what the sketch
reads as LPG, Rs / R0 from the ADC, A0 / ADC, D0, the
heater), every control (gas, the leak on a log slider +
presets + FINE, VENTILATE, PUFFS, heater SKIP / REAL,
the D0 pot), the demo sketch's formula step by step
from the ADC, and a live chart of the last 60 s (A0,
the gas at the sensor, the pot's level, D0 LOW)
Test four tools measured on the running circuit: Warm-up,
ppm curve, Step response, D0 alarm (see THE TEST TOOLS
below)
Settings theme (TEP Dark / Light), text size, open at Run,
window size - remembered for your Windows user
Help Help & Support like the TEP Serial Monitor: report a
bug, suggest a feature, article, user guide, updates,
donate, website, forum; Copy diagnostics (sensor,
room, pins, the demo's formula, test results) for a
bug report
The OPEN PANEL button on the board opens the window again after
you close it.
Both devices use the same model (TEPMQ2.DLL) and the same properties.
NEW IN V2.0
(Earlier versions of TEP's gas sensor library were simpler; V2.0 is a new model.)
* Two devices: MQ-2 Simple (the gas scene on the sheet, close / open) and MQ-2
Advance (pop-up window with the gas scene, four test tools, settings and help)
- see above.
* An analog model: A0 is the board's real divider (RL 1 k "102"), D0 the LM393's
open collector with its pull-up, the 33 ohm heater a real 150 mA load on VCC.
* The datasheet curves for LPG, smoke, alcohol, methane and hydrogen (the
MQSensorsLib constants, so a sketch using them reads back the ppm you set),
clean air 9.83, R0 1 k (clean air = 94.6 ADC counts: Proteus prints 95, a real
UNO 94).
* The sensor is slow: the gas at the sensor follows the room with 3 s (response)
/ 10 s (recovery) / 15 s (VENTILATE) - D0 trips 2.6 s after a 1000 ppm LPG
leak starts and clears 5.5 s after the leak stops.
* The heater warm-up (WARMUP = REAL, WARMUPTIME 20 s): a cold sensor reads high
and D0 false-alarms at power-on, exactly the behaviour of the real module;
WARMUP = SKIP starts pre-heated.
* PUFFS: the leak comes in drifting puffs - the room's concentration swings on
its own (5 % .. 195 % of the setting) and the sensor follows through its lag;
near the trip level the alarm comes and goes. The setting stays the BASE: the
panels show "(base)", an amber marker at the room's concentration now and
"PUFFS now <ppm>".
* The SKETCH readout (Simple) and the formula card (Advance) show the demo
sketch's own ppm estimate from the measured ADC with exactly the sketch's
formula and rounding, so the panel and the Serial Monitor agree; the ADC
readout is the UNO's 10-bit ADC as Proteus converts it (1024 x V / 5 V,
rounded to the nearest count; a real ATmega328P drops the fraction).
* Board: the blue MQ-2 module drawn clean and bold - see THE BOARD below.
* The demo: ONE project with two UNOs - UNO 1 with MQ-2 Simple, UNO 2 with MQ-2
Advance - each with the TEP Serial Monitor Advance (U3 = UNO 1, U4 = UNO 2,
quick buttons) and an alarm LED on A3.
* The demo sketch (V2.0) keeps every earlier output line ("ADC: 576 LPG: about
1009 ppm D0: LOW GAS LEAK! Ventilate!") and adds the commands HELP,
STATUS, READ, GAS (the curve), CAL, R0, LEVEL, EVERY, WAIT.
* Version 2.0 everywhere; the C++ source code is not included.
TEST STATUS
V2.0: verified in Proteus 8.5 on 9 Oct 2026 (this package's demo project and
DLL; two UNOs, U2's pop-up open on the Test page, U1's panel and both Serial
Monitors open: about 0.6 x real time).
In Proteus: the project loads, both MQ-2 devices draw, U2's pop-up "TEP MQ-2
Advance" opens without a Windows title bar. The cold start counts down
("Heater warming up..."), then "ADC: 95 LPG: about 4 ppm D0: HIGH Air is
clean" - the panel shows the same numbers as the Serial Monitor. U1 LPG LEAK:
"GAS DETECTED - A0 HIGH, D0 LOW, D0 LED ON" and the reading climbs through the
sensor's lag to "ADC: 576 LPG: about 1009 ppm D0: LOW GAS LEAK!
Ventilate!". PUFFS shows "(base)" and "PUFFS now ...". No outline is left
around CLEAN AIR, every row label is readable, the red X and the PANEL button
work.
The test tools in Proteus: Warm-up ADC 762 -> 95, D0 false alarm 1.87 s,
within 1 count after 18.5 s; ppm curve (all 5 gases) 35 of 35 points, largest
error 1.3 %, clean air 95, LPG 1000 ppm = ADC 576 = 1009 ppm, H2 1000 ppm =
513; Step response clean -> 1000 ppm x 3: A0 at 90 % after 3.2 / 46.0 / 3.2 s,
D0 LOW after 2.55 s, HIGH after 5.52 s, LOW after 2.55 s (ADC 575 / 95 / 575);
D0 alarm at 50 %: LOW at 2.50 V = 574 ppm, HIGH again at 2.50 V = 574 ppm (no
hysteresis). Fixed during the verification: the row labels' spacing, no
outline around a button that turns grey, the ADC counted the way Proteus
counts it (rounded), and the speed (0.2 x before, 0.6 x now: only the changed
parts of the panel are redrawn, the pop-up repaints at most 5 times a second).
3192 automatic checks on a PC, 0 failed:
112 on the pure model (the curves and their inverse, the ADC table for 5 gases
x 4 levels + clean air, the D0 rule for 19 pot positions x 6 gases x 40 levels,
the lag, the warm-up, PUFFS - the closed form against a numerical lag -, the
test chamber, the demo's formulas);
343 on the complete Proteus model in a host SPICE (both devices, the measured A0
and D0 for every gas, the D0 edges where the lag puts them, VENTILATE, the
presets / FINE / pot, the warm-up, power from a pin / GND high, properties, the
red X / PANEL button, the board's live parts, PUFFS with "(base)" + the amber
marker, the SKETCH readout, ASCII-only schematic text in every state, no text
covered by a button or a shape in 98 drawn states, no outline left around a
button that turned grey, only the changed parts of the panel redrawn, the
Advance pop-up's commands, all four test tools measured end to end);
32 with the real V2.0 demo sketch on TWO UNOs against two complete models
(every output line, the warm-up countdown, the alarm LEDs, every command, the
panels' numbers = the printed ones, every line at most 80 characters);
2705 on the rendered boards and pop-up windows (every page fits in TEP Dark and
Light, at Small / Large text and 150 % DPI; no text, button or card title is
cut; no empty band; every tool's hint lines and every header state fit; before
a test has run its result tiles show "-" and its chart is empty).
The PC numbers (host SPICE, 10 ms steps): Warm-up ADC 761 -> 95, D0 false alarm
1.87 s, within 1 ADC count after 18.5 s; ppm curve 35 points, the demo's
formula within 1.3 %; Step clean -> 1000 ppm LPG: D0 LOW after 2.57 s, A0 at
90 % after 3.2 s; back to clean: D0 HIGH after 5.53 s, A0 at 90 % after 46 s;
D0 alarm at 50 %: D0 LOW at A0 2.502 V (576 ppm LPG), HIGH at 2.498 V (573
ppm), within one 10 ms step.
INSTALLATION (about 2 minutes)
1. Close Proteus. Extract the WHOLE ZIP to a normal folder (e.g. Desktop).
2. Copy everything in "Proteus Library Files" (TEPMQ2.LIB with both devices,
TEPSERIALMON.LIB and the TEP Arduino UNO V3 library ArduinoV3TEP.LIB / .IDX
used by the demo) to the LIBRARY folder of Proteus, for example:
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY
(on some PCs: C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\
LIBRARY - use the folder that already holds Proteus's own .LIB files).
3. Copy TEPMQ2.DLL and TEPSERIALMON.DLL from "Proteus Model Files" to the MODELS
folder (...\Proteus 8 Professional\MODELS).
4. If an earlier TEPMQ2.IDX is in the LIBRARY folder, delete it.
5. Start Proteus. In Pick Devices (P) search "MQ-2": you get the Simple and the
Advance device (category Sensors > Gas Sensors).
RUN THE DEMO
"Proteus Simulation\Gas-Sensor-MQ2-ArduinoUnoV3.pdsprj" - keep the .hex file and
the two DLLs beside the project.
UNO 1 (ARD1): MQ-2 Simple (U1), Serial Monitor U3.
UNO 2 (ARD2): MQ-2 Advance (U2), Serial Monitor U4.
Both run MQ2_Gas_Leak_Alarm.hex. An LED (D1 / D2) with 220 ohm on A3 of each
UNO: the gas alarm (it blinks 4 times a second on gas).
1. Press Run. Both monitor windows open (9600 baud) and so does U2's pop-up.
Both sensors start COLD (WARMUP = REAL): the gauze glows orange, heat
shimmers in the window above the board, A0 starts near 3.7 V and D0 is LOW
for about 2 s (the power-on false alarm). U3 / U4 show "MQ-2 Gas Leak Alarm
- The Engineering Projects", "V2.0 - type HELP ...", "Warming up the
sensor's heater for 20 s..." and "Heater warming up... 20 s left ADC:
684" (in Proteus) twice a second, the ADC falling.
2. After 20 s: "ADC: 95 LPG: about 4 ppm D0: HIGH Air is clean".
3. U1: click LPG LEAK on the panel. The cylinder appears, puffs drift to the
sensor, the ppm tag climbs; after about 2.6 s D0 goes LOW (the D0 LED on the
board and in the gauge lights, the window's border turns red, the alarm LED
blinks) and U3 prints "ADC: 576 LPG: about 1009 ppm D0: LOW GAS
LEAK! Ventilate!" - the panel's SKETCH readout shows the same 1009 ppm. Try
SMOKE (1000 ppm smoke stays below the D0 level: "SOME GAS" and the sketch's
LPG estimate says about 185 ppm - type GAS SMOKE in U3 and it reads about
1000), VENTILATE (the fan spins, the gas clears slowly), PUFFS (the leak
comes and goes), POT - / POT + (where D0 switches), the red X and PANEL.
4. U3 / U4 quick buttons: U3 STATUS, READ, GAS SMOKE, HELP; U4 STATUS, GAS
LPG, LEVEL 2000 (the alarm from the estimate instead of D0), CAL (measure
R0 - in clean air only).
5. U2 (Advance): Gas page - every control, the formula card, the live chart.
Test page: Warm-up, ppm curve (All 5), Step response, D0 alarm - see THE
TEST TOOLS.
6. Close U2's window and open it again with OPEN PANEL on the board.
Closed a monitor window? Click OPEN MONITOR on the monitor part.
WIRING
MQ-2 VCC -> +5V, GND -> GND, A0 -> Arduino A0, D0 -> Arduino A1 (used as a digital
input; any digital pin works - the demo uses A1 so that both sensor wires leave
the UNO on the same side). The alarm LED + 220 ohm from A3 to GND; D13 (the UNO's
own LED) blinks too.
Serial Monitor RXD <- Arduino D1 (TX), Serial Monitor TXD -> Arduino D0 (RX),
Serial Monitor GND -> ground. RXD2 is not needed: the MQ-2 has no serial line.
Pin order in Proteus: VCC GND D0 A0 (the same order as on the module's header:
VCC GND DO AO).
REAL HARDWARE:
* Power the module from the 5V pin: the heater needs 5 V and about 150 mA (a USB
supply often sags to about 4.5 V with it). Never from an I/O pin - in the
simulation that gives only about 2.8 V (logged).
* Warm-up: let a sensor that was used recently warm up a few minutes; a new
sensor needs 24 - 48 hours of "burn-in" for its datasheet accuracy.
* R0 differs from sensor to sensor (Rs in 1000 ppm: 3 - 30 k): calibrate it in
clean air (the CAL command: R0 = Rs / 9.83) before you trust the ppm.
* The curves are for 20 C / 65 % RH; temperature and humidity shift them (not
simulated).
* The pot sets only where D0 switches; it does not change A0. Clockwise = a
higher reference = more gas before D0 goes LOW.
* D0 has no hysteresis: with the gas right at the level D0 (and its LED)
chatters.
THE BOARD (both devices)
The blue MQ-2 module, drawn clean and bold (not a photo copy): the big MQ-2
sensor with its bakelite base, steel cap and 100-mesh gauze, the blue pot, the
LM393, the "102" load resistor, the red PWR and green D0 LEDs, the 4-pin header
(VCC GND D0 A0). Live while the simulation runs:
* the gauze glows orange while the heater warms up (pulsing) and faintly when
hot, and takes the colour of the gas the sensor breathes; its rim "breathes"
with the gas;
* PWR LED (red) with the supply; D0 LED (green) while D0 is LOW (gas) - the
real board's two LEDs;
* A0 LEVEL bar (a TEP addition): 10 segments, green -> amber -> red, with the
A0 voltage (0.5 V each) and a white mark at the pot's level - the gas you
can see rise and fall;
* AIR AT THE SENSOR window above the board (a TEP addition): the gas at the
sensor in words ("LPG 1000 ppm", "CLEAN AIR", "WARMING UP 12 s", "NO
POWER"), coloured puffs drifting down into the sensor (more and bigger with
more gas), heat shimmer while warming; its border turns red while D0 is LOW
and orange while warming;
* the pot's rotor turns with the D0 pot; the PANEL: SHOWN / CLOSED (Simple) or
OPEN PANEL (Advance) button and the SIMPLE / ADVANCE badge.
THE GAS SCENE (Simple panel; the Advance Gas page has the same controls)
GAS IN THE ROOM CLEAN AIR, LPG LEAK, SMOKE, ALCOHOL, METHANE, HYDROGEN (the
source: an LPG / CH4 / H2 cylinder, a smoking pan, a bottle)
CONCENTRATION 200 / 1000 / 5000 / 10000 PPM, FINE - / + (x 1.26)
EFFECTS VENTILATE (the leak is shut, the exhaust fan clears the room
with 15 s), PUFFS (the leak in drifting puffs - the setting
stays the base; again = a steady leak)
HEATER WARM-UP SKIP (pre-heated) / REAL (a cold start now)
D0 TRIP POT POT - / POT + in 5 % steps (5 - 95 % of VCC)
The LEAK card shows the setting on a log bar (with "(base)", the amber marker
and "PUFFS now <ppm>" while the puffs run); the ppm tag at the wall sensor shows
the gas AT THE SENSOR (it lags the room); the A0 vs POT gauge shows the
comparison that makes D0.
The readouts: PPM = the gas at the sensor; SKETCH = what the demo sketch
computes from the ADC (its LPG curve, R0 1 k, Serial.print rounding); A0 (the
measured node voltage); ADC = the UNO's reading; D0; HEATER.
THE TEST TOOLS (MQ-2 Advance, Test tab) - what they really measure
Every number comes from the A0 and D0 node voltages the simulator solved at every
step (the ADC, Rs and ppm with the demo sketch's own formulas). The "test
chamber" tools set the gas AT THE SENSOR directly (no room lag) and give the
sensor back to the room afterwards. Each tool shows one "Good for:" line and one
line on how it measures.
Warm-up Good for: knowing how long your sketch must wait after power-on
before it trusts A0 and D0. A cold start of the heater in clean
air (or in the room's gas), WARMUPTIME + 15 %: A0 / ADC at the
cold start, the D0 false alarm, when A0 is within 2 % and within
1 ADC count of its end value, a chart. PC run: ADC 761 -> 95,
false alarm 1.87 s, within 1 count after 18.5 s (WARMUPTIME 20).
ppm curve Good for: checking your ppm formula and R0 - and seeing that
every gas needs its own curve. The chamber: 10000, 5000, 2000,
1000, 500, 200 ppm and clean air of one gas or all five, each
held 0.4 s; the ADC, Rs / R0 and the ppm read back with the
sketch's formula and the gas's curve, the error, what the LPG
curve would say; a log-log chart with the datasheet curves. PC
run: 35 points within 1.3 % (the ADC steps); 1000 ppm smoke =
ADC 384 reads 1007 ppm with its curve, 185 ppm as LPG.
Step response Good for: seeing how slowly A0 follows a gas change - and how
long D0 takes to alarm and to clear. Room steps with the real
lag (clean -> 1000 / 5000, 200 -> 2000, 1000 -> 10000 ppm of the
room's gas, 3 or 5 steps): first a flat lead-in at the start
value (it waits until A0 sits there), then every step holds 6
time constants (18 s up, 60 s down); t10 / t50 / t90 / 2 % of
A0, the D0 edge, the sketch formula's ppm at the end. PC run
(LPG clean <-> 1000 ppm): D0 LOW after 2.57 s, A0 90 % after 3.2
s; down: D0 HIGH after 5.53 s, A0 90 % after 46 s (a trace of gas
still lifts A0 - the log curve).
D0 alarm Good for: setting the blue pot - at which gas level D0 goes LOW
and the board's D0 LED lights. The chamber ramps the gas from a
quarter of the trip level to 4 x and back (10 s each way) at
the pot as set, 25, 50 or 75 %: where D0 went LOW and HIGH (A0,
ADC, ppm), the predicted level, how long D0 took after A0
crossed the pot; a table of the trip level of every gas for
20 - 80 %. PC run (50 %): LOW at 2.502 V = 576 ppm LPG, HIGH at
2.498 V = 573 ppm (predicted 574), within one 10 ms step.
The tools refuse to start, with the reason, when the sensor has no power, the
heater is still warming up (except Warm-up) or another test runs. While a tool
runs the gas scene's buttons wait (the banner says so).
THE DEMO SKETCH ON THE SERIAL MONITOR (MQ2_Gas_Leak_Alarm V2.0)
HELP the command list (2 lines)
STATUS warm-up state, curve, R0, the alarm source; the last ADC,
Rs / R0, D0, the interval, the warm-up wait (2 lines)
READ one reading now
GAS LPG / SMOKE / ALCOHOL / CH4 / H2 the curve of the ppm estimate
CAL R0 = Rs / 9.83 from 10 readings - in CLEAN air only
R0 ohms set R0 (100 - 100000)
LEVEL ppm the alarm when the estimate >= ppm (LEVEL 0 = by D0 again)
EVERY ms the reading interval 100 - 60000 ms (0 = pause)
WAIT s the warm-up wait (0 - 600 s; match the part's WARMUPTIME)
Monitor quick buttons in the demo: U3 STATUS, READ, GAS SMOKE, HELP; U4 STATUS,
GAS LPG, LEVEL 2000, CAL.
Every line the demo prints is shorter than 80 characters (the TEP Serial
Monitor's Simple interface shows about 80).
EXPECTED MONITOR OUTPUT (U3 and U4)
MQ-2 Gas Leak Alarm - The Engineering Projects
V2.0 - type HELP in the Serial Monitor for the commands
Warming up the sensor's heater for 20 s...
Heater warming up... 20 s left ADC: 684
Heater warming up... 19 s left ADC: 616
...
Heater warming up... 1 s left ADC: 95
ADC: 95 LPG: about 4 ppm D0: HIGH Air is clean
Then LPG LEAK (1000 ppm) on U1:
ADC: 576 LPG: about 1009 ppm D0: LOW GAS LEAK! Ventilate!
STATUS:
Status: ready, curve LPG, R0 1000 R, alarm by D0
last ADC 576, Rs/R0 0.78, D0 LOW, every 500 ms, wait 20 s
GAS SMOKE with 1000 ppm smoke:
Curve: SMOKE (ppm = 3178.00 x ratio^-2.257)
ADC: 384 SMOKE: about 1007 ppm D0: HIGH Air is clean
PROPERTIES (double-click the sensor > Edit Properties)
GAS
…Development1 release
-
V2.0Gas Sensor Library for Proteus V2.0this page
V2.0 is the only release in the Download Center so far. When a newer version is published, it appears above with its own download page.
Installation8 steps
From the download to a working project, in order. The steps follow what the package contains.
You will need
- Proteus Design SuiteProteus 8 or newer (Labcenter), on Windows
- Arduino IDE1.8 or 2.x, with the board of the tutorial chosen under Tools → Board
- Any archive toolWindows, macOS and Linux extract ZIP files on their own
Steps
- 1
Extract the archive
Right-click gas-sensor-mq2-tep-v2-0-0b3dafb38c5d4a9c9994e3cad34056ba.zip and choose Extract All (or open it with 7-Zip or WinRAR) into a folder you can find again. Keep its folder structure (MQ2-TEP-v2.0) as it is.
- 2
Copy the library files into Proteus
Move ArduinoV3TEP.LIB, TEPMQ2.LIB and TEPSERIALMON.LIB and ArduinoV3TEP.IDX into the LIBRARY folder of your Proteus installation: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY for Proteus 8, or the matching Proteus 7 folder. Older versions keep it under ProgramData\Labcenter Electronics. If Proteus is open, close it first.
- 3
Add the simulation model
Copy TEPMQ2.DLL and TEPSERIALMON.DLL into the MODELS folder next to LIBRARY, so the component can run, not only be drawn.
- 4
Restart Proteus and place the component
Start Proteus, open a schematic, press P (Pick Devices) and search for the component by the name used in the tutorial. It appears with its pins ready to wire.
- 5
Open the sketch in the Arduino IDE
Open MQ2_Gas_Leak_Alarm.ino, select your board and port under Tools, then Verify. Sketch → Export Compiled Binary writes the HEX file a simulation needs.
- 6
Load the HEX file
In Proteus double-click the microcontroller, set Program File to MQ2_Gas_Leak_Alarm.hex and run the simulation. For real hardware, flash the same file with your programmer.
- 7
Open the example simulation
Open Gas-Sensor-MQ2-ArduinoUnoV3.pdsprj in Proteus to see the wiring exactly as in the tutorial. Check the controller's Program File path, then press Play.
- 8
Follow the tutorial
Gas Sensor Library for Proteus V2.0 (MQ-2 + Arduino) explains every connection and setting in order; keep it open beside the files while you build.
FAQs9 questionsContact TEP
How do I download Gas Sensor Library for Proteus V2.0?
Wait for the 30-second guest countdown on this page, then press the download button; the file comes straight from our storage. Members who are logged in skip the wait. If the browser opens the file instead of saving it, use its Save as option. The download link is made for you when the countdown ends and works for 15 minutes; a saved or shared link stops working, so share this page instead.
What is inside the archive?
Gas Sensor Library for Proteus V2.0 comes as a ZIP archive of 12 files (1.4 MB, 3.0 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, an Arduino sketch and compiled HEX firmware. Open the File Structure tab for the full list of 12 files.
What should I do if the download does not start?
Check the browser's download list first; an ad blocker or a company firewall can also hold it back, so try another browser or network. If the file arrives incomplete, download it again. For an installation problem, read the Install tab or tell us in the comments with your software version and the exact error message.
Is this file free?
Yes. Every file in the TEP Download Center is free for learning, personal and student projects. If you share it, link back to this page or the tutorial so others find the latest version.
How do I check that the file arrived complete?
Compare its SHA-256 with the one on this page, b9e142f14757c79a67a57a9e2d921dba4288d020bdd44a086975d61fb0f409a5. In PowerShell run Get-FileHash "gas-sensor-mq2-tep-v2-0-0b3dafb38c5d4a9c9994e3cad34056ba.zip"; on macOS or Linux run shasum -a 256 "gas-sensor-mq2-tep-v2-0-0b3dafb38c5d4a9c9994e3cad34056ba.zip". The same value means the file is exactly the one in our storage; a different one means the download broke off, so download it again.
Do I need WinRAR to open the ZIP file?
No. Windows, macOS and Linux open ZIP archives on their own (Extract All, or double-click). WinRAR and 7-Zip work too. Extract the whole archive before using the files.
Where do I put the LIB and IDX files?
Both files go into the LIBRARY folder of your Proteus installation (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY; Proteus 7 has the same folder under its own name). Restart Proteus afterwards and search for the component with P.
Which Proteus version does the library need?
The tutorial names the Proteus version the library was made and tested with. Most TEP libraries work in Proteus 7 and Proteus 8; if the component does not appear after a restart, check that both the LIB and the IDX file were copied and that Proteus was fully closed while copying.
How do I get the HEX file into the simulation?
Compile the sketch in the Arduino IDE (Sketch → Export Compiled Binary gives you the HEX next to the sketch), then in Proteus double-click the board, set Program File to that HEX and run.
Members skip the wait. Log in or join TEP.
- 102Total downloads
- 4%Popularity
- ProteusCategory
- 0Comments
- ssyedzainnasirUploaded by
- 8 Oct 2026Uploaded at
b9e142f14757c79a67a57a9e2d921dba4288d020bdd44a086975d61fb0f409a5



















Comments
0