LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsModel a library counter: tap a book's tag to check it out, tap it again to return it, and keep a live record of what is on loan. This is a database in miniature. Three parallel arrays act as the columns of a table, UID, title, and whether the item is out on loan, and the row index ties them together. Looking up a tag means searching the UID column for a match and remembering where it was found; everything else about that book is then one array access away. Understanding that a record is a row across several arrays is the step towards understanding real database tables.
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
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED
RC522 RFID reader with cards and a key fob (3.3V board)
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_071_rfid_library_management.inoVerify & upload in Electrolark#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SS_PIN 5
#define RST_PIN 32
#define BOOKS 4
MFRC522 rfid(SS_PIN, RST_PIN);
Adafruit_SSD1306 display(128, 64, &Wire, -1);
int greenLed = 27;
int redLed = 26;
int buzzer = 33;
// The three columns of our table
String bookUID[BOOKS] = {"A1 B2 C3 D4", "11 22 33 44", "AA BB CC DD", "12 34 56 78"};
String bookName[BOOKS] = {"Physics Vol 1", "World Atlas", "Short Stories", "Maths Guide"};
bool onLoan[BOOKS] = {false, false, false, false};
int loansOut = 0;
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;
}
int findBook(String uid)
{
for (int i = 0; i < BOOKS; i++)
{
if (bookUID[i] == uid) return i;
}
return -1;
}
void showIdle()
{
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.print("LIBRARY DESK");
display.setCursor(0, 14);
display.print("Tap a book tag");
display.setCursor(0, 30);
display.print("On loan: ");
display.print(loansOut);
display.print(" of ");
display.print(BOOKS);
int y = 42;
for (int i = 0; i < BOOKS; i++)
{
if (onLoan[i])
{
display.setCursor(0, y);
display.print("OUT: ");
display.print(bookName[i]);
y = y + 10;
if (y > 56) break;
}
}
display.display();
}
void setup()
{
pinMode(greenLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) { } }
display.setTextColor(SSD1306_WHITE);
showIdle();
Serial.println("Library system ready");
}
void loop()
{
if (!rfid.PICC_IsNewCardPresent()) return;
if (!rfid.PICC_ReadCardSerial()) return;
String uid = readUID();
int index = findBook(uid);
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
if (index < 0)
{
display.print("UNKNOWN TAG");
display.setCursor(0, 20);
display.print(uid);
display.setCursor(0, 40);
display.print("Not in catalogue");
digitalWrite(redLed, HIGH);
tone(buzzer, 250, 400);
Serial.print("Unknown tag: ");
Serial.println(uid);
}
else
{
onLoan[index] = !onLoan[index];
loansOut = loansOut + (onLoan[index] ? 1 : -1);
display.print(onLoan[index] ? "CHECKED OUT" : "RETURNED");
display.setTextSize(1);
display.setCursor(0, 22);
display.print(bookName[index]);
display.setCursor(0, 40);
display.print("Now on loan: ");
display.print(loansOut);
digitalWrite(greenLed, HIGH);
tone(buzzer, 1400, 150);
Serial.print(bookName[index]);
Serial.println(onLoan[index] ? " checked out" : " returned");
}
display.display();
delay(2000);
digitalWrite(greenLed, LOW);
digitalWrite(redLed, LOW);
showIdle();
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 it round: the long leg (anode) goes to the GPIO side through the 220 ohm resistor, the short leg to GND.
This project needs the passive buzzer (the one that plays notes), not the active one.
Check SDA on GPIO21 and SCL on GPIO22, power from 3V3, and that the sketch uses address 0x3C (some boards are 0x3D).
This is a database in miniature. Three parallel arrays act as the columns of a table, UID, title, and whether the item is out on loan, and the row index ties them together. Looking up a tag means searching the UID column for a match and remembering where it was found; everything else about that book is then one array access away. Understanding that a record is a row across several arrays is the step towards understanding real database tables.
The idle screen lists how many books are out and which ones. Tap a registered tag: CHECKED OUT with the book title. Tap the same tag again: RETURNED and the count drops.
Yes. It is project 71 of 120 in the Geekobot Titan Kit, in level 12 (RFID systems). 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.
10 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 2 × Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Buzzer Module 3.3–5V, 0.96" OLED Display 128x64, RC522 RFID Reader Writer SPI Module with Card & Tag 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 1 hour. The build on this page has 7 steps.
About ₹944 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Database structure simulation; Parallel arrays as table columns; Searching a column and using the row index; Toggling a record's state on each scan.
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.