*HELP* RFID Door Lock Shield not reading card

Control electric door locks and strike plates using your Arduino and an RFID module. Serial interface for an external RFID reader, and a switched output for door strike control. [Product page]
Post Reply
hanish
Posts: 6
Joined: Fri Feb 06, 2015 4:05 am

*HELP* RFID Door Lock Shield not reading card

Post by hanish » Fri Feb 06, 2015 4:19 am

Status update:

I'm able to read the rfid tag from the door lock shield, but when i swipe the card, it reads " ÿÿ1õ "

when i read the card directly from arduino or the reader software, it reads the card well, and shows some numbers.


_______________________________________________________________________
_______________________________________________________________________
Hello

I bought an Arduino compatible and a RFID Door lock Shield from freetronics. i also bought the supported RFIDRW-E-TTL reader.
I could connect the reader to my arduino directly and read the card. but when i connect the Door lock Shield, and i enter the code below, it doesn't read my card.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup()  
{
  // Open connection to host at 38400bps
  Serial.begin(38400);

  // Open connection to RFID module at 9600bps
  mySerial.begin(9600);
}
void loop()
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
My cards are T5567, i also can make it EM4100. does this have anything to do with the Shield?

Can somebody help me out so that the Door lock shield reads the card, and activates the 12V strike output?

Thanks

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: *HELP* RFID Door Lock Shield not reading card

Post by andrew » Sat Feb 07, 2015 4:13 am

hanish wrote:Status update:

I'm able to read the rfid tag from the door lock shield, but when i swipe the card, it reads " ÿÿ1õ "

when i read the card directly from arduino or the reader software, it reads the card well, and shows some numbers.


_______________________________________________________________________
_______________________________________________________________________
Hello

I bought an Arduino compatible and a RFID Door lock Shield from freetronics. i also bought the supported RFIDRW-E-TTL reader.
I could connect the reader to my arduino directly and read the card. but when i connect the Door lock Shield, and i enter the code below, it doesn't read my card.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup()  
{
  // Open connection to host at 38400bps
  Serial.begin(38400);

  // Open connection to RFID module at 9600bps
  mySerial.begin(9600);
}
void loop()
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
My cards are T5567, i also can make it EM4100. does this have anything to do with the Shield?

Can somebody help me out so that the Door lock shield reads the card, and activates the 12V strike output?

Thanks
Check the baud rate in the serial monitor. It needs to be set to 38400 not 9600.

hanish
Posts: 6
Joined: Fri Feb 06, 2015 4:05 am

Re: *HELP* RFID Door Lock Shield not reading card

Post by hanish » Sat Feb 07, 2015 10:16 am

Hi, thanks, now i can read the tags.

i tried a code from http://tronixstuff.com/2013/11/19/ardui ... r-15-rfid/ and tried to replace it with my card number " 49 50 48 48 48 55 49 50 51 57 13 ". i get rejected.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX

int data1 = 0;
int ok = -1;
int yes = 13;
int no = 12;

// use first sketch in http://wp.me/p3LK05-3Gk to get your tag numbers
int tag1[14] = {2,52,48,48,48,56,54,66,49,52,70,51,56,3};
int tag2[14] = {2,52,48,48,48,56,54,67,54,54,66,54,66,3};
int newtag[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // used for read comparisons

void setup()
{
  RFID.begin(9600);    // start serial to RFID reader
  Serial.begin(9600);  // start serial to PC 
  pinMode(yes, OUTPUT); // for status LEDs
  pinMode(no, OUTPUT);
}

boolean comparetag(int aa[14], int bb[14])
{
  boolean ff = false;
  int fg = 0;
  for (int cc = 0 ; cc < 14 ; cc++)
  {
    if (aa[cc] == bb[cc])
    {
      fg++;
    }
  }
  if (fg == 14)
  {
    ff = true;
  }
  return ff;
}

void checkmytags() // compares each tag against the tag just read
{
  ok = 0; // this variable helps decision-making,
  // if it is 1 we have a match, zero is a read but no match,
  // -1 is no read attempt made
  if (comparetag(newtag, tag1) == true)
  {
    ok++;
  }
  if (comparetag(newtag, tag2) == true)
  {
    ok++;
  }
}

void readTags()
{
  ok = -1;

  if (RFID.available() > 0) 
  {
    // read tag numbers
    delay(100); // needed to allow time for the data to come in from the serial buffer.

    for (int z = 0 ; z < 14 ; z++) // read the rest of the tag
    {
      data1 = RFID.read();
      newtag[z] = data1;
    }
    RFID.flush(); // stops multiple reads

    // do the tags match up?
    checkmytags();
  }

  // now do something based on tag type
  if (ok > 0) // if we had a match
  {
    Serial.println("Accepted");
    digitalWrite(yes, HIGH);
    delay(1000);
    digitalWrite(yes, LOW);

    ok = -1;
  }
  else if (ok == 0) // if we didn't have a match
  {
    Serial.println("Rejected");
    digitalWrite(no, HIGH);
    delay(1000);
    digitalWrite(no, LOW);

    ok = -1;
  }
}

void loop()
{
  readTags();
}
also my LED is always powered on, when a tag is swiped, it blinks, and then stays on, unlike in the video where it stays off, and blink when swiped.

how do i get voltage in the 12V out Strike port on my RFID door lock shield when my card is swiped?

Thanks

johnb wrote:
hanish wrote:Status update:

I'm able to read the rfid tag from the door lock shield, but when i swipe the card, it reads " ÿÿ1õ "

when i read the card directly from arduino or the reader software, it reads the card well, and shows some numbers.


_______________________________________________________________________
_______________________________________________________________________
Hello

I bought an Arduino compatible and a RFID Door lock Shield from freetronics. i also bought the supported RFIDRW-E-TTL reader.
I could connect the reader to my arduino directly and read the card. but when i connect the Door lock Shield, and i enter the code below, it doesn't read my card.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup()  
{
  // Open connection to host at 38400bps
  Serial.begin(38400);

  // Open connection to RFID module at 9600bps
  mySerial.begin(9600);
}
void loop()
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
My cards are T5567, i also can make it EM4100. does this have anything to do with the Shield?

Can somebody help me out so that the Door lock shield reads the card, and activates the 12V strike output?

Thanks
Check the baud rate in the serial monitor. It needs to be set to 38400 not 9600.
Attachments
Untitled.jpg

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: *HELP* RFID Door Lock Shield not reading card

Post by andrew » Sun Feb 08, 2015 4:18 am

The sketch you found on tronixstuff is written for 14 number RFID tags, whereas yours is only 11. Change the loop in void readTags and the array sizes to suit your tag data length.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: *HELP* RFID Door Lock Shield not reading card

Post by angusgr » Sun Feb 08, 2015 10:59 pm

hanish, I also have a housekeeping/admin request - please don't post in other threads asking people to answer this thread. If a few days have gone past then it's OK to "bump" your thread once to ask for someone to view it, but please also be patient with this - sometimes it just takes us a few days to get back to people.

I've deleted the post from the other thread.

hanish
Posts: 6
Joined: Fri Feb 06, 2015 4:05 am

Re: *HELP* RFID Door Lock Shield not reading card

Post by hanish » Tue Feb 10, 2015 8:35 am

Hi mate, sorry. won't happen again. :mrgreen:
angusgr wrote:hanish, I also have a housekeeping/admin request - please don't post in other threads asking people to answer this thread. If a few days have gone past then it's OK to "bump" your thread once to ask for someone to view it, but please also be patient with this - sometimes it just takes us a few days to get back to people.

I've deleted the post from the other thread.

hanish
Posts: 6
Joined: Fri Feb 06, 2015 4:05 am

Re: *HELP* RFID Door Lock Shield not reading card

Post by hanish » Tue Feb 10, 2015 8:38 am

johnb wrote:The sketch you found on tronixstuff is written for 14 number RFID tags, whereas yours is only 11. Change the loop in void readTags and the array sizes to suit your tag data length.

Hi John, thanks, it seems to be working now. but why is it that the pin i connect my led , the led always stays on.. when i show the reader a card, the led blinks, and stays back on..
Shouldn't it be off, and when i wave the tag, it goes on and back off?

Thanks

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: *HELP* RFID Door Lock Shield not reading card

Post by andrew » Tue Feb 10, 2015 9:45 pm

hanish wrote:
johnb wrote:The sketch you found on tronixstuff is written for 14 number RFID tags, whereas yours is only 11. Change the loop in void readTags and the array sizes to suit your tag data length.

Hi John, thanks, it seems to be working now. but why is it that the pin i connect my led , the led always stays on.. when i show the reader a card, the led blinks, and stays back on..
Shouldn't it be off, and when i wave the tag, it goes on and back off?

Thanks
You can change the situation to suit yourself. E.g. set the LED pin to low when the sketch starts.
Ditto for after a card read. Experiment, change, break, fix, learn :)

