Components · 10 min read

MQ Gas Sensors Comparison: MQ-2 to MQ-135, Which One to Use

MQ gas sensors comparison: which gas the MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9 and MQ-135 detect, ppm table, RL, preheating and Arduino code.

MQ gas sensors are a cheap, widely used family of sensors for detecting gas leaks, smoke, alcohol or carbon monoxide with an Arduino. From the outside they almost all look the same: a cylinder under a metal mesh cap, a blue module board and four pins. But the MQ-2 responds to smoke and LPG, the MQ-3 to alcohol, the MQ-4 to natural gas, the MQ-7 to carbon monoxide, and the MQ-135 to ammonia and solvent vapours in the air. Pick the wrong one and you may miss the very gas you're looking for, or get false alarms all the time.

In this comparison we put the MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9 and MQ-135 side by side in one table: you'll see which gas each detects, its measuring range, its clean-air Rs/R0 ratio and how its heater is driven. Then we'll cover the wiring, preheating, load resistor and ppm maths that all of them share, and build an Arduino and ESP32 code template that works with all nine sensors by changing a single line. Finally, we've gathered which sensor to choose for which project in one table.

MQ series gas sensor module with a metal mesh cap and four pins
MQ gas sensor module: under the metal mesh is the heated sensing tube; on the back, a comparator and four pins (VCC, GND, DO, AO).

How do MQ gas sensors work?

Inside every MQ sensor is a small ceramic tube coated with tin dioxide (SnO2) and a heater wire that brings it to about 200-300 °C. In clean air, oxygen sticks to the surface and the material's resistance is high. When a combustible or reducing gas is present, it reacts with that oxygen and the freed electrons lower the resistance. In other words, the more gas there is, the lower the sensor's resistance (Rs) and the higher the voltage on the module's analog output. What sets the sensors apart are the additives in the sensing material and the operating temperature, which make each one more sensitive to a particular gas. None of them is fully selective, though: the MQ-2 also reacts to alcohol vapour, and the MQ-7 to hydrogen.

Which gas does each MQ sensor detect? Gas, sensor and ppm table

The table below sums up the target gases and measuring ranges from the nine sensors' datasheets. The "clean-air Rs/R0" column is the ratio you'll use for calibration: measure the sensor in clean air, divide the resistance you get by this number, and you have the reference resistance R0. The heating column shows the most important difference: the MQ-7 and MQ-9 are the sensors whose heater must cycle between a high and a low voltage to measure CO properly.

SensorGases detectedMeasuring rangeClean-air Rs/R0Heating
MQ-2LPG, propane, butane, methane, hydrogen, alcohol, smoke300-10,000 ppm9.83Constant 5 V
MQ-3Alcohol (ethanol), a little petrol vapour0.04-4 mg/L alcohol60Constant 5 V
MQ-4Methane (natural gas)200-10,000 ppm4.4Constant 5 V
MQ-5LPG, natural gas, town gas200-10,000 ppm6.5Constant 5 V
MQ-6LPG, isobutane, propane200-10,000 ppm10Constant 5 V
MQ-7Carbon monoxide (CO)20-2000 ppm27.5Cycled: 60 s at 5 V, 90 s at 1.4 V
MQ-8Hydrogen (H2)100-10,000 ppm70Constant 5 V
MQ-9CO, methane and LPGCO 10-1000 ppm, combustible gas 100-10,000 ppm9.6Cycled: 60 s at 5 V, 90 s at 1.5 V
MQ-135Ammonia, benzene, alcohol, smoke, NOx (CO2 indirectly)NH3 10-300 ppm, benzene 10-1000 ppm3.6Constant 5 V
The family also has some lesser-known members: the MQ-131 for ozone, the MQ-136 for hydrogen sulphide, the MQ-137 for ammonia and the MQ-138 for volatile organic compounds (VOCs). They're wired and coded exactly like the template in this guide; only the curve coefficients change.

Look-alikes: MQ-2 vs MQ-5 vs MQ-6, and MQ-7 vs MQ-9

The most confused group is the LPG sensors. The MQ-6 is the most sensitive to the propane and butane in bottled gas, so it's the first choice for a kitchen with a gas cylinder. The MQ-5 sees both LPG and natural gas well and is a balanced pick where either could be present. The MQ-2 is the all-rounder: besides LPG, methane and hydrogen it also detects smoke, which makes it ideal for early fire warnings and learning projects, although it isn't as good as the others at measuring one specific gas. Mains natural gas is almost entirely methane, and the sensor most selective to methane is the MQ-4. The MQ-7 is for carbon monoxide only; the MQ-9 uses the same cycled heating but measures CO as well as combustible gases such as methane and LPG, so a single sensor can watch both risks near a stove, boiler or water heater.

