[Project] Arduino based RFID scanner

All about Arduino, Jeenode and other Clones (hardware & Software)

Moderator: Mdamen

airox
Member
Member
Posts: 214
Joined: Sat May 15, 2010 10:42 pm

[Project] Arduino based RFID scanner

Post by airox »

Hi guys!

Yesterday I received my RDM630 RFID reader. This evening I attached it to a JeeNode and got it working. Great stuff!
The idea is to hide it behind a panel in the hallway so nobody knows where the RFID scanner is. The scanner will turn off/on the alarm.

Still thinking about the protocol to communicate to my server. The idea is to make this wireless and using RF12 encryption (through the software libraries from jeelabs). What would you guys do to avoid the signal replay? Or should I just use a ethernet shield?

What would you guys recommend in the encryption when going wireless to avoid replaying?

Greetings!
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: [Project] Arduino based RFID scanner

Post by Digit »

Nice job!
Can you provide a link to your RFID supplier, cause I can imagine that will be useful for others.

Regarding the security issue; I don't know how the RF12 encryption works but there are a few questions you can ask yourself.
- is it strong enough to prevent replayed encrypted RF packets from being accepted as being valid on the receiver side or not?
- how well protected is your alarm system against other threats, like using wireless sensors but no good jamming detection, protection against power failure, protection against unauthorized access to the location where your alarm system is placed, etc.

What I'm trying to say is: the communication you use for your RFID shouldn't become an issue when looking at "the bigger picture" of how your alarm system is protected.
If it does, use a wired connection, with encryption. :idea:
airox
Member
Member
Posts: 214
Joined: Sat May 15, 2010 10:42 pm

Re: [Project] Arduino based RFID scanner

Post by airox »

Hey Robert,

Thanks for the info :-)

I bought the RFID reader from Pieter Floris: http://www.pieterfloris.nl/shop/product ... product=87
Appears to be the RDM630 model.
airox
Member
Member
Posts: 214
Joined: Sat May 15, 2010 10:42 pm

Re: [Project] Arduino based RFID scanner

Post by airox »

The hardware part is done! I got it all squeezed in a box which I got from a local store (Gamma). Now we can scan RFID tags through the wood of the closet to turn off the alarm. Nice!

Next step is to write the software at the receiver side. I picked RF for now.

Pictures:

Image
Image

Greetings!

[Update]
The software is done. I altered the RF12demo which is default on the JeeLink USB stick.
Now I figure out what the NodeID is and immediately convert the incoming data to the real data.

This now resulted in the following printed on the serial port:

Code: Select all

OK NODE=1 TAG=41003D948F67
And for the other node:

Code: Select all

OK NODE=2 LIGHT=208 MOTION=1 DOOR=0 MAILBOX=0 HUM=53 TEMP=233 BAT=0
Node 2 is the next project :-)
User avatar
Phaeton
Advanced Member
Advanced Member
Posts: 573
Joined: Wed May 19, 2010 12:44 pm
Location: Wassenaar
Contact:

Post by Phaeton »

How is your project doing?
airox
Member
Member
Posts: 214
Joined: Sat May 15, 2010 10:42 pm

Re: [Project] Arduino based RFID scanner

Post by airox »

Great! The RFID scanner is working beautifully. We now use it to turn the security on or off.

Checkout more info at http://www.domoticaforum.eu/viewtopic.php?f=17&t=4960

I have five roomnodes installed and an RFID reader jeenode. I just finished the OOK relay for receiving smoke detectors and a byron doorbell. I also found a cheap place to buy the RFID module. It's at http://samenkopen.net/action_product/81918/938563

If you need any more information let me know.
User avatar
Phaeton
Advanced Member
Advanced Member
Posts: 573
Joined: Wed May 19, 2010 12:44 pm
Location: Wassenaar
Contact:

Post by Phaeton »

Thanks, i will! For now i'll use info suplied in the topic you pointed out. Really nice what you do with arduino jeenodes!
erisan500
Member
Member
Posts: 72
Joined: Thu Jun 18, 2009 10:20 pm
Location: Belgium, Oppuurs
Contact:

Re: [Project] Arduino based RFID scanner

Post by erisan500 »

Are you sure that the TagID you read corresponds to the TagID written on the tag?

Code: Select all

OK NODE=1 TAG=41003D948F67
I have the exact same reader, but the id's i read don't correspond to whats written on the tag itself.

I found the solution here maniacbug.wordpress.com/2011/10/09/125k ... le-rdm630/ but it contains a small bug where when you read a 2nd tag, it still shows the tagid of the 1st tag. A second read shows the correct tagid of the 2nd tag. I know it must be some kind of buffer that is not cleared between reads, but i can't find it. So if anyone spots the mistake, please do share the solution.


