Trains4Africa
Because all Boys (and some girls) love Trains

Arduino – RFID Project 1

The following project was intended to test the capability and suitability of RFID for train control.

Possible things we can do with this:

  • Track a train/rolling stock – without using Block detection
  • Inventory Control
  • Perform some action, based on location of a train (blow a whistle when entering station)

These are just a few ideas, and as of writing this article, I could already think of many other uses.

 

ID12

 

Electrical Connection to the ID-12:

ID12_pinout

 

Use the following Arduino test Code to test for relaible RFID reading:

*********************************************************************

bool newData = false;
int cardData[16];
int idx=0;
void setup() {
Serial.begin(9600); // Hardware serial for Monitor 9600bps
Serial.println(“Starting Reader…”); //show some activity
Serial1.begin(9600); //ID-12 uses 9600!
}
void loop() {
while (Serial1.available() > 0) {
cardData[idx] = Serial1.read();
idx++;
if (idx == 16) {
newData = true;
idx = 0;
}
}
if (newData){
newData = false;
Serial.print(“Found RFID device: “);
for (int i = 0; i < 16; i++) Serial.print(cardData[i]);
Serial.println(“.”);
}
}

*********************************************************************

Article:  Stéfan