Washing Machine Buzzer

Sometimes you need to do things the hard way.  This is one of those cases.

A few months ago, our washing machine died.  This one was beyond my ability to fix, so we broke down and bought a new one.  The model we chose had a bunch of fancy features, but the one that was missing was the end-of-cycle alarm.  With our last washer, we had grown used to hearing a buzzer when the cycle ended.  Now the washer stops and we go about our day not considering the wet clothes sitting in the washing machine. 

Any do-it-yourselfer with any self respect would have no problems opening up the control panel and adding a buzzer to the exising “Cycle Finished” light.  My wife, however, doesn’t have that kind of faith in me, so I have to do things the hard way.  Here is the plan:

A photoresistor will be placed over the cycle finished light.  The value of this sensor will be fed into an Arduino Pro Mini.  This will read the status of the washing machine.  When the light turns on, the arduino will activate a 9 volt buzzer (one second on, one second off) for ten minutes.

Figure 1:  Circuit diagram

Figure 2: Arduino code

int buzzcount=0;
int ledstatus=0;
int buzzerpin=2;  // connect to npn base 
int sensorpin=0;  // connect to photoresistor (w/ pull-down)

// preferences ///////
int trigger=512;    //
int buzzlimit=300;  //
//////////////////////

void setup() {               
  pinMode(buzzerpin, OUTPUT);  
}

void loop() {
  setStatus();
  if(ledstatus==1){
    if(buzzcount<buzzlimit){
      buzz();
      buzzcount++;
    }
  }
}

void buzz(){
  digitalWrite(2, HIGH);
  delay(1000);
  digitalWrite(2, LOW);
  delay(1000);
}

void setStatus(){
  if(analogRead(sensorpin)>trigger){
    ledstatus=1;
  }else{
    ledstatus=0;
    buzzcount=0;  // reset to 0 when the lid is opened
  }
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: