venerdì 9 settembre 2016

RFID-RC522 on Raspberry PI (Python)

Enable SPI interface

Edit /boot/config.txt and add the following lines
device_tree_param=spi=on
dtoverlay=spi-bcm2708
Reboot  the device.

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.git
cd MFRC522-python
sudo python Read.py
Touching the reader with a card, the output must be
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