S22MQ-2
Gas / Smoke MQ-2
Smells smoke and flammable gas.
Loading 3D
Drag to orbit · scroll to zoom · double-click to reset
Scan the back of the board to open this page.builtbytyler.com/S22
Try it
Puff of lighter gas (unlit!) after warm-up
AO=380 DO=1AO=2200 DO=1AO=3100 DO=0 GAS!AO=700 DO=1
LPG, propane, methane, hydrogen and smoke sensor (300-10000 ppm). Needs 24-48 h burn-in for accurate readings and ~1 min warm-up at each power-on.
/*
BuiltByTyler Sensor Kit - S22 GAS / SMOKE MQ-2 (MQ-2)
Board: ESP32-WROOM-32 DevKit V1 (30-pin), Arduino-ESP32 core 3.x, "ESP32 Dev Module"
Prints the MQ-2 gas/smoke level (AO) and the alarm output (DO).
DO goes LOW when the level passes the threshold set by the blue pot.
Heater runs on 5 V (VIN, so USB power); AO/DO stay under 3.3 V (ESP32-safe).
Needs 24-48 h burn-in for accurate numbers and ~1 min warm-up every time.
Test with a puff of UNLIT lighter gas. This is not a safety alarm.
Wiring (module pin -> ESP32 pin):
GND -> GND
5V -> VIN (5V) - needs USB power
AO -> GPIO 34
DO -> GPIO 4
Library: none needed
Serial Monitor: 115200 baud
*/
#define AO_PIN 34
#define DO_PIN 4
void setup() {
Serial.begin(115200);
pinMode(DO_PIN, INPUT); // DO has a pull-up on the board
Serial.println("MQ-2 heating up: wait ~1 minute before trusting the readings");
}
void loop() {
int ao = analogRead(AO_PIN); // 0..4095, more gas = higher
int mv = analogReadMilliVolts(AO_PIN); // the same reading in millivolts
int dout = digitalRead(DO_PIN); // LOW = above the blue pot's threshold
Serial.printf("AO=%d (%d mV) DO=%d%s\n", ao, mv, dout, dout == LOW ? " ALERT" : "");
delay(500);
}
Not for sale yet. Planned price $79, shipping included. Join the waitlist and we'll email you once when the kit is ready. Nothing else.