Go Down

Topic: RFID logging clothes dryer (Read 1 time) previous topic - next topic

alekoy

Jul 19, 2009, 04:50 am Last Edit: Jul 19, 2009, 04:56 am by alekoy Reason: 1
Hi.
Not shure if this is the correct forum, but here goes nothing.

A friend of mine confronted me with a problem he has.
He rents out some appartments and they have a common clothes washer and dryer, and he has a suspicion that the dryer is used all the time.
the dryer has 4 users.

so what he wants is to be able to log the usage of the dryer, so that if one of the user uses it excessively he can give them a warning or make them pay. :P

So what I figured is that this would be a nice project for me to learn to use a arduino.

What I have planned is:
The front panel of the dryer gets 4 extra LEDs, one for each user.
the users LED will light up once he/she has identyfied himself by holding a RFID-tag in the same area as the LEDs, this LED will blink when the dryer is finished, and keep blinking until the next user has "loged in", so that if he/se has forgot something, or made a mess, the last user is easily identifyed.

next, when the user is logged in, a relay that is mounted in series with the start-button on the dryer, makes contact, so the dryer can be started, and when the dryer is finished another relay will give a signal back to the arduino.

the thing that I need the most help/input on is how to store/read the information about the number of usages.

one option is to have a 5th. RFID tag that when used makes the LED for each user blink out the number of times he/she has used it since last time the 5th. tag was read.
I guess this is the cheapest and easiest way to do this.
and I guess I need a SD-card or something to save the information, in case there is a loss of power. (or does the arduino remember stuff anyways?)

another way would be to mont a ethernet-shield and a web page where the usage is listed, and maybe have a password protected counter reset.
the problem is that this requires a ethernet-cable to be installed.....

Need to know what I should buy so I can get started on this

Any input would be appreciated  :D

Oracle

It sounds quite doable.  To retrieve the data, you can plug a laptop into the Arduino and send a command that your sketch will recognize to dump all the data to your laptop, then cut and paste it from the terminal screen to a text file.

The ATmega328 version of Arduino has 1024 bytes of memory that can be saved when it loses power, if that's not enough you'll have to use an alternative like a serial eeprom or SD card.

A residential dryer takes 30 amps at 230 volts, so make sure you use a suitable relay and make very, very sure you know what you're doing to deal with that kind of power.  It can be deadly.  And make sure your tenants can't unplug the dryer from your project and plug it directly to the wall outlet.

alekoy

Okidok,
so I buy the Duemilanove, then.

I am an electrician so I am not afraid to play around with the 230V, but the plan was to interrupt the start-button on the front of the dryer, so that the dryer acts like normal (you can put the clothes in, set the program) but it just won't start until the user logs in.

the data retrieval you mentioned is a good one, no possibility for a counting error. but maybe to difficult for my friend.

I am thinking about using the Parallax RFID-reader

Oracle

#3
Jul 19, 2009, 06:01 pm Last Edit: Jul 19, 2009, 06:02 pm by Oracle Reason: 1
The thing about Parallax is they start with prices several times too high and then never seem to improve their products or lower prices as technology evolves.

Consider this RF reader for 1/3rd the price: http://www.seeedstudio.com/depot/125khz-rfid-module-uart-p-171.html

He also sells a 5-pack of RFID tags for it for $2.50.

alekoy

thanks for the advice, I ordered som stuff from that seeedstudio-page now, progress reports will be posted when I get started.

DaveK

Looking forward to seeing this project progress, it's very similar to one I've considered doing, but have never gotten around to starting.

alekoy

#6
Jul 31, 2009, 02:57 am Last Edit: Jul 31, 2009, 12:03 pm by alekoy Reason: 1
I recieved the parts from seeed studio today, and feel that I'v got reasonably far with just a few minutes of experience with programming in something other than ladder (PLC-programming)

I found a code to read the ID of the RFID tags and started working on the main code.

trying to sort  out some issues with the reading now, will post results. ;)

alekoy

#7
Aug 02, 2009, 12:41 am Last Edit: Aug 02, 2009, 12:52 am by alekoy Reason: 1
I have built the hardware, and after some trial and erron, I'm starting to get the code working, the reading and identification of the tags is working, buzzer is beeping and leds are blinking  :D

Some pictures of the shield, with the coil for the reader temporary taped to the board, and user 2 logged in  :)


and the back of it, with some wires. ::)


the next bug to resolve is that after reading a tag, the software sort of locks up, and reports any tag that gets read to be the same ID as the first tag...

I will attach the code, so if anyone with more understanding of this can take a look at it  ;)
the code is based of THIS CODE
Code: [Select]
//RFID Clothes Dryer

#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3

SoftwareSerial mySerial= SoftwareSerial(rxPin, txPin);
int buzzPin =  5; //buzzer
int led1Pin =  6; //user 1
int led2Pin =  7; //user 2
int led3Pin =  8; //user 3
int led4Pin =  9; //user 4
int doorPin =  12; //doorswitch
int startPin =  13; //start connected to pin 13


boolean open = true; // default start up is to assume the lock is open
int val = 0;
char code[12];
int bytesread = 0;
int pulse, switchVal;

//RFID tags  
char tag1[13] = "390051A9ED2"; //user1
char tag2[13] = "39003A80D45"; //user2
char tag3[13] = "3900315FECB"; //user3
char tag4[13] = "390031587D2"; //user4
char tag5[13] = "24004D4AF5D"; //delete
char tag6[13] = "24004D31174"; //read


