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 Arduino 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.
Power the RC522 from 3.3V only. 5V on its VCC pin destroys it.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 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.
The brain of every Explorer Kit project
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 a card and a key fob (3.3V only)
SG90 servo: turns to the angle the sketch asks for
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
explorer_kit_25_rfid_door_lock.inoVerify & upload in Electrolark#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define SS_PIN 10
#define RST_PIN 9
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(6);
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 the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
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 3.3V, and SDA, SCK, MOSI, MISO and RST must go to D10, D13, D11, D12 and D9. 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 Arduino 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 D4 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 61 in the Geekobot Explorer 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 Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
7 parts: Generic Nano CH340 Development Board (Soldered), 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 Arduino Nano IO Expansion Shield (328P Compatible). 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 1 hour. The build on this page has 6 steps.
No. This page has the complete, tested code (explorer_kit_25_rfid_door_lock.ino).
About ₹686 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 silent alarms: eight ways to decide who and what gets through.
Power the RC522 from 3.3V 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.