RFID - Using RFID RC522 module as RFID Reader

Preparation

  • Ameba x 1
  • RFID RC522 x 1
  • RFID Tag

Example

We use RFID RC522 module to perform read/write operation on RFID Tag.
Install the required library:
https://github.com/ambiot/amb1_arduino/raw/master/Arduino_libraries/RFID-RC522.zip

Please refer to Arduino official tutorial to add .zip library to Ameba:
https://www.arduino.cc/en/Guide/Libraries#toc4

RTL8195 Wiring diagram as follows:
1

RTL8710 Wiring diagram as follows:
1

Open the example “File” -> “Examples” -> “AmebaMFRC522” -> “DumpInfo”, compile and upload to ameba.
Press the reset button, then place RFID Tag near to RFID RC522. Observe the serial monitor:
2

Code Reference

Create a MFRC522 instance and specify the slave select pin and reset pin.

MFRC522 mfrc522(SS_PIN, RST_PIN);

Initialize the mfrc522 instance.

mfrc522.PCD_Init();

Read the firmware version of the mfrc522 module.

mfrc522.PCD_DumpVersionToSerial();

Look for available RFID Tag continuously.

if ( ! mfrc522.PICC_IsNewCardPresent()) {
  return;
}

Read detected RFID Tag.

if ( ! mfrc522.PICC_ReadCardSerial()) {
  return;
}

Output information in RFID Tag to serial monitor.

mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
Please confirm that QQ communication software is installed