Common wiring: MQ module pins

Front of an MQ-135 module and its back with the LM393 comparator
On the back of the module are the LM393 comparator, the blue trimmer that sets the DO threshold, the power and DO LEDs, and the load resistor (RL).
Module pinArduino UnoESP32Raspberry Pi Pico
VCC (includes the heater)5VVIN (5 V from USB)VBUS (5 V from USB)
GNDGNDGNDGND
AO (analog output)A0GPIO 34, through a 10 kΩ / 20 kΩ dividerGP26 (ADC0), through a 10 kΩ / 20 kΩ divider
DO (digital threshold, optional)D2Any GPIO through a dividerAny GP pin through a divider
Every MQ sensor's heater draws about 150 mA at 5 V and must have 5 V; at 3.3 V the sensor doesn't get hot enough. On the ESP32 and Pico, when the module runs on 5 V, the AO output can reach 5 V and damage the 3.3 V ADC input: put a 10 kΩ + 20 kΩ voltage divider between AO and GND and connect the midpoint to the ADC pin (5 V × 20 / 30 = 3.33 V). Connect three MQ sensors to one board and the heaters alone draw 450 mA, right at USB's 500 mA limit, so use an external 5 V 2 A supply.

Besides the sensor, the module board carries three important parts. The load resistor (RL) sits in series with the sensor to form a voltage divider; on most modules it's 1 kΩ and marked 102, while some have 10 kΩ (103). Using the right RL value in your code is essential for the ppm calculation; to decode the SMD marking, see SMD resistor codes or the SMD code calculator. The LM393 comparator compares the analog voltage with the threshold set on the trimmer and drives the DO pin; on most modules DO goes LOW and a small LED lights when the threshold is crossed. DO is enough for a simple alarm, but to see how much gas there is and calculate ppm you need to read AO.

Preheating: the first 24-48 hours and a few minutes at every power-up

MQ sensors have two separate warm-ups. The first is the initial burn-in: moisture and contamination build up on the surface of a new sensor or one that has sat in storage. Manufacturers recommend powering it continuously for more than 24 hours before first use on constant-heater models such as the MQ-2 and MQ-135, and for more than 48 hours on the MQ-7 and MQ-9. If you calibrate before that time is up, your calibration will drift within days. The second is the daily warm-up: even a burned-in sensor gives meaningless readings for a few minutes after every power-up until the heater settles. That's why our template waits 3 minutes before measuring; 10-20 minutes is better for precise readings. The mesh of a running sensor gets too hot to touch, and that's normal.

RL, Rs and R0: calculating ppm with an MQ sensor

The sensor resistance Rs is in series with the board's RL and they share the 5 V; the AO voltage is Vout = 5 × RL / (Rs + RL). Rearranged, it gives you the sensor's resistance from the measured voltage: Rs = RL × (5 - Vout) / Vout. To try other resistor values and voltages, use the voltage divider calculator. Rs on its own tells you little, because resistance varies widely from one sensor to the next; what matters is its ratio to the reference resistance R0. The datasheet curves are almost straight lines on log-log axes, so they can be written as a power function: ppm = a × (Rs/R0)^b. The coefficients below are the approximate values the popular MQUnifiedsensor library derived from the datasheet curves.

SensorGas calculatedabUnit
MQ-2LPG574.25-2.222ppm
MQ-3Alcohol0.3934-1.504mg/L
MQ-4Methane (CH4)1012.7-2.786ppm
MQ-5LPG80.897-2.431ppm
MQ-6LPG1009.2-2.35ppm
MQ-7CO99.042-1.518ppm
MQ-8Hydrogen (H2)976.97-0.688ppm
MQ-9CO599.65-2.244ppm
MQ-135CO2 (estimated)110.47-2.862ppm

The ppm you get from this formula is an estimate. The curves were drawn at 20 °C and 65% relative humidity; as temperature and humidity change the Rs/R0 ratio shifts too, R0 changes as the sensor ages, and other gases in the room affect the result. A realistic expectation is that the number can be 30-50 percent off but tracks rises and falls very well. That's why MQ sensors are best used to answer "has the gas gone up, and how fast?" rather than for absolute measurements.

