Difference between revisions of "How to Use an RFID RC522 on Raspberry Pi"

From Wiki
Jump to: navigation, search
(Created page with "=='''Setup SPI:'''== Run raspi-config <pre>sudo raspi-config</pre> Go through: '''8 Advanced Options -> A6 SPI->Yes''' Then press Enter three times to enable SPI as default se...")
 
Line 49: Line 49:
 
|None
 
|None
 
|None
 
|None
Install SPI-Py
+
|}
cd ~
+
=='''Install SPI-Py'''==
 +
<pre>cd ~
 
git clone https://github.com/lthiery/SPI-Py.git
 
git clone https://github.com/lthiery/SPI-Py.git
 
cd SPI-Py/
 
cd SPI-Py/
 
sudo python setup.py install
 
sudo python setup.py install
Get MFRC522-python library
+
</pre>
cd ~
+
=='''Get MFRC522-python library'''==
 +
<pre>cd ~
 
git clone https://github.com/mxgxw/MFRC522-python.git
 
git clone https://github.com/mxgxw/MFRC522-python.git
 
cd MFRC522-python/
 
cd MFRC522-python/
Now Run:  
+
<pre>
# To read card
+
=='''Now Run:'''==
 +
<pre># To read card
 
sudo python Read.py
 
sudo python Read.py
 
# To write card
 
# To write card
 
sudo python Read.py
 
sudo python Read.py
 +
</pre>

Revision as of 10:28, 25 January 2016

Setup SPI:

Run raspi-config

sudo raspi-config

Go through: 8 Advanced Options -> A6 SPI->Yes Then press Enter three times to enable SPI as default settings Select finish and reboot

Install python-dev and git:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-dev git

Wiring:

Name Pin# Pin Name
VCC 1 3V3
RST 22 GPIO25
GND Any Any Ground
MISO 21 GPIO9
MOSI 19 GPIO10
SCK 23 GPIO11
NSS 24 GPIO8
IRQ None None

Install SPI-Py

cd ~
git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py/
sudo python setup.py install

Get MFRC522-python library

cd ~
git clone https://github.com/mxgxw/MFRC522-python.git
cd MFRC522-python/
<pre>
=='''Now Run:'''==
<pre># To read card
sudo python Read.py
# To write card
sudo python Read.py