RFID-RC522 WITH RASPBERRY PI
Before use RFID-RC522. Enable SPI Interface (Device Tree Overlays)
On new kernel use Device Tree Overlays.
- Edit on /boot/config.txt. (add new line)
device_tree_param=spi=on
dtoverlay=spi-bcm2708
dtoverlay=spi-bcm2708
- Edit on /etc/modprobe.d/raspi-blacklist.conf (add # (comment) on line "blacklist spi-bcm2708")
#blacklist spi-bcm2708
- Reboot Raspberry PI
sudo shutdown -r now
- Re-Check SPI Interface software
$ dmesg | grep spi
[ 5.408904] bcm2708_spi 20204000.spi: master is unqueued, this is deprecated
[ 5.659213] bcm2708_spi 20204000.spi: SPI Controller at 0x20204000 (irq 80)
[ 5.659213] bcm2708_spi 20204000.spi: SPI Controller at 0x20204000 (irq 80)
$ lsmod
spi_bcm2708 6010 0
- If you found, software is enabled.
Install Software for use RFID-RC522
- Install python-dev
sudo apt-get install python-dev
- Install SPI-Py (Hardware SPI as a C Extension for Python)
git clone https://github.com/lthiery/SPI-Py.gitcd SPI-Pysudo python setup.py install
- Install MFRC522-python
git clone https://github.com/mxgxw/MFRC522-python.git
cd MFRC522-python
Install Pins between Raspberry PI and RFID-RC522
RFID-RC522 Pin | Raspberry PI Pin | Raspberry PI Pin name |
---|---|---|
SDA | 24 | GPIO8 |
SCK | 23 | GPIO11 |
MOSI | 19 | GPIO10 |
MISO | 21 | GPIO9 |
IRQ | None | None |
GND | Any | Any Ground |
RST | 22 | GPIO25 |
3.3V | 1 | 3V3 |
You can test read card.
- sudo python Read.py
output: -
Welcome to the MFRC522 data read example
Press Ctrl-C to stop.
(If touch the card, it will display.)
Welcome to the MFRC522 data read example
Press Ctrl-C to stop.
Card detected
Card read UID: XX,XX,XX,XX
Size: 8
Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Comments
Post a Comment