DS3231 Interrupt not working

Hello, I recently bought a DS3231 RTC module for my next project. I am currently experimenting around it and its interrupt pin is not working. I am using it to wake up the arduino uno from deep sleep. How would I be able to fix it? I am currently using this rtc library: FabioCuomo-DS3231/RTClibExtended.cpp at master · FabioCuomo/FabioCuomo-DS3231 · GitHub The code I am using is its example code:

#include <Wire.h>
#include <RTClibExtended.h>
#include <LowPower.h>

#define wakePin 2    //use interrupt 0 (pin 2) and run function wakeUp when pin 2 gets LOW
#define ledPin 13    //use arduino on-board led for indicating sleep or wakeup status

RTC_DS3231 RTC;      //we are using the DS3231 RTC

byte AlarmFlag = 0;
byte ledStatus = 1;

//-------------------------------------------------

void wakeUp()        // here the interrupt is handled after wakeup
{
}

//------------------------------------------------------------

void setup() {
  //Set pin D2 as INPUT for accepting the interrupt signal from DS3231
  pinMode(wakePin, INPUT);

  //switch-on the on-board led for 1 second for indicating that the sketch is ok and running
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);
  delay(1000);

  //Initialize communication with the clock
  Wire.begin();
  RTC.begin();
  RTC.adjust(DateTime(__DATE__, __TIME__));   //set RTC date and time to COMPILE time
  
  //clear any pending alarms
  RTC.armAlarm(1, false);
  RTC.clearAlarm(1);
  RTC.alarmInterrupt(1, false);
  RTC.armAlarm(2, false);
  RTC.clearAlarm(2);
  RTC.alarmInterrupt(2, false);

  //Set SQW pin to OFF (in my case it was set by default to 1Hz)
  //The output of the DS3231 INT pin is connected to this pin
  //It must be connected to arduino D2 pin for wake-up
  RTC.writeSqwPinMode(DS3231_OFF);

  //Set alarm1 every day at 18:33
  RTC.setAlarm(ALM1_MATCH_HOURS, 33, 18, 0);   //set your wake-up time here
  RTC.alarmInterrupt(1, true);
}

//------------------------------------------------------------

void loop() {

  //On first loop we enter the sleep mode
  if (AlarmFlag == 0) {
    attachInterrupt(0, wakeUp, LOW);                       //use interrupt 0 (pin 2) and run function wakeUp when pin 2 gets LOW 
    digitalWrite(ledPin, LOW);                             //switch-off the led for indicating that we enter the sleep mode
    ledStatus = 0;                                         //set the led status accordingly
    LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);   //arduino enters sleep mode here
    detachInterrupt(0);                                    //execution resumes from here after wake-up

    //When exiting the sleep mode we clear the alarm
    RTC.armAlarm(1, false);
    RTC.clearAlarm(1);
    RTC.alarmInterrupt(1, false);
    AlarmFlag++;
  }

  //cycles the led to indicate that we are no more in sleep mode
  if (ledStatus == 0) {
    ledStatus = 1;
    digitalWrite(ledPin, HIGH);
  }
  else {
    ledStatus = 0;
    digitalWrite(ledPin, LOW);
  }

  delay(500);
}

TechMaxed: Hello, I recently bought a DS3231 RTC module for my next project. I am currently experimenting around it and its interrupt pin is not working.

How do you know it's not working? Have you observed its level with a DMM or oscilloscope at the time it is supposed to go active?

It wouldn't turn the built-in led on. I had set the alert/wake-up time to one minute after the current time. I waited until time passes 2 minutes and it is still won't turn on. I also double checked the time in the rtc. It is configured correctly.

Using an interrupt with the DS3231 is tricky. The most common modules often need to be modified, to make interrupts work at all, especially if the module is to run on the battery alone. See this link for all the details.

Please post a link to the module you are using and a complete wiring diagram of your setup.

gfvalvo: Have you observed its level with a DMM or oscilloscope at the time it is supposed to go active?

Please answer the question.

Does the Arduino wake up when you activate pin 2 with a switch ?

Yes

TechMaxed: Yes

Which question are you answering?

@gfvalvo I didn't observe it with an oscilloscope. I don't have one. The most I can do is to try observing it with a multimeter

@gfvalvo Yes. It wakes up. Sorry, I didn't see his reply so I wasn't able to specify which question I'm answering.