MusicBoxProject / raspberry-service

A systemd service that monitor a Kinto bucket to sync config updates.
Apache License 2.0
2 stars 1 forks source link

Use a RS522 reader connected to the GPIOs of the Raspberry Pi #2

Closed jlebunetel closed 6 years ago

jlebunetel commented 6 years ago

Use the chip RS522 (with the Velleman VMA405 module for instance) to read RFID tags directly with the Raspberry Pi without using an Arduino Board.

SPI interface

This chip uses the SPI interface. You need to activate it through the Raspberry Pi configuration interface :

$ sudo raspi-config

Python script

This chip can be used with the pi-rc522 library.

Install it with :

$ sudo pip3 install pi-rc522

Then, use it in a Python script :

from pirc522 import RFID
import time

rc522 = RFID()

while True:
  rc522.wait_for_tag()
  (error, tag_type) = rc522.request()
  if not error:
    (error, uid) = rc522.anticoll()
    if not error:
      print("UID: " + str(uid))
      time.sleep(1)

Hardware connection

VMA405 Raspberry Pi
VCC +3.3v (pin 17)
RST GPIO25 (pin 22)
GND GND (pin 20)
MISO SPI0_MISO, GPIO09 (pin 21)
MOSI SPI0_MOSI, GPIO10 (pin 19)
SCK SPI0_CLK, GPIO11 (pin 23)
NSS SPI0_CEO_N, GPIO08 (pin 24)
IRQ SPI0_MOSI, GPIO24 (pin 18)
Natim commented 6 years ago

Moved to the Wiki: https://github.com/MusicBoxProject/raspberry-service/wiki/How-to-plug-the-RS522-Raspberry-NFC-reader-to-the-Raspberry%3F