loading

Step 2: Honor the CODE

Here's the code and a pseudo-schematic for the Arduino.  If you don't know what this stuff means, there are alot of self-starter web sights for Arduino.  I recommend Arduino.cc and Lady Ada.  Don't let all this technical garble stop you from playing with it.

CODE: (copy and paste this into your Arduino sketch.  It's not cheating)

/*This code will use a 'tunable' light sensor (photo-resistor) to do two things
when the light level is BELOW a certain threshold: Turn on some flashing LEDs,
and sound an alarm!!!

This code was compiled using source code from http://www.arduino.cc/en/Tutorial/Melody
(2005) D. Cuartielles for K3, and http://ardx.org/CODE09.

The COPY and PASTE functions were written sometime long ago by a really
lazy person...who I personally love.*/

//PhotoResistor Pin
int lightPin = 0;
//LED Pin
int ledPin = 9;
int ledPin2 =11;
int ledPin3 =13;
//Soundpin
int soundPin= 3;
//number of notes
int length = 7;
char notes[]= "cacacaa";
int beats[] = {1,1,1,1,1,1,1};
int tempo = 300;

void playTone(int tone, int duration) {
  for (long i = 0; i < duration * 1000L; i += tone * 2) {
    digitalWrite(soundPin, HIGH);
    delayMicroseconds(tone);
    digitalWrite(soundPin, LOW);
    delayMicroseconds(tone);
  }
}

void playNote(char note, int duration) {
  char names[] = { 'c', 'a' };
  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014 };

  // play the tone corresponding to the note name
  for (int i = 0; i < 8; i++) {
    if (names[i] == note) {
      playTone(tones[i], duration);
    }
  }
}


void setup()
{
  pinMode(ledPin, OUTPUT);
 pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT); //sets the led pin to output
  pinMode(soundPin, OUTPUT);
}

void loop()
{
 int threshold=500;       /*<---- THIS IS THE KEY FEATURE ! ! ! */

    while (analogRead(lightPin)>threshold)

    {
    for (int i = 0; i < length; i++) {
    if (notes[i] == ' ') {
      delay(beats[i] * tempo/3); // rest
    } else {
      playNote(notes[i], beats[i] * tempo*1.3);
    // pause between notes
    delay(tempo/2); }

     if (analogRead(lightPin)>threshold)
 {
  digitalWrite(ledPin,HIGH);
  digitalWrite(ledPin2,HIGH);
  digitalWrite(ledPin3,HIGH);
  delay (20);
  digitalWrite(ledPin,LOW);
  digitalWrite(ledPin2,LOW);
  digitalWrite(ledPin3,LOW);
  delay(20);
  digitalWrite(ledPin,HIGH);
  digitalWrite(ledPin2,HIGH);
  digitalWrite(ledPin3,HIGH);
  delay (20);
  digitalWrite(ledPin,LOW);
  digitalWrite(ledPin2,LOW);
  digitalWrite(ledPin3,LOW);
  delay(20);
  digitalWrite(ledPin,HIGH);
  digitalWrite(ledPin2,HIGH);
  digitalWrite(ledPin3,HIGH);
  delay (20);
  digitalWrite(ledPin,LOW);
  digitalWrite(ledPin2,LOW);
  digitalWrite(ledPin3 ,LOW);
  delay(20);

 }else{

  digitalWrite(ledPin, LOW); 
 }
    } 
  }
}


:END CODE

The trick in this code is to use the "threshold" to tune the light sensor for the local conditions.  If you get everything else to work on your work bench, remember to anticipate adjusting the threshold in ANY other lighting condition.

Also, the second image show's a MESS of wires and the BREAD BOARD.  We used the BREAD BOARD because it's a quick way to build a circuit AND , because we could use the TACTILE SWITCH to turn on/off the signals from the ARDUINO when the dishwasher door was closed/open.  In other words, we didn't have to write some code for the switch to enter the system.  The switch just connected power from the ARDUINO to the BREAD BOARD when the door closed.  It'll make more sense in a minute.




