Enable SPI interface
Edit /boot/config.txt and add the following linesdevice_tree_param=spi=onReboot the device.
dtoverlay=spi-bcm2708
Install Python header files
sudo apt-get install python-dev
Install SPI libraries
git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py
sudo python setup.py install
Test RFID-RC522
Use the following schema to link the RFID-RC522 to the GPIO
Name | Pin # | 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 |
Download the RFID-RC522 interface and test it
git clone https://github.com/mxgxw/MFRC522-python.gitTouching the reader with a card, the output must be
cd MFRC522-python
sudo python Read.py
Welcome to the MFRC522 data read example
Press Ctrl-C to stop.
Card detected
Card read UID: 141,113,243,56
Size: 8
Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Nessun commento:
Posta un commento