jgoogs

Raspberry Pi RFID RC522 Chip

Feb 3rd, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. How to setup a Raspberry Pi RFID RC522 Chip
  2.  
  3. https://pimylifeup.com/raspberry-pi-rfid-rc522/
  4.  
  5. sudo raspi-config
  6. sudo reboot
  7. lsmod | grep spi
  8. sudo nano /boot/config.txt
  9.     Within the configuration file, use CTRL + W to find “dtparam=spi=on“
  10.     Once you have made the changes, you can press CTRL + X then pressing Y and then Enter to save the changes.
  11.  
  12. RFID
  13.  
  14. sudo apt update
  15. sudo apt upgrade
  16. sudo apt install python3-dev python3-pip
  17. sudo pip3 install spidev
  18. sudo pip3 install mfrc522
  19.  
  20. Writing with the RFID RC522
  21.  
  22. mkdir ~/pi-rfid
  23. cd ~/pi-rfid
  24. sudo nano Write.py
  25. #!/usr/bin/env python
  26.  
  27. import RPi.GPIO as GPIO
  28. from mfrc522 import SimpleMFRC522
  29.  
  30. reader = SimpleMFRC522()
  31.  
  32. try:
  33.         text = input('New data:')
  34.         print("Now place your tag to write")
  35.         reader.write(text)
  36.         print("Written")
  37. finally:
  38.         GPIO.cleanup()
  39. ***********************
  40. #!/usr/bin/env python
  41.  
  42. import RPi.GPIO as GPIO
  43. from mfrc522 import SimpleMFRC522
  44.  
  45. reader = SimpleMFRC522()
  46.  
  47. try:
  48.         text = input('New data:')
  49.         print("Now place your tag to write")
  50.         reader.write(text)
  51.         print("Written")
  52. finally:
  53.         GPIO.cleanup()
  54. *****************
Advertisement
Add Comment
Please, Sign In to add comment