In this experiment, you will learn how to use the RFID module and RFID1 library, and simulate SPI with software to communicate between the SunFounder Mega 2560 board and the RFID module. Before starting, you need to know the ID of the RFID key tag and write the ID to the rfidTest file.
After you have finished the following steps, if you place the RFID key tag in the induction zone of the RFID module, the characters ”Collect!” will be displayed on Serial Monitor.
-1 * SunFounder Mega 2560
-1 * RFID Module
-1 * RFID key tag
-1 * USB Cable
– Several jumper wires
-1 * Breadboard
-1* Capacitor Ceramic 100nF
Step1: Build the circuit
The wiring between RFID and SunFounder Mega 2560 is as follows:
|RFID||SunFounder Mega 2560|
Note: To realize more stable output, you need to connect a 0.1uF capacitor between 3.3V and GND for filtering.
Step 3: Upload the sketch to the SunFounder Mega 2560 board
Then place the RFID key tag in the induction zone of the RFID module. You will see the following values printed on Serial Monitor:
Step 4: Now, you may know the ID of your RFID key tag (e.g. the RFID key tag in our experiment is 84A168B8, as shown in the figure above).
Open the rfidTest file and replace the ID in the sketch with your own (divide the ID into four numbers equally, just as shown in the example below):
Step 5: Burn the sketch into the SunFounder Mega 2560 board
After burning rfidTest, you will see the following values printed on Serial Monitor: