Smart Shoe Rack
with UV Sanitizer
Build a robot that keeps your shoes germ-free automatically using ultraviolet light! 🔬✨
Why Build a UV Shoe Sanitizer? 🦠
Your shoes touch hundreds of dirty surfaces every day — floors, pavements, and puddles filled with bacteria and fungi! UV-C light is used in hospitals to kill germs, and now YOU can build your own sanitizer right at home. This project combines sensors, light, motors, and coding — everything a real engineer uses!
How Does It Work? ⚙️
Five smart steps happen automatically — no buttons needed!
Shoes Placed
You put shoes on the rack
PIR Detects
Motion sensor sees movement
LCD Shows
"Sanitizing… please wait"
UV Light On
UV LEDs kill 99% of germs
Done! Beep!
Buzzer beeps, shoes are clean
What You Need 🛒
Ask a parent to help you order the electronic parts online. Most parts are cheap and easy to find!
Circuit Diagram & Wiring ⚡
Connect every component exactly as shown. Get an adult to check all connections before switching on power!
🔌 Complete Wiring Table
| Component | Wire / Pin | Arduino Pin | Notes |
|---|---|---|---|
| PIR Sensor (HC-SR501) | OUT (Signal) | PIN 2 | VCC → 5V, GND → GND |
| UV LED 1 | Anode + | via RELAY | 100Ω resistor in series, cathode to GND |
| UV LED 2 | Anode + | via RELAY | All 4 UV LEDs wired in parallel |
| UV LED 3 & 4 | Anode + | via RELAY | Connected to relay COM + NO pins |
| 5V Relay Module | IN (Signal) | PIN 8 | VCC → 5V, GND → GND. Controls all UV LEDs |
| 16×2 LCD (I2C) | SDA / SCL | A4 / A5 | VCC → 5V, GND → GND. I2C address: 0x27 |
| Servo Motor SG90 | Signal (Orange) | PIN 9 | Red → 5V, Brown/Black → GND |
| Piezo Buzzer | Positive (+) | PIN 6 | Negative (–) → GND directly |
| 9V Battery | + / – | VIN + GND | Or power via USB from laptop while programming |
Step-by-Step Instructions 🔧
Take your time with each step. Real engineers never rush — they think carefully and double-check everything!
📦 Build the Shoe Rack Frame
Cut and assemble your frame from thick cardboard or thin plywood (3–5mm). You need:
- 2 side panels: 40cm tall × 25cm wide
- 3 shelf panels: 45cm × 25cm (top, middle, bottom)
- The BOTTOM shelf becomes the UV sanitizer chamber — make it at least 12cm tall
- Cut 4 small ventilation holes on the back panel of the UV chamber (1cm diameter)
- Reinforce all joints with hot glue or small screws
🔵 Install the UV LEDs
Mount four UV LEDs inside the bottom chamber:
- Poke four small holes in the top panel of the UV chamber, spaced evenly
- Push each UV LED through a hole and secure with hot glue (LED faces downward)
- Connect all four LED anodes (+) together → one wire to relay COM/NO
- Connect all four LED cathodes (–) together → 100Ω resistor → GND
- Use 100Ω resistors to protect each LED from burning out
🚪 Add the Servo-Powered Door
The servo opens and closes a small door over the UV chamber to block UV light when not in use — this is a great safety feature!
- Cut a door panel the same size as the UV chamber opening
- Hot-glue the servo to the side wall of the rack near the chamber
- Attach a cardboard or popsicle stick arm to the servo horn
- Connect the arm to the door with a small hinge or bent wire
- Test: at 0° the door should be fully open; at 90° it should be closed
📡 Mount the PIR Motion Sensor
The PIR sensor is the robot's eyes — it detects when someone puts shoes in the rack!
- Mount the PIR sensor on the FRONT edge of the UV chamber, facing outward
- Adjust the sensitivity screw (left = less sensitive, right = more sensitive)
- Adjust the time-delay screw to minimum (clockwise to minimum, about 5 seconds)
- Leave it mounted for 1 minute when you first power on — PIR sensors need to "warm up"
📟 Connect the LCD Display
The LCD screen shows friendly messages so the user knows what's happening:
- Use the I2C version of the LCD (it has 4 pins: VCC, GND, SDA, SCL)
- Connect SDA → Arduino A4 and SCL → Arduino A5
- VCC → 5V and GND → GND
- Mount it on the front of the rack so it's easy to read
- If the screen is blank after uploading code, turn the small blue potentiometer on the I2C module to adjust contrast
⚡ Wire the Full Circuit
Now connect everything using the wiring table above. Work in this order:
- First: Set up power rails on breadboard (5V and GND rows)
- Second: Connect PIR sensor to Pin 2
- Third: Connect Relay module to Pin 8 (relay controls all UV LEDs)
- Fourth: Connect Servo to Pin 9
- Fifth: Connect Buzzer to Pin 6
- Sixth: Connect LCD SDA/SCL to A4/A5
- Last: Connect 9V battery to VIN and GND
💻 Upload the Code
Open Arduino IDE, install the required libraries first, then upload the code below:
- Install LiquidCrystal_I2C library: Sketch → Include Library → Manage Libraries → search "LiquidCrystal I2C" by Frank de Brabander
- Install Servo library (usually pre-installed)
- Copy the full code from the section below into a new Arduino sketch
- Select Tools → Board → Arduino Uno
- Select Tools → Port → the port showing your Arduino
- Click the Upload button (right arrow)
🧪 Test & Celebrate! 🎉
Time to test your creation!
- Power on the Arduino — LCD should show "Smart Shoe Rack" then "Ready ✓"
- Place a shoe (or any object) in the rack → PIR should detect it within 5 seconds
- LCD should show "Sanitizing…" and the UV LEDs turn on for 30 seconds
- After 30 seconds: UV turns off, servo closes the door, buzzer beeps 3 times
- LCD shows "Done! Shoes Clean!" and returns to "Ready ✓"
Full Commented Code 💻
Every line has a comment explaining what it does — great for learning! Copy this exactly into your Arduino IDE.
// ===================================================== // 👟 SMART SHOE RACK WITH UV SANITIZER // Arduino Uno project for kids — STEM / Robotics // UV sanitizes shoes automatically using PIR sensor // ===================================================== #include <Wire.h> // Needed for I2C communication (LCD) #include <LiquidCrystal_I2C.h> // LCD library — install from Library Manager #include <Servo.h> // Servo motor library (built-in) // --- LCD Setup --- // LiquidCrystal_I2C(address, columns, rows) // Try 0x3F if 0x27 doesn't work LiquidCrystal_I2C lcd(0x27, 16, 2); // --- Servo Setup --- Servo uvDoor; // Servo that opens/closes the UV chamber door // --- Pin Numbers --- const int PIR_PIN = 2; // PIR motion sensor output pin const int RELAY_PIN = 8; // Relay module (controls all UV LEDs) const int SERVO_PIN = 9; // Servo motor signal pin const int BUZZER_PIN = 6; // Piezo buzzer positive pin // --- Servo Positions --- const int DOOR_OPEN = 0; // Door open — shoes slide in freely const int DOOR_CLOSED = 90; // Door closed — UV light safely contained // --- UV Sanitize Duration --- // 30 seconds is enough for basic sanitization // You can increase to 60 seconds for better results const unsigned long UV_DURATION_MS = 30000; // 30 seconds in milliseconds // --- State Machine --- // This helps us track what the robot is currently doing enum RackState { STATE_IDLE, // Waiting for shoes STATE_SANITIZING, // UV light is on, killing germs STATE_DONE // Sanitization finished, buzzing }; RackState currentState = STATE_IDLE; unsigned long sanitizeStartTime = 0; // Records when UV started bool lastPirState = false; // Tracks PIR sensor changes // ===================================================== // SETUP — runs once when Arduino powers on // ===================================================== void setup() { // Set up pin directions pinMode(PIR_PIN, INPUT); // PIR is an input (reads sensor) pinMode(RELAY_PIN, OUTPUT); // Relay is an output (we control it) pinMode(BUZZER_PIN, OUTPUT); // Buzzer is an output // Safety first: make sure relay and UV are OFF at startup digitalWrite(RELAY_PIN, HIGH); // HIGH = relay OFF (active-low relay) // Connect servo motor and move to open position uvDoor.attach(SERVO_PIN); uvDoor.write(DOOR_OPEN); // Start the LCD display lcd.init(); lcd.backlight(); // Turn on the backlight // Start Serial Monitor for debugging Serial.begin(9600); Serial.println("👟 Smart Shoe Rack starting up..."); // Show startup animation on LCD showStartupScreen(); } // ===================================================== // LOOP — runs forever after setup // ===================================================== void loop() { // Read the PIR sensor (HIGH = motion detected!) bool pirTriggered = digitalRead(PIR_PIN) == HIGH; // What should we do based on current state? switch (currentState) { case STATE_IDLE: // Waiting for shoes... check if PIR sees something if (pirTriggered && !lastPirState) { // New detection! Shoes just placed! Serial.println("👟 Shoes detected! Starting UV sanitization..."); delay(1500); // Wait 1.5s for shoes to settle properly startSanitizing(); } break; case STATE_SANITIZING: // Check if UV time is finished if (millis() - sanitizeStartTime >= UV_DURATION_MS) { Serial.println("✅ UV cycle complete!"); finishSanitizing(); } else { // Still sanitizing — show a live countdown on LCD unsigned long elapsed = millis() - sanitizeStartTime; int secondsLeft = (UV_DURATION_MS - elapsed) / 1000; updateCountdown(secondsLeft); } break; case STATE_DONE: // Stay in DONE state for 4 seconds, then return to IDLE delay(4000); returnToIdle(); break; } lastPirState = pirTriggered; // Remember PIR state for next loop delay(200); // Small pause to avoid loop running too fast } // ===================================================== // START SANITIZING — UV on, door closes, LCD updates // ===================================================== void startSanitizing() { currentState = STATE_SANITIZING; sanitizeStartTime = millis(); // Record the start time // Close the UV chamber door (safety!) uvDoor.write(DOOR_CLOSED); delay(600); // Wait for door to finish moving // Turn on the UV LEDs via relay // LOW = relay ON (active-low module) digitalWrite(RELAY_PIN, LOW); Serial.println("🔵 UV LEDs activated!"); // Update the LCD display lcd.clear(); lcd.setCursor(0, 0); lcd.print(" UV Sanitizing "); lcd.setCursor(0, 1); lcd.print(" Please wait..."); } // ===================================================== // UPDATE COUNTDOWN — Shows seconds remaining on LCD // ===================================================== void updateCountdown(int seconds) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Sanitizing... "); lcd.setCursor(0, 1); lcd.print("Done in: "); lcd.print(seconds); lcd.print(" sec "); } // ===================================================== // FINISH SANITIZING — UV off, buzzer beeps, LCD done // ===================================================== void finishSanitizing() { // Turn OFF the UV LEDs first — safety! digitalWrite(RELAY_PIN, HIGH); // HIGH = relay OFF Serial.println("⬛ UV LEDs OFF"); delay(300); // Open the door so shoes can be removed uvDoor.write(DOOR_OPEN); delay(600); // Play 3 celebratory beeps! 🎉 for (int i = 0; i < 3; i++) { tone(BUZZER_PIN, 1000, 200); // 1000 Hz tone for 200ms delay(350); } // Play a longer final beep tone(BUZZER_PIN, 1500, 500); // Show success message on LCD lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Shoes are Clean"); lcd.setCursor(0, 1); lcd.print(" 99% Germ Free!"); Serial.println("✅ Shoes sanitized! 99% germ free! 🎉"); currentState = STATE_DONE; } // ===================================================== // RETURN TO IDLE — Ready for the next pair of shoes! // ===================================================== void returnToIdle() { currentState = STATE_IDLE; lcd.clear(); lcd.setCursor(2, 0); lcd.print("Smart Shoe Rack"); lcd.setCursor(4, 1); lcd.print("Ready ✓"); Serial.println("💤 Back to idle — waiting for shoes..."); } // ===================================================== // STARTUP SCREEN — Cool animation when powering on // ===================================================== void showStartupScreen() { lcd.clear(); lcd.setCursor(1, 0); lcd.print("Smart Shoe Rack"); lcd.setCursor(3, 1); lcd.print("UV Sanitizer"); delay(2000); // Scroll in a "loading" effect lcd.clear(); lcd.setCursor(0, 0); lcd.print("Initializing..."); for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print("#"); delay(80); } delay(500); lcd.clear(); lcd.setCursor(2, 0); lcd.print("Smart Shoe Rack"); lcd.setCursor(4, 1); lcd.print("Ready ✓"); Serial.println("✅ System ready!"); }
Safety Rules 🛡️
☢️ UV Light Safety — Read This First!
UV light at 395nm (the type used in this project) is relatively safe compared to UV-C (254nm used in hospitals), but you should NEVER look directly at a UV LED when it's lit. Always make sure the UV chamber door is closed before the sanitization cycle begins. The servo door in this project is specifically designed to prevent accidental UV exposure. Always test the project with adult supervision.
Adult Supervision
Always have a parent or teacher present when building and testing electronics projects
No Power While Wiring
Disconnect the battery every time you add, change, or adjust any wire in your circuit
Protect Your Eyes
Never look directly at UV LEDs when powered. Keep the chamber door closed during sanitization
Stay Dry
Keep all electronics far away from water and wet shoes. Let shoes dry fully before placing them in the rack
Hot Glue Care
The glue gun tip gets very hot. Let an adult use it, or wear thick gloves and work slowly
Keep Pets Away
Keep cats and dogs away from the UV sanitizer — their eyes are more sensitive to UV light than ours
Frequently Asked Questions ❓
Stuck? Check these common problems and fixes first before asking for help!
The LCD screen is blank after uploading code — what's wrong?
Turn the tiny blue potentiometer screw on the I2C backpack module (behind the LCD). Turn it slowly left or right until text appears. Also check that your I2C address in the code matches your LCD — try changing 0x27 to 0x3F in the code if the screen stays blank.
The PIR sensor keeps triggering randomly even with no shoes!
PIR sensors need 30–60 seconds to "settle" when first powered on — this is normal! Also check that no one is walking near the rack. Turn the sensitivity screw counterclockwise to reduce sensitivity. Make sure the sensor is not pointing toward a window with sunlight, as changing light can trigger it.
My UV LEDs aren't turning on even when the relay clicks!
Check if your relay is "active-low" or "active-high." Most relay modules are active-low, meaning LOW signal = relay ON. If your relay has an LED indicator, check that the LED lights up when Pin 8 goes LOW. Also verify all UV LEDs have resistors and are wired in the correct direction (longer leg = anode = positive).
The servo motor shakes and vibrates constantly — is it broken?
This usually means the Arduino's 5V pin doesn't have enough power for the servo. Try connecting the servo's power (red wire) directly to the 5V output of a phone charger or a small power bank instead. The Arduino's 5V pin can only supply about 400mA, but the servo may need up to 600mA when moving.
Does UV light at 395nm actually kill germs?
Great science question! UV-A light (395nm) has some antimicrobial effect, but UV-C (200–280nm) is much more effective and is used in hospitals. For this kids project, 395nm UV works as a fun demonstration of the concept and does kill some surface bacteria over 30+ seconds. For a science fair, this makes a great comparison experiment!
Can I use this project for my school science fair?
Absolutely — this makes a fantastic science fair project! You can extend it by testing actual bacteria growth (with a teacher's help), comparing 30s vs 60s vs 120s UV exposure, or adding a log of how many sanitization cycles the rack has completed. Document everything with photos for maximum marks!
Level Up Challenges 🚀
Did your shoe rack work perfectly? Awesome! Now try these exciting upgrades to make it even smarter!
Bluetooth App
Add HC-05 Bluetooth to start/stop sanitizing from your phone
Humidity Sensor
Add a DHT11 sensor to detect if shoes are wet before sanitizing
Cycle Counter
Use EEPROM to store and display how many times shoes were cleaned
Timer Schedule
Add an RTC module to sanitize automatically every night at bedtime

Comments
Post a Comment