DIY Smart Miniature Apartment | Auto Bed, Curtains, TV & Wardrobe Arduino Project

DIY Smart Miniature Apartment | Auto Bed, Curtains, TV & Wardrobe Arduino Project | MakeMindz
⚙️ Arduino · 6 Servo Motors · Smart Home

Smart Mini
Apartment
That Runs Itself

An auto-folding bed, self-opening curtains, a rotating TV, and a sliding wardrobe — all packed into one tiny apartment powered by Arduino! 🏠⚙️

⏱️ 5–6 Hours 🔧 Advanced Build 🎓 Age 13+ 💰 ~₹3,200 🛠️ 4 Smart Features
BEDROOM LIVING ROOM wall bed slot 🛏 AUTO-FOLD BED SG90 · Pin 9 🪟 AUTO CURTAINS SG90 · Pin 10 📺 Smart TV 📺 ROTATING TV MG90S · Pin 11 🚪 SLIDING WARDROBE SG90 · Pin 12 ARDUINO MEGA
🛏️ Fold-Away Bed Murphy-style bed folds into wall
🪟 Auto Curtains Open/close on a timer or light sensor
📺 Rotating TV Swivels to face any seat in the room
🚪 Sliding Wardrobe Door slides open automatically

🏗️ What Is a Smart Miniature Apartment?

Micro-apartments are becoming popular in big cities because they use space incredibly cleverly — walls fold into beds, furniture slides and rotates. Your model brings this to life using servo motors controlled by Arduino Mega, replicating each smart mechanism at 1:20 scale.

This is the most complex Arduino build in the MakeMindz series — 6 servo motors, 4 sensors, 2 buttons, and 1 LCD all coordinated by one program. Build it, and you'll understand how real smart apartments are designed!

🛏️ Murphy Fold Bed

Real Murphy wall beds use a gas piston mechanism. Yours uses an SG90 servo that pivots a cardboard bed panel up into a wall slot — exact same principle, tiny scale!

🪟 Auto Curtains

A servo pulls a thread connected to both curtain panels. When the servo turns one way, both curtains open. Reverse = close. An LDR triggers them automatically at sunrise!

📺 Rotating TV Stand

A servo motor sits under the TV platform and rotates it up to 90°. Press a button and the TV faces the sofa. Press again, it faces the dining table. Just like luxury smart homes!

🚪 Sliding Wardrobe

An SG90 servo with a thread-and-pulley system slides the wardrobe door along a top rail. The door glides open when triggered — perfect space-saving mechanism!

🌍 Real-World Link: Ori Systems in the USA and YArdSpace in Japan make full-size motorised furniture using exactly these mechanisms — just with stronger motors. The programming logic is identical to what you'll build here!

🛒 Full Parts List

Everything available on Amazon India or Robu.in. Budget ~₹3,200 for all four features:

🔵
Arduino Mega 2560 Mega gives enough pins for 6 servos, 2 sensors, buttons and LCD on one board.
⚙️
4× SG90 Micro Servo Motors One per feature — bed, curtain, TV, wardrobe door. Light and compact.
⚙️
2× MG90S Metal Gear Servo Extra torque servos for the bed (heavier) and TV platform (precision needed).
☀️
LDR (Light Dependent Resistor) Detects light level — opens curtains automatically at "sunrise."
🔊
Active Buzzer Beeps when any mechanism activates — feedback sound.
🟡
4× Push Buttons Manual control — one button per feature for direct on/off.
📺
16×2 LCD + I²C Module Shows which mode is active: "BED UP", "CURTAINS OPEN", etc.
🔩
10kΩ Resistor (for LDR) + 330Ω ×4 (LEDs) Voltage divider for LDR, current protection for indicator LEDs.
🟢🔴
4× Indicator LEDs (green + red pairs) Show each feature's status: open/closed, up/down.
🏠
Foam Board / Cardboard (A2 size ×3) Main apartment structure, walls, floor, partitions.
🧵
Strong Thread / Fishing Line (2m) Connects servo horns to curtain panels and wardrobe door.
🔌
Jumper Wires + Breadboard + 9V Battery Wiring all components. Use a 2A USB supply for reliability with 6 servos.
⚡ Power note: Six servo motors together can draw up to 1.5A. The Arduino Mega's 5V pin handles about 500mA. Use a separate 5V 2A power supply for the servos, sharing only GND with the Arduino. This prevents resets during movement!