hanish
Posts: 6
Joined: Fri Feb 06, 2015 4:05 am

Re: *HELP* RFID Door Lock Shield not reading card

Post by hanish » Wed Feb 18, 2015 11:40 am

Hi,

i need a small programming help. i know only real basic about C++ programming. I've been trying to do it on my own since last week, but i'm unable to do it.. Help please.

In the practical arduino book, there's these 2 arrays

Code: Select all

// The tag database consists of two parts. The first part is an array of
    // tag values with each tag taking up 5 bytes. The second is a list of
    // names with one name for each tag (ie: group of 5 bytes).
    char* allowedTags[] = {
      "0104F5B523",         // Tag 1
      "04146E8BDD",         // Tag 2
      "0413BBBF23",         // Tag 3
    };

    // List of names to associate with the matching tag IDs
    char* tagName[] = {
      "Jonathan Oxer",      // Tag 1
      "Hugh Blemings",      // Tag 2
      "Dexter D Dog",       // Tag 3
    };

    // Check the number of tags defined
    int numberOfTags = sizeof(allowedTags)/sizeof(allowedTags[0]);

I want to add this "database" array to the code found at http://tronixstuff.com/2013/11/19/ardui ... r-15-rfid/.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX

int data1 = 0;
int ok = -1;
int yes = 13;
int no = 12;

// use first sketch in http://wp.me/p3LK05-3Gk to get your tag numbers
int tag1[11] = {49, 50, 48, 48, 48, 55, 49, 50, 51, 57, 13};
int tag2[11] = {2,52,48,48,48,56,54,67,54,54,66};
int newtag[11] = { 0,0,0,0,0,0,0,0,0,0,0}; // used for read comparisons

void setup()
{
  RFID.begin(9600);    // start serial to RFID reader
  Serial.begin(9600);  // start serial to PC 
  pinMode(yes, OUTPUT); // for status LEDs
  pinMode(no, OUTPUT);
}

boolean comparetag(int aa[11], int bb[11])
{
  boolean ff = false;
  int fg = 0;
  for (int cc = 0 ; cc < 11 ; cc++)
  {
    if (aa[cc] == bb[cc])
    {
      fg++;
    }
  }
  if (fg == 11)
  {
    ff = true;
  }
  return ff;
}

void checkmytags() // compares each tag against the tag just read
{
  ok = 0; // this variable helps decision-making,
  // if it is 1 we have a match, zero is a read but no match,
  // -1 is no read attempt made
  if (comparetag(newtag, tag1) == true)
  {
    ok++;
  }
  if (comparetag(newtag, tag2) == true)
  {
    ok++;
  }
}

void readTags()
{
  ok = -1;

  if (RFID.available() > 0) 
  {
    // read tag numbers
    delay(100); // needed to allow time for the data to come in from the serial buffer.

    for (int z = 0 ; z < 11 ; z++) // read the rest of the tag
    {
      data1 = RFID.read();
      newtag[z] = data1;
    }
    RFID.flush(); // stops multiple reads

    // do the tags match up?
    checkmytags();
  }

  // now do something based on tag type
  if (ok > 0) // if we had a match
  {
    Serial.println("Accepted");
    digitalWrite(yes, HIGH);
    delay(1000);
    digitalWrite(yes, LOW);

    ok = -1;
  }
  else if (ok == 0) // if we didn't have a match
  {
    Serial.println("Rejected");
    digitalWrite(no, HIGH);
    delay(1000);
    digitalWrite(no, LOW);

    ok = -1;
  }
}

void loop()
{
  readTags();
}

I need it to be like when the card is read, (49 50 48 48 48 55 49 50 51 57 13 my card), it looks for the number (49 50 48 48 48 55 49 50 51 57 13) in the database array.

if number found in array, it Serial.println welcome to the corresponding user found in the tagName array. ; sends high to yes. else if number not found, it sends high to no.

I want it in this database format so that i can add users easily ( many users) , and also so that it prints the corresponding name of the tag's user. in the code above, i can't add users from time to time.

Please help friends.. :| :|
Thanks in advance

Post Reply