One code template for Arduino and ESP32

The code below works with all nine sensors: just change the MQ_MODEL line at the top to your sensor's number. The code adapts itself to the board: on the Arduino Uno it reads A0 against the 5 V reference, while on the ESP32 it reads GPIO 34 with the calibrated analogReadMilliVolts() and multiplies by the divider ratio. At power-up it waits 3 minutes to warm up, calculates R0 from the average of 50 clean-air readings, then prints the Rs/R0 ratio and the estimated concentration to the Serial Monitor every second; if the threshold is crossed, the buzzer sounds.

C++ (Arduino IDE)
1// MQ gaz sensörleri için ortak şablon (Arduino Uno ve ESP32)
2// Common template for MQ gas sensors (Arduino Uno and ESP32)
3
4#define MQ_MODEL 2               // 2, 3, 4, 5, 6, 7, 8, 9 ya da 135 / or 135
5
6// ppm = a * (Rs/R0)^b ; cleanAir = temiz havada Rs/R0 / Rs/R0 in clean air
7struct MqProfile { const char* name; const char* gas; float cleanAir; float a; float b; float alarm; };
8
9#if MQ_MODEL == 2
10const MqProfile MQ = {"MQ-2", "LPG ppm", 9.83, 574.25, -2.222, 1000};
11#elif MQ_MODEL == 3
12const MqProfile MQ = {"MQ-3", "alkol / alcohol mg/L", 60.0, 0.3934, -1.504, 0.4};
13#elif MQ_MODEL == 4
14const MqProfile MQ = {"MQ-4", "CH4 ppm", 4.4, 1012.7, -2.786, 1000};
15#elif MQ_MODEL == 5
16const MqProfile MQ = {"MQ-5", "LPG ppm", 6.5, 80.897, -2.431, 1000};
17#elif MQ_MODEL == 6
18const MqProfile MQ = {"MQ-6", "LPG ppm", 10.0, 1009.2, -2.35, 1000};
19#elif MQ_MODEL == 7
20const MqProfile MQ = {"MQ-7", "CO ppm", 27.5, 99.042, -1.518, 50};
21#elif MQ_MODEL == 8
22const MqProfile MQ = {"MQ-8", "H2 ppm", 70.0, 976.97, -0.688, 1000};
23#elif MQ_MODEL == 9
24const MqProfile MQ = {"MQ-9", "CO ppm", 9.6, 599.65, -2.244, 50};
25#else
26const MqProfile MQ = {"MQ-135", "CO2 ppm", 3.6, 110.47, -2.862, 1000};
27#endif
28
29#if defined(ESP32)
30const int AO_PIN = 34;           // ADC1 pini, AO 10k/20k bölücüden / ADC1 pin, AO through a 10k/20k divider
31const float DIVIDER = 1.5;       // (10k + 20k) / 20k
32const int BUZZER_PIN = 25;
33#else
34const int AO_PIN = A0;
35const float DIVIDER = 1.0;       // Uno 5 V okur, bölücü yok / Uno reads 5 V, no divider
36const int BUZZER_PIN = 8;
37#endif
38
39const float VC = 5.0;            // sensör beslemesi (V) / sensor supply (V)
40const float RL_KOHM = 1.0;       // karttaki RL: 102 = 1 kΩ, 103 = 10 kΩ / RL on the board
41const float R0_FIXED = 0;        // 0 = açılışta kalibre et / 0 = calibrate at start-up
42const unsigned long WARMUP_MS = 180000UL;   // 3 dk ısınma / 3 min warm-up
43
44float r0 = 1;
45
46float readVout() {               // 20 ölçümün ortalaması (V) / average of 20 readings (V)
47  float sum = 0;
48  for (int i = 0; i < 20; i++) {
49#if defined(ESP32)
50    sum += analogReadMilliVolts(AO_PIN) / 1000.0;
51#else
52    sum += analogRead(AO_PIN) * 5.0 / 1023.0;
53#endif
54    delay(5);
55  }
56  return sum / 20.0 * DIVIDER;
57}
58
59float readRs() {                 // Rs = RL * (Vc - Vout) / Vout
60  float v = readVout();
61  if (v < 0.05) v = 0.05;        // sıfıra bölmeyi önle / avoid dividing by zero
62  return RL_KOHM * (VC - v) / v;
63}
64
65void setup() {
66  Serial.begin(115200);
67  pinMode(BUZZER_PIN, OUTPUT);
68  Serial.print(MQ.name);
69  Serial.println(F(": isiniyor / warming up (3 min)"));
70  delay(WARMUP_MS);
71
72  if (R0_FIXED > 0) {
73    r0 = R0_FIXED;
74  } else {                       // temiz havada R0 bul / find R0 in clean air
75    float sum = 0;
76    for (int i = 0; i < 50; i++) {
77      sum += readRs();
78      delay(100);
79    }
80    r0 = sum / 50.0 / MQ.cleanAir;
81  }
82  Serial.print(F("R0 = "));
83  Serial.print(r0, 2);
84  Serial.println(F(" kOhm"));
85}
86
87void loop() {
88  float ratio = readRs() / r0;               // gaz artınca küçülür / falls as gas rises
89  float value = MQ.a * pow(ratio, MQ.b);     // tahmini yoğunluk / estimated concentration
90
91  Serial.print(F("Rs/R0 = "));
92  Serial.print(ratio, 2);
93  Serial.print(F("   ~"));
94  Serial.print(value, 2);
95  Serial.print(' ');
96  Serial.println(MQ.gas);
97
98  if (value > MQ.alarm) tone(BUZZER_PIN, 2000, 300);   // eşik aşıldı / threshold exceeded
99  delay(1000);
100}
SettingWhat it does
MQ_MODELSelects the sensor; its profile (clean-air ratio, a, b and alarm threshold) loads automatically.
RL_KOHMThe load resistor on the board; write 1.0 if it's marked 102, 10.0 if it's marked 103.
R0_FIXEDLeave it at 0 to calibrate in clean air at every start-up; write your R0 here to skip calibration.
DIVIDEROn the ESP32, the ratio of the 10k/20k divider in front of AO (1.5); 1 on the Uno.
MQ.alarmThe buzzer threshold; 50 ppm CO for the MQ-7 and MQ-9, 1000 ppm for combustible gases.