⚡ Circuit Diagram

Six servo motors, one LDR, four buttons, one LCD, and a buzzer — all coordinated by one Arduino Mega:

SMART MINIATURE APARTMENT — WIRING DIAGRAM ARDUINO MEGA 2560 5V GND Pin 9 → Servo BED Pin 10 → Servo CURTAIN Pin 11 → Servo TV Pin 12 → Servo WARDROBE Pin 2 → BTN Bed Pin 3 → BTN Curtain Pin 4 → BTN TV Pin 5 → BTN Wardrobe A0 → LDR Pin 7 → Buzzer A4/A5 → LCD I²C Servo — BED FOLD MG90S · Pin 9 Murphy wall bed mechanism Servo — CURTAIN SG90 · Pin 10 Thread-pull, both panels Servo — TV ROTATE MG90S · Pin 11 Platform spins 0°–90° Servo — WARDROBE SG90 · Pin 12 Rail-slide door system 4× PUSH BUTTONS All use INPUT_PULLUP BED — Pin 2 CURTAIN — 3 TV — Pin 4 WARDROBE — 5 Each: one leg → pin, other → GND Buttons Pins 2–5 LDR Sensor Light level → A0 10kΩ pull-down to GND 🔔 Active Buzzer + → Pin 7 · − → GND BED: FOLDED UP CURTAINS: OPEN LCD 16×2 I²C ⚡ SERVO POWER SUPPLY 5V 2A external → all servo VCC Share GND with Arduino only LEGEND: Servo Signal Sensor I²C All GNDs share common ground bus
📌 COMPLETE PIN REFERENCE — ARDUINO MEGA 2560 Servo Motors (all share external 5V 2A power) ────────── Bed Fold Servo ──► Pin 9 // MG90S — heavier load Curtain Servo ──► Pin 10 // SG90 — thread pull TV Rotate Servo ──► Pin 11 // MG90S — platform Wardrobe Servo ──► Pin 12 // SG90 — rail slide Push Buttons (all INPUT_PULLUP, other leg → GND) ──── Bed Button ──► Pin 2 Curtain Button ──► Pin 3 TV Button ──► Pin 4 Wardrobe Button ──► Pin 5 Sensors & Output ──── LDR (with 10kΩ pull-down) ──► A0 Buzzer (+) ──► Pin 7 LCD SDA ──► A4 (20 on Mega) LCD SCL ──► A5 (21 on Mega)

🔧 Step-by-Step Build Guide

Build the apartment structure first, then install each mechanism one at a time. Test each before moving to the next!

1
Build the Apartment Shell

Use foam board (best) or thick cardboard to build a 40cm × 30cm × 25cm miniature apartment with two rooms:

  • Floor: One large base plate, 40cm × 30cm
  • Walls: Three walls (back, left, right) — 25cm tall. Front is open for viewing
  • Partition wall: Divides bedroom (left) from living room (right) at the 20cm mark
  • Window openings: Cut 8cm × 6cm windows in the bedroom wall for the curtains
  • Wardrobe alcove: In the living room, create a 10cm × 15cm recessed section for the wardrobe
  • Ceiling: Loose-fit ceiling panel (removable for easy wiring access)
📐 Scale tip: Keep a consistent 1:20 scale — a real sofa of 200cm becomes 10cm in your model. Print a mini furniture template at this scale for accurate room layout before cutting foam board!
2
Install the Fold-Away Bed

The Murphy bed mechanism is the most mechanical part of the build:

  • Cut a bed panel from foam board: 8cm × 5cm (mattress surface)
  • Attach a small hinge along the bottom edge of the bed panel to the wall — the bed pivots here
  • Mount the MG90S servo on the wall with its shaft horizontally, 2cm above the hinge
  • Glue a short arm (3cm of coffee stirrer) to the servo horn
  • Connect the servo arm to the back of the bed panel with a pin or toothpick pivot
  • When servo rotates to 90°, the arm pushes the bed panel up and into the wall slot
