LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsRegister attendance so each person can only be counted once, and report who is present and who is missing. A single boolean per person is the entire data structure, and it answers every question asked of it. Counting the trues gives the number present, counting the falses gives absentees, and the percentage is one division away. Checking that flag before registering is what makes the system idempotent, scanning twice has the same effect as scanning once, which is exactly what you want when a queue of students taps in quickly.
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
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_076_rfid_attendance_analytics.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 STUDENTS 6
MFRC522 rfid(SS_PIN, RST_PIN);
Adafruit_SSD1306 display(128, 64, &Wire, -1);
int viewButton = 12;
int resetButton = 14;
int buzzer = 33;
String studentUID[STUDENTS] =
{
"A1 B2 C3 D4", "11 22 33 44", "AA BB CC DD",
"12 34 56 78", "DE AD BE EF", "CA FE 00 01"
};
String studentName[STUDENTS] =
{
"ANJALI", "RAHUL", "PRIYA", "AMIT", "SNEHA", "VIKAS"
};
bool present[STUDENTS];
unsigned long arrivedAt[STUDENTS];
int view = 0; // 0 summary, 1 present list, 2 absent list
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 findStudent(String uid)
{
for (int i = 0; i < STUDENTS; i++)
{
if (studentUID[i] == uid) return i;
}
return -1;
}
int countPresent()
{
int total = 0;
for (int i = 0; i < STUDENTS; i++) if (present[i]) total = total + 1;
return total;
}
void showView()
{
display.clearDisplay();
display.setTextSize(1);
int here = countPresent();
display.fillRect(0, 0, 128, 11, SSD1306_WHITE);
display.setTextColor(SSD1306_BLACK);
display.setCursor(2, 2);
display.print("ATTENDANCE ");
display.print(here);
display.print("/");
display.print(STUDENTS);
display.setTextColor(SSD1306_WHITE);
if (view == 0)
{
int percent = here * 100 / STUDENTS;
display.setTextSize(3);
display.setCursor(0, 18);
display.print(percent);
display.setTextSize(1);
display.print("%");
display.setCursor(64, 22);
display.print("Present ");
display.print(here);
display.setCursor(64, 32);
display.print("Absent ");
display.print(STUDENTS - here);
display.drawRect(0, 48, 128, 10, SSD1306_WHITE);
display.fillRect(1, 49, map(percent, 0, 100, 0, 126), 8, SSD1306_WHITE);
}
else
{
bool wanted = (view == 1);
display.setCursor(0, 14);
display.print(wanted ? "PRESENT:" : "ABSENT:");
int y = 26;
for (int i = 0; i < STUDENTS && y <= 56; i++)
{
if (present[i] == wanted)
{
display.setCursor(0, y);
display.print(studentName[i]);
if (wanted)
{
display.setCursor(80, y);
display.print(arrivedAt[i]);
display.print("s");
}
y = y + 10;
}
}
if (y == 26)
{
display.setCursor(0, 30);
display.print(wanted ? "Nobody yet" : "Everyone is here");
}
}
display.display();
}
void setup()
{
pinMode(viewButton, INPUT_PULLUP);
pinMode(resetButton, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
for (int i = 0; i < STUDENTS; i++)
{
present[i] = false;
arrivedAt[i] = 0;
}
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) { } }
display.setTextColor(SSD1306_WHITE);
showView();
}
void loop()
{
if (digitalRead(viewButton) == LOW)
{
view = (view + 1) % 3;
showView();
delay(300);
}
if (digitalRead(resetButton) == LOW)
{
for (int i = 0; i < STUDENTS; i++) present[i] = false;
Serial.println("New day - attendance cleared");
tone(buzzer, 600, 300);
showView();
delay(400);
}
if (!rfid.PICC_IsNewCardPresent()) return;
if (!rfid.PICC_ReadCardSerial()) return;
String uid = readUID();
int index = findStudent(uid);
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
if (index < 0)
{
display.print("CARD NOT ON ROLL");
display.setCursor(0, 28);
display.print(uid);
tone(buzzer, 250, 400);
}
else if (present[index])
{
display.print("ALREADY MARKED");
display.setTextSize(2);
display.setCursor(0, 20);
display.print(studentName[index]);
display.setTextSize(1);
display.setCursor(0, 48);
display.print("Arrived at ");
display.print(arrivedAt[index]);
display.print("s");
tone(buzzer, 700, 200);
Serial.print(studentName[index]);
Serial.println(" scanned again - ignored");
}
else
{
present[index] = true;
arrivedAt[index] = millis() / 1000;
display.print("WELCOME");
display.setTextSize(2);
display.setCursor(0, 20);
display.print(studentName[index]);
display.setTextSize(1);
display.setCursor(0, 48);
display.print("Present: ");
display.print(countPresent());
display.print("/");
display.print(STUDENTS);
tone(buzzer, 1500, 150);
Serial.print(studentName[index]);
Serial.println(" marked present");
}
display.display();
delay(1800);
showView();
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.
The sketch uses INPUT_PULLUP, so one leg goes to the GPIO and the other to GND. Use two legs on opposite sides of the button.
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).
A single boolean per person is the entire data structure, and it answers every question asked of it. Counting the trues gives the number present, counting the falses gives absentees, and the percentage is one division away. Checking that flag before registering is what makes the system idempotent, scanning twice has the same effect as scanning once, which is exactly what you want when a queue of students taps in quickly.
A summary screen showing the attendance percentage and a bar. Tap a card: WELCOME with the name and an updated count. Tap the same card again: ALREADY MARKED, and the count does not change.
Yes. It is project 76 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.
9 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 2 × Tactile Push Button Switch, 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 advanced project and takes about 45 minutes. The build on this page has 7 steps.
No. This page has the complete, tested code (titan_kit_076_rfid_attendance_analytics.ino).
About ₹919 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Boolean state toggling for check-ins; Idempotent operations, repeating has no extra effect; Deriving several statistics from one flag array; Multiple views over the same data.
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.