LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsStudents or staff each get an RFID card. Tap it on the reader and a beep confirms it; the Uno writes the date, time and card number as one row in ATTEND.CSV on the SD card. Open the file in a spreadsheet at the end of the month and match the card numbers to names. The clock module keeps the time through power cuts.
Tick anything you already have and the total updates.
Connects the Uno to your computer to upload code and power it
13.56 MHz RFID/NFC reader that reads the unique ID of cards and key fobs held near it.
Temperature-compensated real-time clock (±2 minutes a year) with a coin-cell backup, so the time survives power cuts.
Stores readings on a microSD card as a CSV file you can open in Excel or Google Sheets.
Active buzzer with a built-in oscillator: apply power and it beeps at about 2.3 kHz.
Follow the colours: red is power, dark grey is ground, blue is a signal.
rfid_attendance_logger.inoVerify & upload in Electrolark// RFID card attendance logger
// Geekobot project library · board: Arduino Uno
// Wiring diagram, parts list and build steps: Geekobot project page "rfid-attendance-logger"
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <RTClib.h>
#include <SD.h>
// ---- pins ----
const uint8_t RFID_SS = 2;
const uint8_t RFID_RST = 3;
const uint8_t SD_CS = 10;
const uint8_t BUZZER_PIN = 4;
MFRC522 rfid(RFID_SS, RFID_RST);
RTC_DS3231 rtc;
bool cardOk = false;
unsigned long lastCard = 0;
void setBuzzer(bool on) { digitalWrite(BUZZER_PIN, on ? HIGH : LOW); }
void setup() {
Serial.begin(115200);
SPI.begin();
rfid.PCD_Init();
if (!rtc.begin()) Serial.println(F("RTC not found"));
if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // set from the upload time
pinMode(BUZZER_PIN, OUTPUT);
setBuzzer(false);
cardOk = SD.begin(SD_CS);
Serial.println(cardOk ? F("SD card ready") : F("SD card not found"));
if (cardOk && !SD.exists("ATTEND.CSV")) { File f = SD.open("ATTEND.CSV", FILE_WRITE); if (f) { f.println(F("date,time,card")); f.close(); } }
}
void loop() {
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
if (millis() - lastCard < 2000) { rfid.PICC_HaltA(); return; } // ignore the same tap twice
lastCard = millis();
char uid[21] = "";
for (byte i = 0; i < rfid.uid.size && i < 10; i++) sprintf(uid + i * 2, "%02X", rfid.uid.uidByte[i]);
DateTime now = rtc.now();
char row[40];
snprintf(row, sizeof(row), "%04d-%02d-%02d,%02d:%02d:%02d,%s", now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second(), uid);
Serial.println(row);
bool saved = false;
if (cardOk) { File f = SD.open("ATTEND.CSV", FILE_WRITE); if (f) { f.println(row); f.close(); saved = true; } }
setBuzzer(true); delay(saved ? 100 : 800); setBuzzer(false); // short beep = saved, long beep = card problem
rfid.PICC_HaltA();
}
The sketch above runs here on a simulated Arduino Uno. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Check it is on 3.3 V and the SPI wires (SCK, MOSI, MISO) are on the hardware SPI pins.
The coin cell is flat or missing. Some modules need the charging resistor removed when using a CR2032.
Check the card is FAT32, fully inserted, and CS is on the pin in the sketch.
Low-triggered module: invert the logic in setBuzzer().
The SD card is not found. Check it is FAT32 and that the card and reader do not share the same CS pin.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Yes. Most of the code works unchanged on an ESP32 with the ESP32 board package. Watch for 5 V modules: ESP32 pins are 3.3 V, so 5 V output signals need a resistor divider.
Use a 5 V USB phone charger or a power bank into the board's USB port.
9 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, RC522 RFID Reader / Writer SPI Module with Card & Tag, DS3231 Precision RTC Module with EEPROM, DFRobot Fermion MicroSD Card Module – SPI, Active Buzzer Module 3.3–5V, microSD Memory Card Class 10 (16GB), Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. 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 2–3 hours. The build on this page has 11 steps.
No. This page has the complete, tested code (rfid_attendance_logger.ino). Install these libraries first: MFRC522, RTClib and SD.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹1,446 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Active vs passive buzzers; RFID, UIDs and SPI; Real-time clocks and backup batteries; SPI devices and CSV logging.
Ideas that reuse this build: RFID door lock and RFID talking flashcards. They are listed under Take it further on this page.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.
SD card ready
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.