I want to connect an RFID reader to an Arduino board. The RFID reader has several wires attached, and the manual mentions them as follows:
- Red: VCC +12V
- Black: GND
- Green: D 0/RX/4R+
- White: D 1/TX/4R−
- Blue: LED/CS
- Yellow: Beep
There is also another black wire attached, but the manual does not mention it. This is an image of it:
I have the red wire connected to the 5V pin and the black wire to the GND pin on Arduino board. Then I have the white wire connected to the RX pin on the Arduino board.
I'm trying to Serial-read the RX port using this code:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int b = Serial.read();
Serial.print(b);
Serial.print(" ");
}
}
When I try to read a keyfob, only this is printed – nineteen times 248
:
248 248 248 248 248 248 248 248 248 248 248 248 248 248 248 248 248 248 248
To me it looks like there's something wrong with the connection somewhere.
How can I properly read this RFID reader? If above assumption is not correct, is there something I should know?