Circuit
The introduction has become quite lengthy, so we will move the circuit diagram for connecting the Pico to the RFID reader to a separate page. Additionally, there are more pins that involved in this than any of the previous components we've used so far.
Pinout diagram of RC522
There are 8 pins in the RC522 RFID module.
Pin | SPI Function | I²C Function | UART Function | Description |
---|---|---|---|---|
3.3V | Power | Power | Power | Power supply (3.3V). |
GND | Ground | Ground | Ground | Ground connection. |
RST | Reset | Reset | Reset | Reset the module. |
IRQ | Interrupt (optional) | Interrupt (optional) | Interrupt (optional) | Interrupt Request (IRQ) informs the microcontroller when an RFID tag is detected. Without using IRQ, the microcontroller would need to constantly poll the module. |
MISO | Master-In-Slave-Out | SCL | TX | In SPI mode, it acts as Master-In-Slave-Out (MISO). In I²C mode, it functions as the clock line (SCL). In UART mode, it acts as the transmit pin (TX). |
MOSI | Master-Out-Slave-In | - | - | In SPI mode, it acts as Master-Out-Slave-In (MOSI). |
SCK | Serial Clock | - | - | In SPI mode, it acts as the clock line that synchronizes data transfer. |
SDA | Slave Select (SS) | SDA | RX | In SPI mode, it acts as the Slave select (SS, also referred as Chip Select). In I²C mode, it serves as the data line (SDA). In UART mode, it acts as the receive pin (RX). |
Connecting the RFID Reader to the Raspberry Pi Pico
To establish communication between the Raspberry Pi Pico and the RFID Reader, we will use the SPI (Serial Peripheral Interface) protocol. The SPI interface can handle data speed up to 10 Mbit/s. We wont be utilizing the following Pins: RST, IRQ at the moment.
Pico Pin | Wire | RFID Reader Pin |
---|---|---|
3.3V |
|
3.3V |
GND |
|
GND |
GPIO 4 |
|
MISO |
GPIO 5 |
|
SDA |
GPIO 6 |
|
SCK |
GPIO 7 |
|
MOSI |