The RFID Window Login requires the following items:

  • Parallax RFID reader (RFID Reader)
  • The files within this ZIP file – (here)
  • Arduino with USB cable
  • Arduino sketch, shown below
  1. Unpack the zipped files and then follow the instructions in the PDF labelled “Windows Login”
  2. Open the Arduino software and upload this sketch

Now use this sketch to find out what the RFID tag id is. Connect the RFID reader’s sout to pin 8 and the enable to pin 7.

// RFID reader for Arduino
#include <SoftwareSerial.h>
int val = 0;
char code[10];
int bytesread = 0;
#define rxPin 8
#define txPin 1
SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);


void setup() {
RFID.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
pinMode(7,OUTPUT); // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
digitalWrite(7, LOW); // Activate the RFID reader
}

void loop() {
if(RFID.available() > 0) {          // if data available from reader
if((val = RFID.read()) == 10) {   // check for header
bytesread = 0;
while(bytesread<10) {              // read 10 digit code
if( RFID.available() > 0) {
val = RFID.read();
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break;                       // stop reading
}
code[bytesread] = val;         // add the digit
bytesread++;                   // ready to read next digit
}
}

if(bytesread == 10) { // if 10 digit read is complete
RFID.print("Keycode is: "); // possibly a good TAG
RFID.println(code); // print the TAG code
RFID.flush();
}
bytesread = 0;
digitalWrite(7, HIGH); // deactivate the RFID reader for a moment so it will not flood
delay(10000);
RFID.flush();
digitalWrite(7, LOW); // Activate the RFID reader
}
}
}

4. Once you have the code you can upload this sketch.  Use the code that you found and modify it as such; if your code is 0123456789 you must change it to 01[SPACE]2[SPACE]345[SPACE]678[SPACE]9

 

#include <SoftwareSerial.h>
int val = 0;
char code[10];
int bytesread = 0;
#define rxPin 8
#define txPin 14
SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);
SoftwareSerial mySerial = SoftwareSerial(0,1);
void setup() {
mySerial.begin(9600);
RFID.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
pinMode(9,OUTPUT); // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
digitalWrite(9, LOW); // Activate the RFID reader
}


void loop() {
if(RFID.available() > 0) { // if data available from reader
if((val = RFID.read()) == 10) { // check for header
bytesread = 0;
while(bytesread < 10) {
val = RFID.read();
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break; // stop reading
}
code[bytesread] = val; // add the digit
bytesread++; // ready to read next digit
}
}
if(bytesread == 10) {
digitalWrite(7,HIGH);
mySerial.print(">T:NACK ");
mySerial.print(code[0]);
mySerial.print(code[1]);
mySerial.print(" ");
mySerial.print(code[2]);
mySerial.print(" ");
mySerial.print(code[3]);
mySerial.print(code[4]);
mySerial.print(code[5]);
mySerial.print(" ");
mySerial.print(code[6]);
mySerial.print(code[7]);
mySerial.print(code[8]);
mySerial.print(" ");
mySerial.print(code[9]);
mySerial.println("12");
delay(500);
digitalWrite(9,LOW);
RFID.flush();
}
}
}
}

5. Edit the config file as shown in the PDF. Now you should be good to go.

4 Comments

Leave a Reply