To calibrate, put the sensor by an open window or outdoors in clean air and let it run for at least 10 minutes; note the R0 value printed in the Serial Monitor. Then write that value into the R0_FIXED line and upload the code again. That way, even if the device powers up in a room with gas in it, it won't calibrate itself wrongly. The MQ-7 and MQ-9 profiles only give a rough value, because the module keeps the heater at 5 V all the time; for proper CO measurement the heater has to be cycled with a MOSFET, as explained in the MQ-7 carbon monoxide sensor guide.

MQ sensor with a Raspberry Pi Pico (MicroPython)

On the Pico the same logic takes just a few lines. Power the module from VBUS (USB 5 V) and connect AO to GP26 through the 10 kΩ / 20 kΩ divider. Because read_u16() returns 0-65535, we multiply by 3.3 / 65535 and then by the divider ratio to get the voltage. Add coefficients from the table to the PROFILES dictionary to define any sensor you like; the active buzzer on GP15 sounds when the threshold is crossed.

MicroPython
1from machine import ADC, Pin
2import time
3
4# Profil: (temiz hava Rs/R0, a, b, alarm) / profile: (clean-air Rs/R0, a, b, alarm)
5PROFILES = {
6    "MQ-2": (9.83, 574.25, -2.222, 1000),     # LPG ppm
7    "MQ-4": (4.4, 1012.7, -2.786, 1000),      # CH4 ppm
8    "MQ-135": (3.6, 110.47, -2.862, 1000),    # CO2 ppm (tahmini / estimated)
9}
10MODEL = "MQ-2"
11CLEAN, A, B, ALARM = PROFILES[MODEL]
12
13adc = ADC(26)                 # GP26 = ADC0, AO 10k/20k bölücüden / AO through a 10k/20k divider
14buzzer = Pin(15, Pin.OUT)     # aktif buzzer / active buzzer
15DIVIDER = 1.5                 # (10k + 20k) / 20k
16VC = 5.0                      # VBUS gerilimi / VBUS voltage
17RL = 1.0                      # kΩ, karttaki yük direnci / load resistor on the board
18
19def read_rs():
20    total = 0
21    for _ in range(20):
22        total += adc.read_u16()
23        time.sleep_ms(5)
24    v = total / 20 / 65535 * 3.3 * DIVIDER    # sensör çıkışı (V) / sensor output (V)
25    v = max(v, 0.05)                          # sıfıra bölmeyi önle / avoid dividing by zero
26    return RL * (VC - v) / v
27
28print(MODEL, "isiniyor / warming up (3 min)")
29time.sleep(180)
30r0 = sum(read_rs() for _ in range(50)) / 50 / CLEAN    # temiz havada R0 / R0 in clean air
31print("R0 = %.2f kOhm" % r0)
32
33while True:
34    ratio = read_rs() / r0                    # gaz artınca küçülür / falls as gas rises
35    ppm = A * ratio ** B
36    print("Rs/R0 = %.2f   ~%d ppm" % (ratio, ppm))
37    buzzer.value(1 if ppm > ALARM else 0)
38    time.sleep(1)

