
This is an attendance equipment made by Arduino & W5100,it could judge which card swiping is effective and post the result onto the Internet.
Arduino UNO Control Board +Ethernet W5100 Network Expanding Board+RDM6300 FRID Card-Reading Model+RGB Three Colours LED Model(LED1,LED2)
+Passive Buzzer Module+Switch Model+Variable Resistors
When press the switch once,LED1 will change once between red and green.
Potentiometer rotates to a different position,then read the value of analog quantity 0—1023.
When swiping card, FRID will gain the data,and then connect to the Internet posting the state of the staff and the last 6 numbers and potentiometer’s analog quantity to it.
http://www.ecomplus.cn/ecomplus/ … de=FF0001&flag=1023
If URL visit successfully, the website will return a data.
LED2 and buzzer’s void mean the different state of swiping card.
If the red led lighting on,it shows that waiting the Network. Client disconnects with Server.
If the green led lighting on, it means swiping card successfully.You can swipe card next time.
If the blue led lighting on, it means the card swiped isn’t a right card.You may swipe card again.
If the yellow led lighting on, it means the system makes mistakes.
If the white led lighting on,it meas swiping card failed.You have to swipe card again
If the led doesn’t lighting on, restart it and if it still keep dark, change a new one.
#include <SPI.h> #include <Ethernet.h> #include <avr/wdt.h> byte mac[] = {0xDE, 0xAD, 0xBE, 0xFF, 0x00, 0x01}; String flag_mac="FF0001"; IPAddress ip(192, 168, 0, 10); char serverName[] = "140.206.71.174"; String urlbase = "GET /ecomplus/pub/dgm.cfc?method=kaoqing&cardid="; int in = 3; int out = 4; int buzzer = 5; int inout = 6; int RPin = 7; int GPin = 8; int BPin = 9; int PotPin = 5; int analog = 0; int value = 5; int in_out=1; int inout_c=1; int ethernet=0; int count=0; boolean InOut; int flag=0; int RX_Flag=0; int recieve=0; char Code[14]; long Num=0; String back ; String urlpath=""; EthernetClient client; void yedon(void) { digitalWrite(GPin,HIGH); digitalWrite(BPin,LOW); digitalWrite(RPin,HIGH); } void greenon(void) { digitalWrite(RPin,LOW); digitalWrite(BPin,LOW); digitalWrite(GPin,HIGH); } void blueon(void) { digitalWrite(RPin,LOW); digitalWrite(GPin,LOW); digitalWrite(BPin,HIGH); } void RGBoff(void) { digitalWrite(RPin,LOW); digitalWrite(BPin,LOW); digitalWrite(GPin,LOW); } void greenblue(void) { digitalWrite(GPin,HIGH); digitalWrite(BPin,HIGH); delay(10); digitalWrite(GPin,LOW); digitalWrite(BPin,LOW); delay(10); } void Read_ID(void) { int i=0; char temp; for(i=0;(Serial.available()>0);i++) { temp=Serial.read(); delay(2); if(temp==0X02) {flag=1;i=0;RX_Flag=0;} if(flag==1) { if(temp==0X03) { flag=0; if(i==13){RGBoff();RX_Flag=1;greenblue();recieve=0;sound();} else RX_Flag=0; break; } Code=temp; } } flag=0; } void CharToNum(void) { int i; for(i=5;i<11;i++) { Num<<=4; if(Code>64) Num+=((Code)-55); else Num+=((Code)-48); } } void ReadInOut(void) { if(!(digitalRead(inout))&&inout_c) { delay(50); if(!(digitalRead(inout))&&inout_c) { in_out++;inout_c=0;if(in_out>1)in_out=0;} } if(digitalRead(inout)) { inout_c=1; } if(in_out) { InOut=1; digitalWrite(in,HIGH); digitalWrite(out,LOW); } else { InOut=0; digitalWrite(in,LOW); digitalWrite(out,HIGH); } } void sound(void) { unsigned char i; for(i=0;i<100;i++) { digitalWrite(buzzer,HIGH); delayMicroseconds(300); digitalWrite(buzzer,LOW); delayMicroseconds(300); } } void setup() { pinMode(buzzer,OUTPUT); pinMode (RPin,OUTPUT); pinMode (GPin,OUTPUT); pinMode (BPin,OUTPUT); pinMode (InOut,INPUT); pinMode (in,OUTPUT); pinMode (out,OUTPUT); Serial.begin(9600); while (!Serial) {;} Ethernet.begin(mac,ip); ReadInOut(); RX_Flag=0; } void loop() { digitalWrite(RPin,HIGH); }
Source: http://www.arduino.cn/forum.php?mod=viewthread&tid=7820(in Chinese)
COMMENTS