LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe Winsen ME2-CO is an electrochemical CO sensor; on its module board it gives a UART output using Winsen's 9-byte active-upload frame and an analog output. The Nano reads ppm, switches a relay on above 35 ppm and off again below 15 ppm, so the fan does not chatter, and keeps it on for at least two minutes.
This is a learning project, not a certified CO alarm. Fit a certified CO alarm wherever you burn fuel, and never run generators or engines in closed rooms.
Mains wiring to the relay must be done by a qualified electrician, in a closed box.
Tick anything you already have and the total updates.
Winsen ME2-CO module with UART
Follow the colours: red is power, dark grey is ground, blue is a signal.
9-12 V adapter into the Nano's VIN.
garage_fan.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void big(const char* top, float value, int dp, const char* unit) {
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(1); oled.setCursor(0, 0); oled.print(top);
oled.setTextSize(3); oled.setCursor(0, 20); oled.print(value, dp);
oled.setTextSize(1); oled.print(" "); oled.print(unit);
oled.display();
}
#include <SoftwareSerial.h>
SoftwareSerial gas(10, 11);
// Winsen active upload frame: FF, gas, unit, decimals, conc H, conc L, range H, range L, checksum
float readPpm() {
static uint8_t f[9];
while (gas.available() >= 9) {
if (gas.read() != 0xFF) continue;
f[0] = 0xFF;
for (int i = 1; i < 9; i++) f[i] = gas.read();
uint8_t sum = 0;
for (int i = 1; i < 8; i++) sum += f[i];
if ((uint8_t)(~sum + 1) != f[8]) return -1;
return (f[4] * 256 + f[5]) * 0.1; // ZE07/ME2 CO modules report 0.1 ppm steps
}
return -1;
}
const float ON_PPM = 35, OFF_PPM = 15;
const unsigned long MIN_RUN = 120000;
bool fan = false;
unsigned long since = 0;
void setup() { gas.begin(9600); pinMode(7, OUTPUT); oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); }
void loop() {
float ppm = readPpm();
if (ppm < 0) return;
if (!fan && ppm > ON_PPM) { fan = true; since = millis(); }
if (fan && ppm < OFF_PPM && millis() - since > MIN_RUN) fan = false;
digitalWrite(7, fan);
big(fan ? "CO - fan ON" : "CO - fan off", ppm, 1, "ppm");
delay(500);
}
Increase the gap between ON_PPM and OFF_PPM or MIN_RUN.
Check TXD and the module's baud rate in its datasheet.
Check the fan wiring through COM and NO with the supply off.
Yes, switch the 12 V fan through the relay; no mains needed.
Starting a motor often wears it; two minutes also clears the air properly.
Yes, for a simple threshold; UART gives calibrated ppm.
7 parts: Winsen ME2-CO Carbon Monoxide Gas Detection Sensor Module – UART & Analog Output, Generic Nano CH340 Development Board (Soldered), 5V Relay Module with Optocoupler, 0.96" OLED Display 128x64, DC Power Adapter (5.5x2.1mm), Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (garage_fan.ino).
About ₹1,153 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
On/off control with hysteresis; Minimum run times for motors; Electrochemical CO modules.
This is a learning project, not a certified CO alarm. Fit a certified CO alarm wherever you burn fuel, and never run generators or engines in closed rooms. Mains wiring to the relay must be done by a qualified electrician, in a closed box.
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
See the smoke level live on a crisp screen and get a loud warning when it spikes.
An infrared eye that spots an open flame and raises the alarm.
Walk into the room and it sounds the alarm: the classic first security build.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.