Which MQ sensor for which project?

ProjectRecommended sensorWhy?
Bottled gas (LPG) leak alarmMQ-6, alternatively MQ-2The MQ-6 is the most sensitive to propane and butane; the MQ-2 also sees smoke
Natural gas leak alarmMQ-4, alternatively MQ-5Mains gas is mostly methane, and the MQ-4 is selective to methane
Early smoke and fire warningMQ-2 plus a flame sensorThe MQ-2 detects smoke, the flame sensor sees the fire's infrared light
Educational breathalyserMQ-3High sensitivity to ethanol and a high clean-air Rs/R0
CO monitoring near stoves and water heatersMQ-7Cycled heating gives the most accurate CO result
Near a boiler or stove (CO and combustible gas)MQ-9Watches both risks with one sensor
Battery room, hydrogen experimentsMQ-8The most hydrogen-selective MQ sensor
Room air quality and ventilationMQ-135Tracks ammonia, solvents and smoke; real CO2 needs an NDIR sensor
Ammonia in barns and compostMQ-135 or MQ-137Sensitive to ammonia
MQ sensors are learning and hobby sensors, not certified gas detectors. Never use them as the only protection against natural gas, LPG or carbon monoxide in your home; for that, use commercial detectors tested to standards such as EN 50194 (combustible gas) and EN 50291 (CO), or UL 1484 and UL 2034 in the US, and treat your own circuit as an extra indicator. Commercial natural gas alarms typically sound at around 10-20% of the lower explosive limit (5% for methane, or 50,000 ppm).

Project ideas with MQ sensors

  • Automatic gas shut-off: when a leak is detected, close a solenoid valve with a relay module and switch on the extractor fan.
  • Phone alerts: with an ESP32, send an instant message through a Telegram bot when the threshold is crossed.
  • Fire alarm: combine the MQ-2 with a flame sensor and a buzzer to watch for smoke and fire together.
  • Kitchen ventilation: use the MQ-135 to switch on the fan automatically when the air gets heavy while you cook; details in the MQ-135 guide.
  • Electronic nose: read the MQ-2, MQ-3 and MQ-135 together and record the pattern of values each smell produces; try telling coffee, alcohol and cigarette smoke apart.
  • Air quality log: with an ESP32, send readings to a Google Sheets spreadsheet every minute and chart the whole day.

Common mistakes and how to fix them

SymptomLikely causeFix
Readings drift for hoursThe initial burn-in isn't finishedRun the sensor for 24-48 hours non-stop, then calibrate
It alarms right after power-upThe daily warm-up wasn't respectedWait at least 3 minutes in the code and enable the alarm after warm-up
On the ESP32 the value is always maxed outAO reaches 5 V, or the module runs on 3.3 VPower the module from 5 V and add a 10k/20k divider on AO
ppm is very high even in clean airR0 was found indoors or near gas, or RL is wrongRepeat the calibration in clean outdoor air and check the board's RL
DO never changes or is always activeThe threshold trimmer is at one endIn clean air, turn it until the DO LED goes out, then back it off a little
Perfume or hand sanitiser sets off the alarmMQ sensors aren't selectiveThat's normal; raise the threshold or compare the pattern of several sensors
The Arduino gets hot or USB drops outSeveral heaters overload the USB supplyUse an external 5 V supply and tie the grounds together
MQ readings are noisy; rather than raising an alarm on a single reading, use the average of several consecutive readings or an exponential moving average. We explain the methods in sensor data filtering. Running two different MQ sensors side by side and comparing how they react to the same smell is the fastest way to see which one suits your project.

Choosing the right MQ sensor is half of a gas alarm project; the rest is proper power, a patient burn-in and a calibration done in clean air. If you'd like to try it step by step, the BlueGrays app has gas sensor basics, a flame and gas sensor alarm, an ESP32 MQ-2 gas and smoke detector and an ESP32 alarm with Telegram alerts, each with a circuit diagram and code.

