Build a Miniature Smart Home with
Auto Garage · Light Curtains · RFID Door Lock
A hands-on Arduino robotics project where you build a tiny house where the garage opens by itself, curtains pull back when the sun rises, and only a special card can unlock the front door!
1Project Overview — What Does It Do?
Imagine walking up to your tiny house and the garage door slides up automatically, the curtains inside pull back as morning light floods in, and only people with the right RFID card can open the front door. That's exactly what we're building here — a miniature model home loaded with real working sensors and servo motors, all controlled by a single Arduino Uno!
An IR sensor detects a "car" approaching and the servo lifts the door open, then closes it after the car passes.
An LDR (light sensor) watches for bright light. When it gets bright, the curtains open. When it gets dark, they close.
Tap the right card on the RFID reader and the door servo unlocks. The wrong card? Nothing opens!
IR sensor + Servo A
LDR sensor + Servo B
RFID reader + Servo C
Arduino Uno + Breadboard
2Materials You'll Need
🖥️ Electronics
🏠 House Frame
3Building the Miniature House Frame
Before the electronics, we need a house! Keep it simple — a basic box shape about 30cm wide × 25cm deep × 20cm tall works perfectly.
4Feature 1 — Automatic Garage Door
An IR proximity sensor sits at the base of the garage entrance. When a toy car (or your finger!) breaks the sensor's beam, it tells the Arduino to swing Servo A upward, lifting the garage door. After a short delay, the door comes back down.
How the Garage Door Is Made
- Cut a piece of cardboard to exactly fit the garage opening.
- Glue one edge of the door to the servo arm so when the servo rotates, the door lifts up.
- 0° = door fully closed | 90° = door fully open.
- The IR sensor module mounts flat at floor level, pointing across the driveway entrance.
Wiring — Garage IR Sensor + Servo A
| Component | Pin on Component | Arduino Pin |
|---|---|---|
| IR Sensor | VCC | 5V |
| IR Sensor | GND | GND |
| IR Sensor | OUT | Digital Pin 4 |
| Servo A (Garage) | Signal (Orange) | Digital Pin 9 |
| Servo A | VCC (Red) | 5V |
| Servo A | GND (Brown) | GND |
5Feature 2 — Light-Sensing Curtains
An LDR (Light Dependent Resistor) sits in a window of the house. In the dark the LDR has high resistance; in bright light its resistance drops. By measuring this with the Arduino's analog input, we can tell if it's day or night — and move the curtain servo accordingly.
How the Curtains Are Made
- Cut two small fabric rectangles (or thin cardstock strips) that are the same width as your window opening.
- Each strip attaches to a thread, and the thread wraps around the servo arm. When the servo turns, it winds up the thread and pulls the curtain open.
- A small loop of thread tied to a fixed point pulls the curtain back closed when the servo returns.
Wiring — LDR + Servo B
| Component | Pin / Leg | Arduino Pin |
|---|---|---|
| LDR | Leg 1 | 5V |
| LDR | Leg 2 | Analog A0 & 10kΩ to GND |
| Servo B (Curtains) | Signal (Orange) | Digital Pin 10 |
| Servo B | VCC (Red) | 5V |
| Servo B | GND (Brown) | GND |
6Feature 3 — RFID Keycard Door Lock
The MFRC522 RFID module uses radio waves to read tiny chips hidden inside cards and key fobs. Every card has a unique ID number — like a fingerprint. We store the "allowed" card ID in the code and compare it each time a card is scanned. Right card → servo unlocks door + green LED. Wrong card → red LED blinks.
How the Door Lock Works
- Servo C sits behind the front door with a small cardboard "bolt" attached to its arm.
- When locked, the bolt sticks out horizontally and blocks the door from opening.
- When the correct card is scanned, the servo rotates 90° to pull the bolt back, and the door can swing open.
- After 3 seconds, the servo returns and the door is locked again automatically.
Wiring — MFRC522 RFID + Servo C
| MFRC522 Pin | Arduino Pin |
|---|---|
| SDA (SS) | Digital 10 — wait! we use Pin 8 here since Pin 10 is for Servo B |
| SCK | Digital 13 |
| MOSI | Digital 11 |
| MISO | Digital 12 |
| GND | GND |
| RST | Digital 7 |
| 3.3V | 3.3V (NOT 5V — the RFID module runs on 3.3V) |
| Component | Pin | Arduino Pin |
|---|---|---|
| Servo C (Door Lock) | Signal (Orange) | Digital Pin 6 |
| Servo C | VCC (Red) | 5V |
| Servo C | GND (Brown) | GND |
| Green LED (+) | → 220Ω → | Digital Pin 2 |
| Red LED (+) | → 220Ω → | Digital Pin 3 |
| Both LEDs (–) | Cathode | GND |
7Full Wiring Quick Reference
8The Complete Arduino Code
Before uploading, you need to install two libraries in the Arduino IDE: Servo (built-in) and MFRC522 (search for it in Sketch → Include Library → Manage Libraries).
DumpInfo example from the MFRC522 library, scan your card, copy the UID from the Serial Monitor, then paste it into the code below.
// ════════════════════════════════════════════════ // 🏠 Miniature Smart Home // Features: Auto Garage · Light Curtains · RFID Lock // Arduino Uno + SG90 Servos + MFRC522 + LDR + IR // ════════════════════════════════════════════════ #include <Servo.h> #include <SPI.h> #include <MFRC522.h> // ── PIN DEFINITIONS ────────────────────────────── const int PIN_IR = 4; const int PIN_SERVO_A = 9; // Garage door const int PIN_SERVO_B = 10; // Curtains const int PIN_SERVO_C = 6; // Door lock const int PIN_LDR = A0; const int PIN_LED_GREEN = 2; const int PIN_LED_RED = 3; const int RFID_SS = 8; const int RFID_RST = 7; // ── SERVO OBJECTS ───────────────────────────────── Servo garageServo; Servo curtainServo; Servo doorServo; // ── RFID OBJECT ─────────────────────────────────── MFRC522 rfid(RFID_SS, RFID_RST); // ── YOUR CARD UID ─ Replace with your card's UID ── byte allowedUID[4] = {0xAB, 0xCD, 0xEF, 0x12}; // ── THRESHOLDS ──────────────────────────────────── const int LIGHT_THRESHOLD = 600; // 0-1023; tune for your room // ── SERVO ANGLES ────────────────────────────────── const int GARAGE_CLOSED = 0; const int GARAGE_OPEN = 90; const int CURTAIN_CLOSED = 0; const int CURTAIN_OPEN = 120; const int DOOR_LOCKED = 0; const int DOOR_UNLOCKED = 90; // ── STATE VARIABLES ─────────────────────────────── bool garageOpen = false; bool curtainOpen = false; bool doorUnlocked = false; unsigned long garageTimer = 0; unsigned long doorTimer = 0; // ════════════════════════════════════════════════ void setup() { Serial.begin(9600); SPI.begin(); rfid.PCD_Init(); garageServo.attach(PIN_SERVO_A); curtainServo.attach(PIN_SERVO_B); doorServo.attach(PIN_SERVO_C); pinMode(PIN_IR, INPUT); pinMode(PIN_LED_GREEN, OUTPUT); pinMode(PIN_LED_RED, OUTPUT); // Start in closed/locked position garageServo.write(GARAGE_CLOSED); curtainServo.write(CURTAIN_CLOSED); doorServo.write(DOOR_LOCKED); Serial.println("🏠 Smart Home Ready!"); } // ════════════════════════════════════════════════ void loop() { handleGarage(); handleCurtains(); handleRFID(); handleAutoClose(); } // ── GARAGE DOOR ─────────────────────────────────── void handleGarage() { bool carDetected = (digitalRead(PIN_IR) == LOW); // IR LOW = object detected if (carDetected && !garageOpen) { garageServo.write(GARAGE_OPEN); garageOpen = true; garageTimer = millis(); Serial.println("🚗 Car detected — Garage OPEN"); } } // ── LIGHT-SENSING CURTAINS ──────────────────────── void handleCurtains() { int lightLevel = analogRead(PIN_LDR); if (lightLevel > LIGHT_THRESHOLD && !curtainOpen) { curtainServo.write(CURTAIN_OPEN); curtainOpen = true; Serial.println("🌅 Bright! Curtains OPENING"); } else if (lightLevel <= LIGHT_THRESHOLD && curtainOpen) { curtainServo.write(CURTAIN_CLOSED); curtainOpen = false; Serial.println("🌙 Dark. Curtains CLOSING"); } } // ── RFID DOOR LOCK ──────────────────────────────── void handleRFID() { if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return; bool authorized = true; for (byte i = 0; i < 4; i++) { if (rfid.uid.uidByte[i] != allowedUID[i]) { authorized = false; break; } } if (authorized) { doorServo.write(DOOR_UNLOCKED); doorUnlocked = true; doorTimer = millis(); digitalWrite(PIN_LED_GREEN, HIGH); Serial.println("✅ Access GRANTED — Door UNLOCKED"); } else { digitalWrite(PIN_LED_RED, HIGH); delay(200); digitalWrite(PIN_LED_RED, LOW); delay(200); digitalWrite(PIN_LED_RED, HIGH); delay(200); digitalWrite(PIN_LED_RED, LOW); Serial.println("❌ Access DENIED"); } rfid.PICC_HaltA(); } // ── AUTO-CLOSE TIMERS ───────────────────────────── void handleAutoClose() { unsigned long now = millis(); if (garageOpen && (now - garageTimer > 4000)) { garageServo.write(GARAGE_CLOSED); garageOpen = false; Serial.println("🔒 Garage CLOSING"); } if (doorUnlocked && (now - doorTimer > 3000)) { doorServo.write(DOOR_LOCKED); doorUnlocked = false; digitalWrite(PIN_LED_GREEN, LOW); Serial.println("🔒 Door RE-LOCKED"); } }
millis() works: Instead of delay() which freezes the Arduino, we use millis() to check how much time has passed — like peeking at a clock. This way the garage timer, door timer, and RFID scanner all run at the same time without blocking each other!
9Testing Your Smart Home
🚗 Test 1 — Garage Door
Hold a toy car (or your finger) in front of the IR sensor at the garage entrance. The servo should rotate upward within a second, and after 4 seconds it should come back down on its own.
🌅 Test 2 — Light Curtains
Shine a torch or phone flashlight at the LDR. The curtains should open. Cover the LDR with your hand (go dark) and the curtains should close. Adjust LIGHT_THRESHOLD in the code if needed — open the Serial Monitor (9600 baud) to see the actual LDR reading and tune it perfectly.
🔑 Test 3 — RFID Door
Tap your allowed card on the RFID reader — the green LED should light up and the door servo should unlock for 3 seconds. Try a different card or fob — the red LED should blink twice and nothing should open.
10Awesome Upgrades to Try
- 🔔 Doorbell buzzer: Add a piezo buzzer and a button outside the front door to ring a little chime inside the house.
- 💡 Smart lights: Add LEDs inside each room, and use a relay module to flip them on/off based on time of day (with a real-time clock module).
- 📱 Bluetooth control: Add an HC-05 Bluetooth module so you can open the garage or unlock the door from a phone app.
- 🌡️ Temperature display: Add a DHT11 sensor and a small LCD to show the temperature and humidity inside your tiny home.
- 🏊 Garden sprinkler: Add a small pump and soil moisture sensor so the garden waters itself when the soil gets dry!
- 📹 Security camera: Connect an ESP32-CAM module so you can view a live video feed of the house entrance on your phone.

Comments
Post a Comment