I note that the dishwasher in your video only has one water spray at the very bottom, meaning that large objects are always going interfere with the top rack. <br><br>In Oz, I have never seen such a machine before. All machines I have ever used and/or observed have a second spray between the two baskets so that that the upper rack gets its fair share of water and soap, and in my particular machine(s) it is not a wise move to put plastic cups in the lower rack---the force of water will blast them out of place and they bounce around everywhere until they stick like a spanner in the works.
You're right! It isn't a matter of every dishwasher. The part of the story we didn't include that perhaps we should, is that college housing usually means the cheapest bidder gets their appliances in the door. So, while I imagine some dishwashers available in the States have the features you're mentioning, for student housing (i.e. my housing) you don't get the best, you get the cheapest.<br><br>I think that speaks to a general American malaise anyway. We buy cheap stuff that we care nothing about and then throw it away. Whereas, elsewhere, it' may be more common to make things that lasts and that you love because it get's you thru so many...whatevers. <br><br>Thats part of the fun of the DIY movement, I think. One understated goal is to increase the value we place in everyday things by customizing them.<br><br>You see, hackers, are really sentimental sweet hearts at the end of the day.<br><br>Treknology! Watch out for kangaroos, my friend!
Australia has equally a growing sloppy disposable-attitude, however as our post-industrialization is far more recent than yours, we still have higher quality standards, although they are rapidly dropping.<br><br>When it comes to kangaroos, they're damn tasty!
Aww, that stinks, the music really makes the video
PS Dear Sir Richard Branson, I would like to fly to outer space with you, please.<br><br>Cheers,<br><br>ZJW
VIDEO! For those of you having copywrite issues with Boo-tube, try the link underneath the video panel. I think that is free from the prying eyes of Sony or BMG or Virgin or whomever. It's not like we're getting rich off the song, but I don't want to blow my opportunity to fly to outer space with Richard Branson..uh..sorry..<br>SIR Richard Branson. Enjoy!
Sorry gang. I'll try to get a copy w/o that particular audio and post it up.
no music on the video please can`t watch because of copyright issues
me neither :(
Here's my engineering solution: calculate rent difference between room in house and one-bedroom apartment, then compare to cost and time of electronics project adjusted by 'expected value' of it actually fixing others' behavior.<br><br>I live in a 1-bedroom apartment now =)<br><br>For those without the financial flexibility, maybe you should institute a dishwasher-loading quiz as part of your housemate interview. I'm sure you wouldn't scare anyone away. (To save time, maybe there could be a pre-screening exam involving dryer lint and shoe removal?)
It's cool to see that people actually have training programs for this problem. And more so that the thing in common is BEHAVIOR adjustment. That's the hardest thing to do, for me. <br><br>It took the GUI on my Prius dashboard (cool cred = sinking sound) to make me actually change the way I drive. I had to see a COMPARISON GRAPH!!! of my fuel milage to make me adjust my behavior. What did it for me was making it PLAY. My wife and I compete to see who charts highest. Otherwise the only thing I'm thinking about is getting where I'm going ASAP. <br><br>One thing we tried to do was make the alarm a game to play...<br><br>SHOUT OUT to 'mgalyean': Makers are OFTEN trading one problem for another. And to paraphrase my friend John Marshall, without physical tools and the ability to use them, my broken computer remains useless!
Theseus only had a ball of string.
It is so funny what people will do to stop the clean verses dirty dishwater! The solution is very simple and only requires one rule to follow: when you empty the dishwasher, put soap in the cup and close the soap cup door! That's it!!! Whenever you open the dishwasher door and there is soap in the cup - dishes are dirty! Whenever you open the dishwasher door and there is NO soap in the cup - dishes are clean!
I have been telling my wife this forever but, I can't get her to conform.<br>
Agreed. The trend to ignoring simple behavior solutions in favor of techno-bandaid$, or to put another way, the effort involved in educating wetware in favor of making stuff &quot;idiot proof&quot; has gone too far to the dark side, imho. At this rate we'll be bowing down to Skynet and/or the Cylons in record time, ha ha. Still, I don't think that is what the author(s) are after; they are just having fun. It is always fun to see what can be done with stuff. I do think the makers are just trading one problem for another. Instead of difficulties getting roommates to load the dishwasher correctly, now they will have difficulties getting roommates to not break the sensors and trying to train them how to work &quot;with&quot; instead of &quot;against&quot; the cool, but unappreciated, upgrades to the dishwasher. Raise your hands if you know what I mean. And when something does break in the &quot;idiot-proof&quot; circuit (usually because of rough handling or misuse) who has to fix it? Not the &quot;idiots&quot;,that is for certain. Anyway, its all good as long as it is educational from one or more viewpoints.
Very nice, though there's a key ingredient missing: a really, really rubbish dishwasher!! I've lived in a lot of really badly furnished flats with a lot of rubbish dishwashers but I've never seen one that doesn't have a separate spinning jet for the cups!<br><br>Still, as I said - very nice ;)
Really no kidding, I'm thinking that's the main reason that the dishes are coming out not fully clean ~ I literally have never seen that.<br><br>That said, I hate to be a spoil sport, but I can't endorse placing wooden dowels in a dishwasher. I don't even allow my wooden spoons in there for one cycle. That makes no sense, sorry they will disentigrate. Are there plastic dowels that would work instead?
No I hadn't. But that's a good idea. How? Would I map the threshold onto the pot value?<br><br>Got some code for that?
Did you consider a trim pot or rotary encoder to adjust the 'int threshold' on the fly?
How about a new alarm: If , after a cycle runs and someone pulls out ONE dish but not the others (and in lieu of sdelucia's great magnet idea, which sometimes works) the dishwasher, sensing the change in dish weight (delta dish?), takes a picture of the culprit and emails it to everyone in the house. DIshwasher security camera!
what would be great is a techno-easy method of determining whether the stuff in the dishwasher is clean or dirty..
That is easy. Get a flat magnet, color one side green and print dirty on it and color the other side red and print clean on it. Flip it to red when you turn it on. Flip it to green when you empty it.<br>
Wonder if you could just use the analog pin of the pc joystick port and tweet the status?

About This Instructable