I am using ESP32 with RC522 (MRFC522) module with Arduino IDE. Library used is MFRC522 installed from arduino IDE too. Examples works fine.

Is it even possible to use IRQ pin given in module to wake up host controller(ESP32)? I tried to search for it and some says it is not possible.

Although I tried to do the same and turns out that IRQ pin can be used as interrupt but for that I have to use perticular method from library, example of which mentioned below.

What I get from seeing library that this method wakeup PICC which than lead to functioning of RFID reader, and you will get inturrept. So if I put controller in sleep I cant run this and you will have no wakeup inturrept. And I have tried thhis, without this line of code you wont get inturrept.

My knowledge about library's working is not good so I was not able to go in deep how "PICC" works or what it actually do.

So again main question, is it even possible ? Main goal is to put controller in sleep and wake up when card is detected.

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

#define SS_PIN  5  // ESP32 pin GIOP5 
#define RST_PIN 22 // ESP32 pin GIOP27 

MFRC522 rfid(SS_PIN, RST_PIN);
byte readReg;

void setup() {
  SPI.begin(); // init SPI bus
  rfid.PCD_Init(); // init MFRC522
  Serial.println("Tap an RFID/NFC tag on the RFID-RC522 reader");

  rfid.PCD_WriteRegister(MFRC522::ComIEnReg, 0xA0); 
  rfid.PCD_WriteRegister(MFRC522::DivIEnReg, 0x94);
  rfid.PCD_WriteRegister(MFRC522::ComIrqReg, 0x7F);
  pinMode(21, INPUT_PULLUP);
  attachInterrupt(21, isr, CHANGE);

volatile bool cardPresent;

void loop()
  if (rfid.PICC_IsNewCardPresent()) {}; // Necessary for inturrept
  if (cardPresent)
    rfid.PCD_WriteRegister(MFRC522::ComIrqReg, 0x7F); 
    cardPresent = false;

void isr()
  cardPresent = true;

1 Answer 1


The chip have an INT pin as you already concluded, and the ESP32 can be waken up from deep sleep


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.