****Correction ****
Ok just found the issue with double reading. I was using NewSoftSerial. Switching back to SoftwareSerial all is working fine.

Eric
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: [Project] Arduino based RFID scanner

Post by Digit »

Strange. I have a sketch here that uses NewSoftSerial (and checks on ETX and STX, checksum etc.) and works OK (with multiple tags :wink: )
erisan500
Member
Member
Posts: 72
Joined: Thu Jun 18, 2009 10:20 pm
Location: Belgium, Oppuurs
Contact:

Re: [Project] Arduino based RFID scanner

Post by erisan500 »

Would you mind posting your sketch so i can compare where the possible mistake is?
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: [Project] Arduino based RFID scanner

Post by Digit »

I found it here, some time ago: http://marioboehmer.blogspot.com/2011/0 ... duino.html

Some improvements can be made though, like waiting for an STX byte before filling the data array, but I never had the time to add this; I'm not using the RDM360 yet. I'm curious if you can find something.

Code: Select all

#include "NewSoftSerial.h"
#define stx 2
#define etx 3

NewSoftSerial mySerial(6, 7);
int counter;
byte data[14];
byte hexBlock1,hexBlock2,hexBlock3,hexBlock4,hexBlock5;
byte hexCalculatedChecksum,hexChecksum;

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  if (mySerial.available() > 0) {
    data[counter] = mySerial.read();
    //Serial.println(data[counter],DEC);
    counter++;
    if(counter > 13) {
      //we read the whole message, so reset counter
      counter = 0;
      //check if start of text and end of text is correct
      if(data[0] == stx && data[13] == etx) {
        Serial.println("Start of text and end of text correctly received.");
        Serial.print("ID: ");
        //show ID
        for(int x = 1; x < 11; x++) {
          Serial.print(data[x], BYTE);
        }
        Serial.println("");
        Serial.print("Checksum: ");
        //show checksum
        Serial.print(data[11], BYTE);
        Serial.println(data[12], BYTE);

        //Hex ID blocks. Two transmitted Bytes form one Hex ID block.
        //Hex ID blocks:      6   2  |  E   3  |  0   8  |  6   C  |  E   D
        //Transmitted Bytes: 36H 32H | 45H 33H | 30H 38H | 36H 43H | 45H 44H
        hexBlock1 = AsciiCharToNum(data[1])*16 + AsciiCharToNum(data[2]);
        hexBlock2 = AsciiCharToNum(data[3])*16 + AsciiCharToNum(data[4]);
        hexBlock3 = AsciiCharToNum(data[5])*16 + AsciiCharToNum(data[6]);
        hexBlock4 = AsciiCharToNum(data[7])*16 + AsciiCharToNum(data[8]);
        hexBlock5 = AsciiCharToNum(data[9])*16 + AsciiCharToNum(data[10]);
        
        //Transmitted checksum.
        hexChecksum = AsciiCharToNum(data[11])*16 + AsciiCharToNum(data[12]);

        //XOR algorithm to calculate checksum of ID blocks.
        hexCalculatedChecksum = hexBlock1 ^ hexBlock2 ^ hexBlock3 ^ hexBlock4 ^ hexBlock5;
        if ( hexCalculatedChecksum == hexChecksum )
        {
          Serial.println("Calculated checksum matched transmitted checksum.");
        } 
        else {
          Serial.println("Calculated checksum didn't match transmitted checksum. Corrupt data!");
        }
      }
    } 
  }
}

uint8_t AsciiCharToNum(byte data) {
  //First substract 48 to convert the char representation
  //of a number to an actual number.
  data -= '0';
  //If it is greater than 9, we have a Hex character A-F.
  //Substract 7 to get the numeral representation.
  if (data > 9) 
    data -= 7;
  return data;
}
erisan500
Member
Member
Posts: 72
Joined: Thu Jun 18, 2009 10:20 pm
Location: Belgium, Oppuurs
Contact:

Re: [Project] Arduino based RFID scanner

Post by erisan500 »

Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: [Project] Arduino based RFID scanner

Post by Digit »

Cool. Any News on SoftwareSerial vs. NewSoftSerial?
erisan500
Member
Member
Posts: 72
Joined: Thu Jun 18, 2009 10:20 pm
Location: Belgium, Oppuurs
Contact:

Re: [Project] Arduino based RFID scanner

Post by erisan500 »

No, and I'm not going to look at it seen that SoftwareSerial is working well.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: [Project] Arduino based RFID scanner

Post by Digit »

Thank you very much my friend.
Post Reply

Return to “Raspberry, Arduino, Cubietruck and other clones Forum”