LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsCombine everything from the door lock into a locker that accepts several registered cards and reports each attempt on the LCD. The single allowed UID from Experiment 25 becomes an array, and a for loop walks it looking for a match. Adding a fourth locker user is now a one-line change rather than a rewrite. The array of names alongside the array of UIDs is a common pattern called parallel arrays: index 0 in one lines up with index 0 in the other.
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
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED segment
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_32_smart_locker.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
#define USERS 3
MFRC522 rfid(SS_PIN, RST_PIN);
Servo locker;
LiquidCrystal_I2C lcd(0x27, 16, 2);
int greenLed = 5;
int redLed = 4;
int buzzer = 3;
String allowedUID[USERS] = {"A1 B2 C3 D4", "11 22 33 44", "DE AD BE EF"};
String userName[USERS] = {"ANJALI", "RAHUL", "PRIYA"};
String readUID()
{
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();
return uid;
}
void ready()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Locker locked");
lcd.setCursor(0, 1);
lcd.print("Tap your card");
}
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
pinMode(greenLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(buzzer, OUTPUT);
locker.attach(6);
locker.write(0);
lcd.init();
lcd.backlight();
ready();
}
void loop()
{
if (!rfid.PICC_IsNewCardPresent())
{
return;
}
if (!rfid.PICC_ReadCardSerial())
{
return;
}
String uid = readUID();
Serial.print("Card UID: ");
Serial.println(uid);
int found = -1;
for (int i = 0; i < USERS; i++)
{
if (uid == allowedUID[i])
{
found = i;
}
}
lcd.clear();
if (found >= 0)
{
lcd.setCursor(0, 0);
lcd.print("Welcome");
lcd.setCursor(0, 1);
lcd.print(userName[found]);
digitalWrite(greenLed, HIGH);
digitalWrite(buzzer, HIGH);
delay(120);
digitalWrite(buzzer, LOW);
locker.write(90);
delay(4000);
locker.write(0);
digitalWrite(greenLed, LOW);
}
else
{
lcd.setCursor(0, 0);
lcd.print("CARD NOT FOUND");
digitalWrite(redLed, HIGH);
for (int i = 0; i < 2; i++)
{
digitalWrite(buzzer, HIGH);
delay(150);
digitalWrite(buzzer, LOW);
delay(150);
}
delay(1500);
digitalWrite(redLed, LOW);
}
ready();
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 it round: the long leg (anode) goes to the pin side through the 220 ohm resistor, the short leg to GND.
The active buzzer has a + leg: it goes to the pin, the other to GND. Peel off the sticker on top if it has one.
Turn the small contrast pot on the back of the I2C board. If still blank, change 0x27 in the sketch to 0x3F.
The single allowed UID from Experiment 25 becomes an array, and a for loop walks it looking for a match. Adding a fourth locker user is now a one-line change rather than a rewrite. The array of names alongside the array of UIDs is a common pattern called parallel arrays: index 0 in one lines up with index 0 in the other.
LCD shows Locker locked / Tap your card. A registered card: Welcome ANJALI, green LED, locker opens for 4 seconds. An unknown card: CARD NOT FOUND, red LED and two beeps.
Yes. It is project 32 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.
10 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), PCB Mounted Active Buzzer Module, 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 30 minutes. The build on this page has 8 steps.
No. This page has the complete, tested code (explorer_kit_32_smart_locker.ino).
About ₹748 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
RFID, LCD and servo working together; Parallel arrays for UIDs and names; Searching an array with a loop; Building a system with three feedback channels.
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.