中文 英文 韩语 日语
1.开启SPI与I2C
在Terminal中输入raspi-config 在Advanced Options中打开SPI和I2C
*一定要打开I2C,本人在只开启SPI的情况下操作无反应
2.安装必要的库文件SPI.py
git clone https://github.com/lthiery/SPI-Py.git cd SPI-Py sudo python setup.py install
如果没有git先安装Git,我使用的Raspbian自带。 sudo apt-get install git
3.连接树莓派与RC522读卡器
参考连接:
| PIN NUM | RC522 | PIN NAME |
|---|---|---|
| 24 | SDA | GPIO8 |
| 23 | SCK | GPIO11 |
| 19 | MOSI | GPIO10 |
| 21 | MISO | GPIO9 |
| None | IRQ | None |
| 6 | GND | Ground |
| 22 | RST | GPIO25 |
| 1 | 3.3V | 3V3 |
4.下载RC522程序
git clone $ git clone https://github.com/mxgxw/MFRC522-python.git git clone https://github.com/mxgxw/MFRC522-python.gitcd MFRC522-pythonsudo python Read.py
cd MFRC522-python
sudo python Read.py
可以读取RFID的卡号等信息
5.自己修改程序
我只需要用到读卡功能,自己修改Read.py。
参考的最后一个是Github上Python操作RC522最新的开源代码
进行了重新分装等操作,与MFRC522-python大同小异,可以参考使用。
本文参考:
树莓派使用RFID-RC522A读卡器对IC卡进行读写(通过 python)
I2C开启重要提示来源-西班牙语网页需要翻译
Github-MFRC522-python
Github-pi-rc522











叨叨几句... NOTHING