Code Monkey home page Code Monkey logo

rpi-mfrc522's Introduction

RPi-MFRC522

Raspberry Pi C++ library for MFRC522 and other RFID RC522 based modules.

Read and write different types of Radio-Frequency IDentification (RFID) cards on your Raspberry Pi using a RC522 based reader connected via the Serial Peripheral Interface (SPI) interface.

Adapted from https://github.com/miguelbalboa/rfid Inspired by https://github.com/paguz/RPi-RFID and many of its forks

This simply uses the same methods as https://github.com/miguelbalboa/rfid but mocks all Arduino only method with the bcm2835 library for raspberry pi.

Has the same methods, signatures, functions, and limitations as https://github.com/miguelbalboa/rfid (at least it should)

Getting started

(Do the following on your Raspberry Pi)

Connecting your MFRC522 to your Raspberry Pi

  1. Open https://pinout.xyz/pinout/spi in your browser as a reference.
  2. Connect the 3.3v pin on the MFRC522 to any 3.3v pin on the Raspberry Pi.
    Connect the RST pin on the MFRC522 to any GPIO pin on the Raspberry Pi.
    Connect the GND pin on the MFRC522 to any ground pin on the Raspberry Pi.
    Leave the IRQ pin unconnected.
    Connect the MISO pin on the MFRC522 to the MISO pin (19) on the Raspberry Pi.
    Connect the MOSI pin on the MFRC522 to the MOSI pin (21) on the Raspberry Pi.
    Connect the SCK pin on the MFRC522 to the SCLK pin (23) on the Raspberry Pi.
    Connect the SDA pin on the MFRC522 to any GPIO pin on the Raspberry Pi.
    (GPIO pins are just pins that are not ground or power)

Endable SPI on Raspberry Pi

https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/

Install the bcm2835 library

  1. Download the latest version of the bcm2835 library on http://www.airspayce.com/mikem/bcm2835/

  2. Use cd to navigate to the folder where bcm2835-1.xx.tar.gz is downloaded

  3. Run the following commands to install the library

tar zxvf bcm2835-1.xx.tar.gz

cd bcm2835-1.xx

./configure

make

sudo make check

sudo make install

Try an example

  1. Download this repo by running git clone https://github.com/CoolCyberBrain/RPi-MFRC522.git
  2. Enter the folder by running cd RPi-MFRC522
  3. Build the ReadNUID example by running the following command
g++ src/**/*.cpp src/*.cpp examples/ReadUidMultiReader/ReadUidMultiReader.cpp -I src -I src/RPi-Arduino-SPI -std=c++17 -lbcm2835
  1. Run the example by running the following command (if you don't run in sudo the program will crash, need sudo to access the GPIO pins)
sudo ./a.out

rpi-mfrc522's People

Forkers

tgd1975

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.