🔧 Test before gluing: Run the servo from 10° to 90° manually in a test sketch and observe whether the bed folds cleanly. Adjust arm length until the motion is smooth before final assembly.
3
Set Up the Auto Curtains

The curtain mechanism uses a single servo to pull both panels simultaneously:

  • Cut two fabric curtain panels (use tissue paper or thin cloth): 4cm × 6cm each
  • Hang them from a thin wooden skewer (curtain rod) glued above the window
  • Mount the SG90 servo above the window, shaft pointing down, off to one side
  • Tie a thread from the left curtain, across to the servo horn, and across to the right curtain
  • When servo turns clockwise, it pulls both threads, opening both curtains simultaneously
  • Counterclockwise rotation releases thread — curtains close under their own weight (add tiny weights at bottom if needed)
🧵 Thread tip: Use fishing line (monofilament) rather than regular thread — it doesn't tangle and slides with minimal friction through small guide loops made from bent wire staples.
4
Install the Libraries
Library Manager
// Sketch → Include Library → Manage Libraries → install:
"LiquidCrystal_I2C"   // for the status LCD
"Servo"               // built-in, controls all 4 servos
🍓 Mega I²C pins: On Arduino Mega, the I²C pins are Pin 20 (SDA) and Pin 21 (SCL) — NOT A4/A5 like on Uno! If your LCD is blank, check you've connected to the right pins.
5
Upload the Smart Apartment Code

The complete Arduino Mega program controlling all four features — button-triggered and auto-triggered by the LDR sensor:

smart_apartment.ino
#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// ── Pin Definitions ────────────────────────────
#define PIN_BED       9
#define PIN_CURTAIN  10
#define PIN_TV       11
#define PIN_WARDROBE 12
#define BTN_BED       2
#define BTN_CURTAIN   3
#define BTN_TV        4
#define BTN_WARDROBE  5
#define LDR_PIN      A0
#define BUZZER_PIN    7

// ── Servo angle settings ────────────────────────
// Bed: 10° = flat (down), 90° = folded (up)
// Curtains: 30° = closed, 120° = open
// TV: 90° = facing front, 55° = rotated sideways
// Wardrobe: 10° = closed, 80° = open
#define BED_DOWN       10
#define BED_UP         88
#define CURTAIN_CLOSED 30
#define CURTAIN_OPEN  120
#define TV_FRONT       90
#define TV_SIDE        55
#define WARDROBE_SHUT  10
#define WARDROBE_OPEN  80
#define LDR_THRESHOLD 600  // above = bright = open curtains

Servo servoBed, servoCurtain, servoTV, servoWardrobe;
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Feature state tracking
bool bedUp        = false;
bool curtainOpen  = false;
bool tvRotated    = false;
bool wardrobeOpen = false;

// Debounce tracking
unsigned long lastPress[4] = {0,0,0,0};
#define DEBOUNCE_MS 600

// ── Helpers ─────────────────────────────────────
void beep(int ms = 80) {
  digitalWrite(BUZZER_PIN, HIGH); delay(ms);
  digitalWrite(BUZZER_PIN, LOW);
}

void showStatus() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("BED:");       lcd.print(bedUp       ? "UP "  : "DWN");
  lcd.print(" CRT:");     lcd.print(curtainOpen  ? "OPN"  : "CLS");
  lcd.setCursor(0, 1);
  lcd.print("TV:");       lcd.print(tvRotated    ? "ROT"  : "FRT");
  lcd.print("  WRD:");    lcd.print(wardrobeOpen ? "OPN"  : "CLS");
}

// ── Individual feature toggles ──────────────────
void toggleBed() {
  bedUp = !bedUp;
  servoBed.write(bedUp ? BED_UP : BED_DOWN);
  Serial.println(bedUp ? "🛏 Bed FOLDED UP" : "🛏 Bed DOWN");
  beep(); showStatus();
}

void toggleCurtain() {
  curtainOpen = !curtainOpen;
  servoCurtain.write(curtainOpen ? CURTAIN_OPEN : CURTAIN_CLOSED);
  Serial.println(curtainOpen ? "🪟 Curtains OPEN" : "🪟 Curtains CLOSED");
  beep(); showStatus();
}

