Adventure · Arduino Uno
Secret Badge Chest
A Arduino Uno build with 4 components. Reads: RFID. Drives: Servo, LED, Buzzer. When a card is presented, chirp and swing the latch open.
4 parts · 11 connections · 9 steps
Wiring
Parts
| Part | Refs | Qty | Est. |
|---|---|---|---|
| RC522 RFID reader (SPI) | RFID | 1 | $2.90 |
| SG90 micro servo | Servo | 1 | $2.40 |
| LED (5 mm) + 220 Ω resistor | LED | 1 | $0.15 |
| Passive piezo buzzer | Buzzer | 1 | $0.60 |
| Plus: breadboard, jumper wires, USB cable | ≈ $6.05 | ||
Prices are rough hobby-market estimates. Click a part for wiring notes and specs.
Firmware
1// RFID Lock2// Generated by Wirecraft for the Arduino Uno (ATmega328P)3// Prompt: An RFID treasure chest that unlocks a servo latch and chirps when the right card is presented4//5// Wiring, parts and step-by-step assembly live alongside this file.67#include <Arduino.h>8#include <SPI.h>9#include <MFRC522.h>10#include <Servo.h>1112#define RFID_SS 213#define RFID_RST 314#define SERVO_PIN 515#define LED_PIN 416#define BUZZER_PIN 61718MFRC522 rFID(RFID_SS, RFID_RST);19bool rFIDCardPresent = false;20Servo servo;2122void setup() {23 Serial.begin(115200);24 SPI.begin();25 rFID.PCD_Init();26 servo.attach(SERVO_PIN);27 servo.write(0);28 pinMode(LED_PIN, OUTPUT);29 pinMode(BUZZER_PIN, OUTPUT);30 Serial.println(F("RFID Lock ready."));31}3233void loop() {34 // --- Read sensors ---35 rFIDCardPresent = rFID.PICC_IsNewCardPresent() && rFID.PICC_ReadCardSerial();3637 // --- React ---38 // When a card is presented, chirp and swing the latch open.39 if (rFIDCardPresent) {40 servo.write(90);41 } else {42 servo.write(0);43 }4445 delay(50);46}471; PlatformIO project for RFID Lock2[env:uno]3platform = atmelavr4board = uno5framework = arduino6monitor_speed = 1152007lib_deps =8 miguelbalboa/MFRC522@^1.4.119 arduino-libraries/Servo@^1.2.110Assembly
- 1
Lay out your workbench
Gather the Arduino Uno, a half-size breadboard, and a bundle of male-to-male jumper wires. Keep the parts list open — every component below gets its own spot on the breadboard. Don't plug in USB power until the last wire is placed.
- 2
Seat the board and power rails
Run a red jumper from the Arduino Uno's 3V3 (or 5V for 5 V parts) pin to the breadboard's + rail, and a black jumper from GND to the − rail. Every component's power and ground will tap these rails.
- 3
Wire the RFID
Place the RC522 RFID reader (SPI) on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: SDA → D2, RST → D3. Tip: SPI pins (SCK/MOSI/MISO) go to the board's hardware SPI header — the diagram labels the two that vary.
- 4
Wire the Servo
Place the SG90 micro servo on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: SIG → D5. Tip: Servos are power-hungry. For more than one, feed them from a separate 5 V supply and share GND.
- 5
Wire the LED
Place the LED (5 mm) + 220 Ω resistor on the breadboard. Power first: CATHODE → − rail. Then signals: ANODE → D4. Tip: The longer leg is the anode (+). The resistor can go on either leg.
- 6
Wire the Buzzer
Place the Passive piezo buzzer on the breadboard. Power first: GND → − rail. Then signals: SIG → D6. Tip: Passive buzzers need tone(); active ones just want HIGH. This design assumes passive.
- 7
Double-check before power
Trace every wire against the diagram once more — 11 connections in total. The classic mistakes: swapped power and ground, and off-by-one rows on the breadboard. Thirty seconds of checking saves a component.
- 8
Flash the firmware
Open the exported folder in VS Code with the PlatformIO extension (free), plug in the Arduino Uno over USB, and hit Upload. PlatformIO fetches the libraries listed in platformio.ini automatically. Prefer the Arduino IDE? Copy src/main.cpp into a new sketch and install the same libraries from the Library Manager.
- 9
Bring it to life
Open the Serial Monitor at 115200 baud to watch live readings. When a card is presented, chirp and swing the latch open. Adjust the thresholds at the top of the sketch to match your environment.