Frequently asked questions

Which gas does each MQ sensor detect?

The MQ-2 detects LPG, methane, hydrogen and smoke; the MQ-3 alcohol; the MQ-4 methane (natural gas); the MQ-5 LPG and natural gas; the MQ-6 LPG and propane; the MQ-7 carbon monoxide; the MQ-8 hydrogen; the MQ-9 CO and combustible gases; and the MQ-135 ammonia, benzene, alcohol and smoke. None of them is fully selective to a single gas.

Which MQ sensor is best for a natural gas leak?

Mains natural gas is mostly methane, so the MQ-4, the most methane-selective sensor, is the best choice; the MQ-5 also detects natural gas well. If you use bottled gas (LPG), choose the MQ-6 or the MQ-2.

What is the difference between the MQ-2 and the MQ-135?

The MQ-2 is designed for combustible gases (LPG, methane, hydrogen) and smoke, and is used in gas leak and fire alarms. The MQ-135 responds to air pollutants such as ammonia, benzene, alcohol and smoke, and is used to monitor indoor air quality.

How long should you preheat an MQ sensor?

A new sensor should run non-stop for 24-48 hours before first use; more than 48 hours is recommended for the MQ-7 and MQ-9. A burned-in sensor needs at least 2-3 minutes after every power-up before measuring, and 10-20 minutes for precise readings.

Does an MQ sensor work at 3.3 V?

No, the heater needs 5 V and about 150 mA; at 3.3 V the sensor doesn't get hot enough and the readings are meaningless. On the ESP32 and Pico, power the module from 5 V and bring the AO output below 3.3 V with a voltage divider before it reaches the ADC.

Can an MQ sensor measure ppm?

It can estimate ppm from the Rs/R0 ratio and the datasheet curve, but temperature, humidity, ageing and other gases can push the result 30-50% off. MQ sensors are great for tracking changes and raising alarms; precise measurement needs calibrated electrochemical or NDIR sensors.

See all projects
Using a Buzzer
AR-13Beginner

Using a Buzzer

Ever wondered how a doorbell or an alarm makes its sound? The Arduino makes a small buzzer beep at short intervals: beep, pause, beep, pause.

4.7(92)
171
Temperature and Humidity with DHT11
AR-55Intermediate

Temperature and Humidity with DHT11

How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

4.7(47)
83
Using a Gas Sensor
AR-51Beginner
Premium

Using a Gas Sensor

A little guard that notices a gas leak in the kitchen before you do. The gas sensor keeps sniffing the air; while everything is fine the green LED stays on, and when the gas in the air passes a…

4.6(37)
50
Flame and Gas Sensor Alarm
AR-52Advanced
Premium

Flame and Gas Sensor Alarm

A little guard that warns you right away when gas leaks or a flame appears somewhere.

4.8(52)
67
ESP32 MQ-2 Gas/Smoke Detector Alarm
ES-20Intermediate

ESP32 MQ-2 Gas/Smoke Detector Alarm

In this project, combustible gas (LPG, methane, propane) and smoke detection is performed using an MQ-2 gas sensor module, and a siren-like alarm is played through a passive buzzer upon detection. The sensor's digital threshold output (DO) is connected to GPIO 4 on the ESP32; when gas or smoke exceeds the threshold, DO goes LOW and the alarm is triggered. Sensitivity is adjusted via the module's potentiometer. The passive buzzer is driven using tone() to produce a two-frequency siren effect.

4.7(29)
44
Using a Flame Sensor
AR-50Intermediate
Premium

Using a Flame Sensor

A little guard that spots fire before you do, in the kitchen or the workshop. The flame sensor picks up the invisible light that fire gives off; while all is well the green LED is on, and when it…

4.6(33)
44
ESP32 DHT22 Temperature and Humidity (with LCD Display)
ES-15Intermediate

ESP32 DHT22 Temperature and Humidity (with LCD Display)

This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

4.8(38)
57
ESP32 Motion Alarm System (PIR + Buzzer + LED + Telegram)
ES-41Advanced
Premium

ESP32 Motion Alarm System (PIR + Buzzer + LED + Telegram)

A smart security alarm: when the PIR sensor detects motion, it sounds the buzzer, lights the LED and sends the owner an instant Telegram notification. A 30-second cooldown limits how often the alarm repeats; it does not filter out the PIR sensor's false detections. Use it at home, in a garage, a storeroom or a study.

9