void LED(int state){
   
switch (state){
case 1: //user 1 LED on
digitalWrite(led1Pin, HIGH);
break;
case 2: //user 2 LED on
digitalWrite(led2Pin, HIGH);
break;
case 3: //user 3 LED on
digitalWrite(led3Pin, HIGH);
break;
case 4: //user 4 LED on
digitalWrite(led4Pin, HIGH);
break;
case 5: //user 1 LED blink
digitalWrite(led1Pin, HIGH);
delay(500);
digitalWrite(led1Pin, LOW);
delay(500);
break;
case 6: //user 2 LED blink
digitalWrite(led2Pin, HIGH);
delay(500);
digitalWrite(led2Pin, LOW);
delay(500);
break;
case 7: //user 3 LED blink
digitalWrite(led3Pin, HIGH);
delay(500);
digitalWrite(led3Pin, LOW);
delay(500);
break;
case 8: //user 4 LED blink
digitalWrite(led4Pin, HIGH);
delay(500);
digitalWrite(led4Pin, LOW);
delay(500);
break;
case 9: //all LED blink
for (long i = 0; i < 2048 * 1; i++ )
{
  digitalWrite(led1Pin, HIGH);
 digitalWrite(led2Pin, HIGH);
  digitalWrite(led3Pin, HIGH);
   digitalWrite(led4Pin, HIGH);
delay(300);
digitalWrite(led1Pin, LOW);
 digitalWrite(led2Pin, LOW);
  digitalWrite(led3Pin, LOW);
   digitalWrite(led4Pin, LOW);
delay(300);
}
break;
break;
case 10: //all LED blink fast
for (long i = 0; i < 2048 * 1; i++ )
{
  digitalWrite(led1Pin, HIGH);
 digitalWrite(led2Pin, HIGH);
  digitalWrite(led3Pin, HIGH);
   digitalWrite(led4Pin, HIGH);
delay(150);
digitalWrite(led1Pin, LOW);
 digitalWrite(led2Pin, LOW);
  digitalWrite(led3Pin, LOW);
   digitalWrite(led4Pin, LOW);
delay(150);
}
break;
}
}
   
void user(int state){

  switch (state){
case 1: //user 1
beep(2);
LED(1);
Serial.print("User 1");
break;
case 2: //user 2
beep(2);
LED(2);
Serial.print("User 2");
break;
case 3: //user 3
beep(2);
LED(3);
Serial.print("User 3");
break;
case 4: //user 4
beep(2);
LED(4);
Serial.print("User 4");
break;
case 5: //delete
beep(2);
LED(9);
Serial.print("Delete");
break;
case 6: //read
beep(2);
Serial.print("Read");
break;
}
}

void beep(int state){

switch (state){
case 1: //long beep, bad tag
for (long i = 0; i < 2048 * 1; i++ )
{
   digitalWrite(buzzPin, HIGH);
   delayMicroseconds(244);
   digitalWrite(buzzPin, LOW);
   delayMicroseconds(244);
}
break;
case 2: //short beep, good tag
for (long i = 0; i < 1024 * 1; i++ )
{
  digitalWrite(buzzPin, HIGH);
   delayMicroseconds(122);
   digitalWrite(buzzPin, LOW);
   delayMicroseconds(122);
}
}
}

void setup() {
 
  Serial.begin(9600);
  mySerial.begin(9600);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode (buzzPin, OUTPUT);
  pinMode (led1Pin, OUTPUT);
  pinMode (led2Pin, OUTPUT);
  pinMode (led3Pin, OUTPUT);
  pinMode (led4Pin, OUTPUT);
  pinMode (doorPin, INPUT);
  pinMode (startPin, OUTPUT);
  }

 
boolean checkTag(char *tag){

for (int x=0;x<11;x++){
if( tag[x] != code[x]){
return false;
}
}
return true;
}

boolean findGoodTag(){
if (checkTag(tag1)){ user(1); return true;}
else if (checkTag(tag2)){ user(2); return true;}
else if (checkTag(tag3)){ user(3); return true;}
else if (checkTag(tag4)){ user(4); return true;}
else if (checkTag(tag5)){ user(5); return true;}
else if (checkTag(tag6)){ user(6); return true;}


else{
Serial.print("Bad tag: ");
Serial.println(code);
beep(1);
LED(10);
return false;
}}

void loop(){

SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);
RFID.begin(9600);

if((val = RFID.read()) == 11)
bytesread = 0;
while(bytesread<11)
{ // read 12 digit code
val = RFID.read();
if((val == 11)||(val == 12))
{ // if header or stop bytes before the 11 digit reading
break; // stop reading
}
code[bytesread] = val; // add the digit
bytesread++; // ready to read next digit
}



if((bytesread == 11) && (findGoodTag()))
{ // if 11 digit read is complete
delay(500);
}}

bill2009

software serial has always been a good source of lockups for me...

renebar85

Sorry if this question strays a bit from the intended target, but I recently purchased this model of RFID reader from the Seeeduino store and tried a reading the 125kHz key chains and cards (also available from the Seeeduino store) but was only able to read 0xFF values using bot the SerialHardware objects and the Serial object.

I was curious if anyone else has seen this behavior or if perhaps this is the sign of a damaged unit.

Thanks in advance!

Ribster

Your friend better be careful or those of us with the means to produce rfid cards might just track this washer down and wash our clothes until it breaks.   That or sell them to the neighbors...

Nice project!  

Go Up