Codey OnlineBibliothèque de composants Arduino & ESP32 › RFID RC522 Module 13.56MHz
RFID RC522 Module 13.56MHz
Capteurs

RFID RC522 Module 13.56MHz

Le module RFID RC522 (puce MFRC522) lit et écrit des tags RFID/NFC fonctionnant à 13,56 MHz. Il communique avec les microcontrôleurs via une interface SPI avec des lignes pour le chip-select (SDA/NSS), l’horloge (SCK), les données (MOSI/MISO), ainsi que reset (RST) et une interruption optionnelle (IRQ), alimenté en 3,3V.

Largeur: 63.5 mm

Brochage — RFID RC522 Module 13.56MHz

Broche Signal Description
SDA chip-select SPI slave-select/chip-select input for the RC522, often labeled SDA on this module.
SCK SCK SPI clock input from the microcontroller to the RC522.
MOSI MOSI SPI data input to the RC522 from the microcontroller.
MISO MISO SPI data output from the RC522 to the microcontroller.
IRQ interrupt Interrupt output from the RC522 for events such as card detection or FIFO status.
GND ground Ground reference for power and logic signals.
RST reset Reset/power-down control input for the RC522; drive low to reset.
3.3V power 3.3 V power supply input for the RC522 module; do not power from 5 V.

Exemple de schéma de câblage — RFID RC522 Module 13.56MHz

De Vers Fil
board:3.3V x1:3.3V darkorange
board:GND x1:GND black
board:D10 x1:SDA green
board:D13 x1:SCK blue
board:D11 x1:MOSI yellow
board:D12 x1:MISO purple
board:D9 x1:RST cyan

Exemple de code Arduino — RFID RC522 Module 13.56MHz

Cet exemple a été écrit et vérifié à la compilation pour le arduino-uno. Codey Online l'adapte pour vous à toute autre carte prise en charge.

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9

MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }

  SPI.begin();
  mfrc522.PCD_Init();

  Serial.println(F("RC522 RFID reader ready."));
  Serial.println(F("Tap an NFC/RFID card or tag near the reader."));
}

void loop() {
  if (!mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  if (!mfrc522.PICC_ReadCardSerial()) {
    return;
  }

  Serial.print(F("Card UID: "));
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    if (mfrc522.uid.uidByte[i] < 0x10) {
      Serial.print(F("0"));
    }
    Serial.print(mfrc522.uid.uidByte[i], HEX);
    if (i < mfrc522.uid.size - 1) {
      Serial.print(F(" "));
    }
  }
  Serial.println();

  mfrc522.PICC_HaltA();
  mfrc522.PCD_StopCrypto1();
}

Composants similaires

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Construisez votre projet Arduino ou ESP32 avec l'IA

Décrivez ce que vous voulez créer. Codey Online écrit le code, dessine le schéma de câblage, le compile et flashe votre carte directement depuis le navigateur.

Commencez gratuitement