void toggleTV() {
  tvRotated = !tvRotated;
  servoTV.write(tvRotated ? TV_SIDE : TV_FRONT);
  Serial.println(tvRotated ? "📺 TV ROTATED" : "📺 TV FRONT");
  beep(); showStatus();
}

void toggleWardrobe() {
  wardrobeOpen = !wardrobeOpen;
  servoWardrobe.write(wardrobeOpen ? WARDROBE_OPEN : WARDROBE_SHUT);
  Serial.println(wardrobeOpen ? "🚪 Wardrobe OPEN" : "🚪 Wardrobe CLOSED");
  beep(); showStatus();
}

// ── Check one button with debounce ──────────────
void checkButton(int pin, int idx, void(*action)()) {
  if (digitalRead(pin) == LOW && millis() - lastPress[idx] > DEBOUNCE_MS) {
    lastPress[idx] = millis();
    action();
  }
}

// ── LDR auto-curtain ────────────────────────────
void checkLightSensor() {
  int light = analogRead(LDR_PIN);
  // Open curtains when bright, close when dim
  if (light > LDR_THRESHOLD && !curtainOpen) {
    Serial.println("☀️ Sunrise — auto-opening curtains");
    curtainOpen = true;
    servoCurtain.write(CURTAIN_OPEN);
    beep(50); delay(100); beep(50);
    showStatus();
  } else if (light < (LDR_THRESHOLD - 100) && curtainOpen) {
    Serial.println("🌙 Getting dark — closing curtains");
    curtainOpen = false;
    servoCurtain.write(CURTAIN_CLOSED);
    beep(50);
    showStatus();
  }
}

// ── Setup ───────────────────────────────────────
void setup() {
  Serial.begin(9600);

  servoBed.attach(PIN_BED);
  servoCurtain.attach(PIN_CURTAIN);
  servoTV.attach(PIN_TV);
  servoWardrobe.attach(PIN_WARDROBE);

  // Start positions
  servoBed.write(BED_DOWN);
  servoCurtain.write(CURTAIN_CLOSED);
  servoTV.write(TV_FRONT);
  servoWardrobe.write(WARDROBE_SHUT);

  pinMode(BTN_BED,      INPUT_PULLUP);
  pinMode(BTN_CURTAIN,  INPUT_PULLUP);
  pinMode(BTN_TV,       INPUT_PULLUP);
  pinMode(BTN_WARDROBE, INPUT_PULLUP);
  pinMode(BUZZER_PIN,   OUTPUT);

  lcd.init(); lcd.backlight();
  lcd.print("Smart Apartment!");
  lcd.setCursor(0,1); lcd.print("All systems ready");
  delay(1500);
  showStatus();

  Serial.println("Smart Apartment Ready!");
  Serial.println("Press buttons 2/3/4/5 to control features.");
}

// ── Main Loop ───────────────────────────────────
void loop() {
  checkButton(BTN_BED,      0, toggleBed);
  checkButton(BTN_CURTAIN,  1, toggleCurtain);
  checkButton(BTN_TV,       2, toggleTV);
  checkButton(BTN_WARDROBE, 3, toggleWardrobe);
  checkLightSensor();
  delay(80);
}
🎛️ Calibrating angles: The angles in the #define section (BED_UP, CURTAIN_OPEN etc.) are starting points. After assembly, open Serial Monitor (9600 baud) and test each feature. If the bed doesn't fold far enough, increase BED_UP from 88 to 95. If curtains open too wide, reduce CURTAIN_OPEN from 120 to 100. Tune each value until movement looks perfect!
☀️ LDR tuning: Cover the LDR with your hand and print the analogRead(LDR_PIN) value in the loop — set LDR_THRESHOLD halfway between your dark and bright readings. E.g. dark=200, bright=800 → threshold=500.
6
Decorate & Finish

Turn your working model into a beautiful miniature apartment:

  • Flooring: Print a wood-grain pattern and glue to the floor
  • Walls: Paint one accent wall a bold colour (navy, forest green, or warm terracotta)
  • Mini furniture: Cut foam-board sofas, a coffee table, and rugs from coloured card
  • Lighting: Add 3V LED fairy lights inside for ambient room lighting
  • Control panel: Mount the 4 buttons on a mini panel outside the apartment — label each one with a printed sticker
  • Plants: Add tiny fake plants cut from green sponge — details make the model come alive!

