Smart Laundry Monitoring System
Build a robot that tells you when your clothes are done washing — no more soggy laundry forgotten inside the machine!
🎯 What Will We Build?
Have you ever forgotten wet clothes sitting inside the washing machine for hours? Icky, right! 🤢 In this project, you'll build a Smart Laundry Monitoring System — a cool gadget that sits on your washing machine, feels its vibrations, and alerts you when the wash cycle is over!
You'll use an Arduino Uno, a vibration sensor, a buzzer, and two LEDs to create a smart alert system. When the machine is washing, a green LED blinks. When it stops (laundry done!), a red LED lights up and the buzzer beeps — time to grab your fresh clothes! 🎉
🧠 What You'll Learn
🛒 Parts List & Cost
⚙️ How Does It Work?
Follow the signal from shaky machine all the way to your alert — it's like a relay race for electricity!
🔌 Circuit Diagram
📋 Pin Connection Table
| Component | Component Pin | Arduino Pin | Wire Colour |
|---|---|---|---|
| SW-420 Vibration Sensor | VCC | 5V | 🔴 Red |
| SW-420 Vibration Sensor | GND | GND | ⚫ Black |
| SW-420 Vibration Sensor | OUT | D2 | 🟡 Yellow |
| Green LED (+ long leg) | Anode (+) | D7 via 220Ω | 🟢 Green |
| Green LED (– short leg) | Cathode (–) | GND | ⚫ Black |
| Red LED (+ long leg) | Anode (+) | D8 via 220Ω | 🔴 Red |
| Red LED (– short leg) | Cathode (–) | GND | ⚫ Black |
| Active Buzzer | + (positive) | D9 | 🟣 Purple |
| Active Buzzer | – (negative) | GND | ⚫ Black |
🔧 Step-by-Step Build Guide
Place your breadboard on a flat surface. Connect the 5V pin of your Arduino to the red (+) power rail on the breadboard using a red jumper wire. Connect the GND pin to the blue (−) rail with a black wire. This gives power to all your components easily!
Push the SW-420 module's 3 pins into the breadboard. Connect:
- VCC → red (+) power rail
- GND → blue (−) power rail
- OUT → Arduino digital pin D2
The little blue potentiometer screw on the sensor adjusts sensitivity — leave it in the middle for now.
LEDs have two legs — the longer leg (+) is the anode and the shorter leg (–) is the cathode. Insert the green LED into the breadboard. Connect:
- Long leg (+) → one end of a 220Ω resistor → Arduino D7
- Short leg (–) → blue GND rail
Repeat the same process for the red LED:
- Long leg (+) → 220Ω resistor → Arduino D8
- Short leg (–) → GND rail
Place it a few rows away from the green LED so wires don't tangle.
An active buzzer has a built-in oscillator — it just needs power to beep! Look for the + marking on top:
- Positive (+) pin → Arduino D9
- Negative (–) pin → GND rail
Plug your Arduino into your computer using the USB cable. Open the Arduino IDE (download free from arduino.cc). Go to Tools → Board → Arduino Uno and select the correct Port. You're ready to code!
Copy the full Arduino sketch from the code section below. Paste it into the Arduino IDE. Click the Upload (→) button. Wait for "Done uploading" to appear. Your circuit is now alive! 🎉
Tap or shake the vibration sensor gently — the green LED should blink! Stop tapping and wait 30 seconds — the red LED lights up and the buzzer beeps! Place the device on top of a washing machine during a cycle to see the real magic!
💻 Full Arduino Code
Copy this sketch into your Arduino IDE and upload it. Every line has a comment explaining what it does — great for learning!
// ============================================================ // Smart Laundry Monitoring System // MakeMindz.com — Build Cool Robots! // Detects washing machine vibration and alerts when done. // ============================================================ // ── PIN DEFINITIONS ────────────────────────────────────────── const int VIBRATION_PIN = 2; // SW-420 OUT → D2 const int GREEN_LED = 7; // Green LED → D7 const int RED_LED = 8; // Red LED → D8 const int BUZZER = 9; // Buzzer → D9 // ── TIMING SETTINGS ────────────────────────────────────────── // How long (ms) of silence = laundry done const unsigned long SILENCE_THRESHOLD = 30000; // 30 seconds // How long the buzzer beeps when alerting const unsigned long BUZZER_DURATION = 3000; // 3 seconds // ── STATE VARIABLES ────────────────────────────────────────── bool machineWasRunning = false; // Was the machine ever detected? bool alertGiven = false; // Did we already alert the user? unsigned long lastVibrateTime = 0; // When was the last vibration? unsigned long alertStartTime = 0; // When did the alert start? // ── SETUP: runs ONCE when Arduino powers on ─────────────────── void setup() { pinMode(VIBRATION_PIN, INPUT); // Sensor sends data IN pinMode(GREEN_LED, OUTPUT); // LED goes OUT pinMode(RED_LED, OUTPUT); // LED goes OUT pinMode(BUZZER, OUTPUT); // Buzzer goes OUT Serial.begin(9600); // Start serial monitor for debugging Serial.println("MakeMindz Laundry Monitor Ready! 🧺"); // Quick startup blink to confirm circuit is working startupBlink(); } // ── LOOP: runs FOREVER ──────────────────────────────────────── void loop() { int vibration = digitalRead(VIBRATION_PIN); // Read sensor (0 or 1) unsigned long now = millis(); // Current time in ms // ── VIBRATION DETECTED (machine is running) ─────────────── if (vibration == LOW) { // SW-420 gives LOW when vibrating lastVibrateTime = now; // Reset the silence timer machineWasRunning = true; // Machine has run at least once alertGiven = false; // Reset alert for next cycle // Blink green LED to show washing in progress digitalWrite(GREEN_LED, HIGH); delay(200); digitalWrite(GREEN_LED, LOW); delay(200); digitalWrite(RED_LED, LOW); // Keep red LED off digitalWrite(BUZZER, LOW); // Buzzer off Serial.println("🌀 Washing in progress..."); } // ── NO VIBRATION ───────────────────────────────────────── else { digitalWrite(GREEN_LED, LOW); // Green LED off // Check if machine was running and silence has lasted 30s if (machineWasRunning && !alertGiven && (now - lastVibrateTime >= SILENCE_THRESHOLD)) { // ── LAUNDRY DONE! Alert! ───────────────────────────── Serial.println("✅ LAUNDRY DONE! Go get your clothes!"); alertGiven = true; // Don't alert again until next cycle alertStartTime = now; digitalWrite(RED_LED, HIGH); // Red LED on digitalWrite(BUZZER, HIGH); // Buzzer on } // Turn off buzzer after BUZZER_DURATION, keep red LED on if (alertGiven && (now - alertStartTime >= BUZZER_DURATION)) { digitalWrite(BUZZER, LOW); // Stop buzzing after 3 seconds // Red LED stays on until machine is used again } } } // ── STARTUP BLINK: flashes both LEDs 3 times ───────────────── void startupBlink() { for (int i = 0; i < 3; i++) { digitalWrite(GREEN_LED, HIGH); digitalWrite(RED_LED, HIGH); delay(200); digitalWrite(GREEN_LED, LOW); digitalWrite(RED_LED, LOW); delay(200); } Serial.println("✅ System Ready!"); }
🧩 Code Explained (Simply!)
At the top we tell Arduino which pins each component is connected to. We also set SILENCE_THRESHOLD = 30000 — that's 30,000 milliseconds = 30 seconds of silence before we call laundry "done".
delay(30000) would freeze the Arduino for 30 seconds — it couldn't check the sensor during that time! Instead, we use millis() which is like a stopwatch. We record WHEN the last vibration happened and keep checking if 30 seconds have passed. The Arduino stays responsive the whole time!
The SW-420 sends a LOW (0V) signal when it detects movement. This might seem backwards! It's called "active low" logic — very common in electronics. Our code checks for vibration == LOW to detect the machine running.
🧠 Quick Quiz — Test Yourself!
❓ Why do we use a 220Ω resistor with the LEDs?
❓ What does the SW-420 sensor detect?
🏆 Upgrade Challenges
Finished the basic build? Try these fun upgrades to level up your project!
digitalWrite(BUZZER, HIGH/LOW).SILENCE_THRESHOLD from 30 seconds to 10 seconds and test it. What happens if you set it too low?🛠️ Troubleshooting Guide
Check your wiring! Make sure the sensor's OUT pin goes to D2. Open the Serial Monitor — do you see any messages? If not, the sensor may not be getting power. Check VCC and GND connections.
The sensor sensitivity might be too high. Use a small screwdriver to turn the blue potentiometer on the SW-420 module clockwise to reduce sensitivity.
Make sure you're using an active buzzer (not passive). Check if the + and – pins are correct. Test by writing a quick code: digitalWrite(9, HIGH); delay(1000); digitalWrite(9, LOW);
Make sure SILENCE_THRESHOLD is set to 30000 (not 300 or 30). Also check that lastVibrateTime is being updated correctly when vibration is detected.

Comments
Post a Comment