Laundry Detector
Evelyn Bang
Overview
The Laundry Detector checks to see if laundry is done at any given moment. It has three inputs: time, distance, and acceleration. These three factors into the open state of the laundry door, the movement of the machine itself, and how long it has been since it last moved.
CC:
"Hi, my name is Evelyn Bang, and this is my project, Laundry Detector. The Laundry Detector is a personalized project that was a response to my washing machine not making any sound or light indicator whenever it was finished. As a result, I wanted to make something that would let me know when my laundry needed to be put into the dryer. As shown in this video, the detector is illuminating green for when it is available to load in laundry, red for when it is washing some laundry, and yellow when it has finished the laundry which is coupled with a buzzer that tells me that the laundry has finished."
Extra Notes:
I tried thinking about different ways to approach this project, which ended up being narrowed down to two options, which were to use a movement detector for the movement of the machine itself or a humidity sensor for the water inside of the washing machine. I concluded that using a humidity sensor would be difficult especially if it could be knocked around with the laundry inside, so I decided to go ahead with the movement detector, which was imputed through a 3-axis accelerometer. This would detect the acceleration of the machine to see if it is moving or not. Another input that I had to use was an optical proximity sensor, which would check to see if the machine’s door was open or not as a way to show that the machine is ready for the next load.
Process
This is the drawing of the box container before going into Fusion360 as a visual reference. I made sure to measure my laundry machine for particular angles and widths that would limit the size of the container.
Here is the beginning of what my 3D model looked like. It took around 3 restarts to get the general shape and pieces right, especially because of there been an angular piece on one of the sides.
After finishing the 3D model and making sure it would fit into the corner of my washing machine. This is the laser cutting process. I had to reprint one of the pieces, since it didn't finger joint as side during the modelling process.
Here is the comparison of the assembled container and the virtual version. It turned out that I accidentally 3D modelled an inverse version of what I wanted to have, but it turned out that my sketches that I picked out in order to print on the laser cutter made it turn back into the right version.
After super gluing the pieces together, I placed in the pieces into the box and taped some of the pieces down in order to not have any loose pieces.
Here is another angle of the same object as on the left. I did have some trouble at first with coding the timing of the buzzer and LEDs, but after trial and error, it responded the way that I intented it to.
Discussion
During class critique, I got two main notes for my prototype that addressed my two concerns. First, I was wondering how I should check to see if the washing machine was still in progress while the water was filling up. Since this process doesn't have any motion being sent to the 3-Axis Accelerometer, I had to implement code that would compensate for those sections of silence by setting up a timer for how long it takes for the machine to fill up. One note for this process, though, is that there is an extra five minutes at the end of the washing machine, which I deemed not that big of a deal personally. Second, I also had trouble with is the angular joints. I do remember being told that angled joints are finnicky, so it should be approached carefully. Consequently, I tried to logically think out where the alignment of the pieces would line up and which side of the 3D model piece needed to be turned into a file for the laser cutter. This worked a lot more smoother than I thought it would, which I am very thankful for.
I am very happy with how the project turned out, especially with the code and design finalizations. The color matches very well with my washing machine as planned, and the code runs smoothly after a lot of testing. I did feel somewhat frustrated with the code in the middle, which made me keep going to the drawing board to lay out the pseudocode of the program multiple times.
It was fun going through the process of realizing that I was doing something wrong and starting over with whatever part of the project I was working on. I had to constantly look back and forth at the bigger picture and then the smaller details, which was also very intriguing. If I were to do something different next time, I would definitely put labels on the wires themselves to see which pin on the Arduino they go to, since the components are snug into the container box, making it difficult to see which wire goes with which part.
If I were to do another iteration of this project, I would definitely try 3D printing the case instead of laser cutting it. That would allow smoother edges and an easier process of making movable joints for the opening of the container into the electronics. I could also try to design it such that it hang on the laundry machine without any extra help of duct tape or other adhesives.
Technical Information
/*
Laundry Detector
Evelyn Bang
Laundry Detector uses a 3-Axis Accelerometer, Optical Proximity Sensor, Active Buzzer, 3 LEDs, and a Battery in order to check to see if the laundry has finished. This project is to address a personal problem in which the laundry washer would not produce any indication that it was finished washing except by an absence of sound, which is difficult to notice.
PIN MAPPING:
pin | mode | description
--------- 3-Axis Accelerometer ---------
A1 | INPUT | X-axis motion detector pin
A2 | INPUT | Y-axis motion detector pin
------- Optical Proximity Sensor -------
A0 | INPUT | distance detector pin
---------------- Buzzer ----------------
8 | OUTPUT | buzzer pin
----------------- LED -----------------
9 | OUTPUT | red LED (washing currently) | closed lid + moving
10 | OUTPUT | yellow LED (washer is finished) | closed lid + not moving
11 | OUTPUT | green LED (washer is empty) | open lid + not moving - don't even need to detect movement (just check if open)
--------------- Battery ---------------
power | INPUT | powering the Arduino without laptop with a battery
NOTE:
- Z-axis Acceleration not needed because not moving up and down
*/
// GLOBAL VARIABLES
// 3-Axis Accelerometer (movement detection)
const int xMovePin = A1;
const int yMovePin = A2;
int moveLast = 0; // Last time moved
int xPos = 0;
int yPos = 0;
int xPrev;
int yPrev;
bool moving;
// Optical Proximity Sensor (distance/lid open state)
const int distPin = A0;
bool lidClosed;
// Active Buzzer
const int buzzerPin = 8;
// LED
const int redLED = 9;
const int yellowLED = 10;
const int greenLED = 11;
// Other Vars
unsigned int accelWaitTime = 300000; // 5 min timer
unsigned int prevTimeMove = 0;
// SET UP
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(distPin, INPUT);
pinMode(xMovePin, INPUT);
pinMode(yMovePin, INPUT);
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
moving = false;
lidClosed = false;
Serial.begin(9600);
}
// LOOP
void loop() {
/*
--------------------------------- Lid State ---------------------------------
*/
// check if lid is open
int dist = analogRead(distPin);
if (dist > 250) {
//check unit of measurement
lidClosed = true;
} else {
lidClosed = false;
}
/*
---------------------------- 3-Axic Acelerometer ----------------------------
*/
// Check to see if moving
// X-axis aceleration difference
xPrev = xPos;
xPos = analogRead(xMovePin);
int xDiff = abs(xPrev - xPos);
// Y-axis aceleration difference
yPrev = yPos;
yPos = analogRead(yMovePin);
int yDiff = abs(yPrev - yPos);
// Check which one is greater
int greater = yDiff;
if (xDiff > greater) {
greater = xDiff;
}
// If moving then make moving true + update moved time
if (greater > 10) { // Accel greater than 10 => moving
prevTimeMove = millis();
moving = true;
}
// If not moved after 5 min, then moving = false
unsigned int sinceLast = millis() - prevTimeMove;
if (sinceLast >= accelWaitTime) {
moving = false;
/*
-------------------------------- LED & Buzzer --------------------------------
*/
// FINISHED AND READY TO DUMP
// Yellow LED: Check if not moving + closed
if (lidClosed) {
digitalWrite(greenLED, LOW);
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, HIGH);
// Sound on
digitalWrite(buzzerPin, HIGH);
}
// If moved within 5 min
} else {
/*
-------------------------------- LED & Buzzer --------------------------------
*/
// STILL WASHING
// Red LED: Check if moving + closed
if (lidClosed) {
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
digitalWrite(yellowLED, LOW);
// Sound off
digitalWrite(buzzerPin, LOW);
}
}
/*
-------------------------------- LED & Buzzer --------------------------------
*/
// READY TO LOAD
// Green LED: Check if not moving + open
if (moving == false && lidClosed == false) {
digitalWrite(greenLED, HIGH);
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, LOW);
// Sound off
digitalWrite(buzzerPin, LOW);
}
}