LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsScan an RFID card and let a servo motor open the lock only for cards whose UID you have authorised. The reader talks to the ESP32 over SPI, a four-wire bus that shares MOSI, MISO and SCK between devices and uses a separate SS pin to pick which one is listening. Every card carries a factory-programmed UID, a unique serial number. The sketch turns that UID into text and compares it with an allowed value; matching UIDs is the whole of the security here. Run the sketch once, scan your card, read the printed UID from the Serial Monitor, then paste it into allowedUID and upload again.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Power the RC522 from 3V3 only. 5V on its VCC pin destroys it.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
16x2 LCD with I2C backpack: four wires, two lines of text
RC522 RFID reader with cards and a key fob (3.3V board)
SG90 servo: turns to the angle the sketch asks for
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_025_rfid_door_lock.inoVerify & upload in Electrolark#include <SPI.h>
#include <MFRC522.h>
#include <ESP32Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define SS_PIN 5
#define RST_PIN 32
MFRC522 rfid(SS_PIN, RST_PIN);
Servo lock;
LiquidCrystal_I2C lcd(0x27, 16, 2);
String allowedUID = "A1 B2 C3 D4"; // Replace with your own card
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
lock.attach(26);
lock.write(0); // Locked position
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Scan your card");
}
void loop()
{
if (!rfid.PICC_IsNewCardPresent())
{
return;
}
if (!rfid.PICC_ReadCardSerial())
{
return;
}
String uid = "";
for (byte i = 0; i < rfid.uid.size; i++)
{
if (rfid.uid.uidByte[i] < 0x10)
{
uid = uid + "0";
}
uid = uid + String(rfid.uid.uidByte[i], HEX);
if (i < rfid.uid.size - 1)
{
uid = uid + " ";
}
}
uid.toUpperCase();
Serial.print("Card UID: ");
Serial.println(uid);
lcd.clear();
if (uid == allowedUID)
{
lcd.setCursor(0, 0);
lcd.print("ACCESS GRANTED");
lock.write(90); // Unlocked
delay(3000);
lock.write(0); // Locked again
}
else
{
lcd.setCursor(0, 0);
lcd.print("ACCESS DENIED");
delay(2000);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Scan your card");
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Turn the small contrast pot on the back of the I2C board. If still blank, change 0x27 in the sketch to 0x3F.
The RC522 must run from 3V3, and SDA, SCK, MOSI, MISO and RST must go to the GPIOs in the table. Hold the card flat on the reader.
A servo can pull more current than USB gives when it starts. Keep the servo wires short and avoid moving it under load.
The reader talks to the ESP32 over SPI, a four-wire bus that shares MOSI, MISO and SCK between devices and uses a separate SS pin to pick which one is listening. Every card carries a factory-programmed UID, a unique serial number. The sketch turns that UID into text and compares it with an allowed value; matching UIDs is the whole of the security here. Run the sketch once, scan your card, read the printed UID from the Serial Monitor, then paste it into allowedUID and upload again.
LCD shows Scan your card. Serial Monitor prints Card UID: A1 B2 C3 the second button whenever a card is tapped. Authorised card: ACCESS GRANTED and the servo turns to 90°, returning after 3 seconds.
Yes. It is project 25 of 120 in the Geekobot Titan Kit, in level 6 (Security and access). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
7 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Dupont Jumper Wires (40 pcs), LCD1602 16x2 Character LCD Display, RC522 RFID Reader Writer SPI Module with Card & Tag, TowerPro SG90 9g Micro Servo (180°) and ESP32 38-Pin Expansion Board. 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 45 minutes. The build on this page has 6 steps.
No. This page has the complete, tested code (titan_kit_025_rfid_door_lock.ino).
About ₹935 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
SPI communication and shared buses; UID matching as a form of authentication; Driving a servo to a fixed angle; Building a system from three modules at once.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin. Power the RC522 from 3V3 only. 5V on its VCC pin destroys it.
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.