Hello Arduino-friends,
I have a question to my RFID starter code.
On my RFID TAG is the number “0007912551”
The serial monitor says “9 9 8 8 5 6 6 7 4 5 6 0”
#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // Pin 2 & 3
String ID;
void setup()
{
RFID.begin(9600); // Verbindung zum RFID Modul
Serial.begin(9600); // Verbindung zum PC
}
void loop()
{
if (RFID.available() > 0)
{
ID = RFID.read();
ID = ID.substring(1,13);
Serial.print(ID);
Serial.print(" ");
}
}
I used to work designing RFID readers and access control systems.
Often the number printed on the tag has no relationship with the number stored in the tag. This is for security reasons, and prevents easy duplicating of tags. Often the number on the tag is scrambled by the reader before passing it on to the rest of the access control features as well.
An EM4100 tag has no digits manufacturer code, or any other “special” bits unless the vendor requests them. It will simply send all of the 64 bits programmed into the tag at manufacture.
In this link em4001 protocol they have chosen to put parity bits into them reducing the useful code to just 40 bits. It is important to note that this is not compulsory and many “custom” tags can be made by not having these parity bits.
That number is 12 digits long. Just don't read anything from the serial port until you have at least 12 digits in the serial buffer. Then read 12 bytes and print them out and then print a new line character or a Serial.println then each read will come out on a new line.
That doesn’t look at all right. Isn’t it supposed to return 0x02 (SOH: Start of Header), 10 ASCII digits, a 1 byte checksum and 0x03 (ETX: End of Text)? Maybe the baud rate is wrong? You should try other rates to see if any return the expected pattern of bytes:
02 30 30 30 37 39 31 32 35 35 31 E2 03
I wonder how your program translated that mess into “998856674560”.