🛠️ Troubleshooting Guide

🔴 Problem🟡 Likely Cause✅ Fix
Arduino resets when servos move All servos drawing too much current from Arduino Connect servo VCC wires to external 5V 2A supply, share only GND with Arduino
Bed doesn't fold all the way up BED_UP angle too low, or servo arm too short Increase BED_UP from 88 to 95–100. Also check the arm length connecting servo to bed panel
Curtains don't open evenly Thread lengths unequal Adjust thread length so both curtain panels start equally distributed on the rod
TV servo jitters after stopping Servo lib timer conflict on Mega with certain pins Move TV servo to Pin 13 or any PWM pin marked ~ on the Mega board
LDR curtains trigger randomly Threshold at the noise boundary Add 100-unit hysteresis (open at 600, close at 500) — already in code. Increase gap if needed
LCD shows nothing Wrong Mega I²C pins On Mega, I²C is Pin 20 (SDA) and Pin 21 (SCL) — not A4/A5 like Uno!
Button triggers multiple times DEBOUNCE_MS too short Increase DEBOUNCE_MS from 600 to 800ms in the code

🚀 Level Up Your Smart Apartment!

Once all four features work, these upgrades turn your model into a true smart home showcase:

📱 App Control

Add ESP8266 Wi-Fi — control all features from a phone web page over your home network!

🎤 Voice Commands

Add a voice recognition module — say "Open curtains" and the apartment obeys!

🌡️ Smart Climate

Add DHT11 sensor — tiny servo fan turns on automatically when temperature rises above threshold.

🔒 RFID Door

Add RFID module to the front door — only authorised cards can enter the apartment!

💡 Smart Lighting

Add addressable LED strips (WS2812B) — scene-based lighting: Movie, Work, Sleep modes!

📊 Energy Dashboard

Log each feature's activation to SD card — display usage stats on the LCD at end of day.


❓ Frequently Asked Questions

Why Arduino Mega instead of Uno for this project?

The Mega has 54 digital I/O pins and 16 analog pins, compared to Uno's 14 digital and 6 analog. With 4 servos, 4 buttons, an LDR, a buzzer, and an LCD, we use 13+ pins — the Mega handles this comfortably with room to add more sensors for upgrades. The Mega also has more PWM pins for smooth servo control.

What is the best material to build the apartment structure?

5mm foam board (available at any stationery shop) is ideal — it's lightweight, rigid, easy to cut with a craft knife, and takes paint and glue perfectly. For interior walls you can use 3mm foam board. Avoid regular cardboard for the main structure as it warps under the stress of servo motion.

How do I make the TV rotate only partway and stop precisely?

SG90 and MG90S servos move to an exact degree when commanded — that's their core feature! The code sends exactly TV_FRONT (90°) or TV_SIDE (55°) and the servo moves there precisely every time. You can tune the exact angles in the code until the TV faces exactly the right direction.

The wardrobe door is too heavy for the SG90 to slide — what do I do?

Use a pulley system to give the servo more mechanical advantage — thread the line through a small spool at the top before attaching to the door. Alternatively, use a slightly stronger MG90S servo (metal gears, more torque). Make sure the door slides on a smooth rail with minimal friction — sand the rail lightly with fine sandpaper.

Can I add more features — like a tiny kitchen appliance or a sliding sofa?

Absolutely! The Mega has plenty of spare pins. Add a new servo, new button, new boolean state variable, and new toggle function — then call checkButton() for it in the loop. The code pattern is identical for every new feature. A sliding sofa, a drop-down kitchen counter, or a rising bookshelf all work with the same approach.

Is this a good science exhibition project?

Outstanding choice! It spans electronics, programming, mechanical design, and interior architecture. For the exhibition, add a cardboard "control panel" with labelled buttons in front of the apartment. Prepare a short demo sequence showing all features activating in order. Judges love seeing multiple integrated systems working together — it shows real system-level engineering thinking.

Building the future, one miniature at a time.

#SmartApartment #ArduinoMega #FoldingBed #AutoCurtains #RotatingTV #SlidingWardrobe #KidsRobotics #STEMProject #MakeMindz #HomeAutomation #MiniatureSmartHome

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course