125Khz RFID library for Arduino.
This library only support TTL RS232 serial port.
When read the data from some RFID card, you will get data like 00 91 6f 0b f5
.
Example:
your card number: 0009531147
that your data : 00 91 6f 0b f5
Notice, f5 is the check bit
f5 = 00^91^6f^0b
+-----------+
++++++++----|VCC T1|----
| +++++----|GND T2|----
| | |++----|TX SER|----
| | | ----|RX LED|----
| | | ----|W0 BEEP|----
| | | ----|W1 GND|----
| | | +-----------+
| | \___________________________________
| |_____________________________ |
| | |
| + + + + + + + + + + + + + + + +
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| +-----------------|-|-|-|-|-|-|-|--|-|-|-|-|-|-|-|-+
| | x-x-x-x-x-x-x-x x-x-x-x-x-x-x-x |
| | xxx |
| +--------+ xxx --- --- ............. |
| | | | - x + | ' | ||\ |.-. ' +
| | | ^ --- --- | |__|| \|._. | x
| | | <+++> ARDUINO '.............' +
| +--------+ V |
| | _____ ++-++ xx |
| | <_____> +-O-+ xx |
| | ++-++ xx |
| |+--++-- |
| ||||++-- +---------------------+ |
| |+--++-- | | |
| | | | |
| ++------+ +---------------------+ |
| ++ | +
| ++ | +-+ +-+ x
| ++------+ +-+ +-+ x-x-x-x-x-x x-x-x-x-x-x +
| +-------------------------|-|-|-|-|-|-|-|-|-|-|-|--+
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| + + + + + + + + + + + +
|____________________________________________|
Connecting RFID Reader RX, TX to Arduino pin headers.
RX <--> 10
TX <--> 11
// RFID_UART.ino
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial.begin(57600);
Serial.println("Hello, double bk!");
}
void loop() {
if(RFID.isAvailable()){
tag = RFID.data();
Serial.print("RFID card number: ");
Serial.println(RFID.cardNumber());
#ifdef TEST
Serial.print("RFID raw data: ");
for(int i=0; i<tag.dataLen; i++){
Serial.print(tag.raw[i], HEX);
Serial.print('\t');
}
#endif
}
}
When using multiple readers, you'll need to call the 'listen' function in order to receive any future readings.
// RFID_UART.ino
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
#define RFID2_RX_PIN 12
#define RFID2_TX_PIN 13
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
SeeedRFID RFID2(RFID2_RX_PIN, RFID2_TX_PIN);
RFIDdata tag2;
void setup() {
Serial.begin(9600);
RFID.listen(); //first, we listen for data on reader #1
}
void loop() {
if(RFID.isAvailable()){
tag = RFID.data();
Serial.print("RFID card number: ");
Serial.println(RFID.cardNumber());
RFID2.listen(); //now start listening for data on reader #2
}
if(RFID2.isAvailable()){
tag2 = RFID2.data();
Serial.print("RFID2 card number: ");
Serial.println(RFID2.cardNumber());
RFID.listen(); //then we listen to reader #1 again...
}
}
For more information please visit wiki.
This library is written by Ye Xiaobo for seeed studio
and is licensed under The MIT License.
Contributing to this software is warmly welcomed. You can do this basically by
forking, committing modifications and then pulling requests (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.
Seeed Studio is an open hardware facilitation company based in Shenzhen, China.
Benefiting from local manufacture power and convenient global logistic system,
we integrate resources to serve new era of innovation. Seeed also works with
global distributors and partners to push open hardware movement.