[Solved] DS1307 RTC interrupt not working


I have a DS1307 breakout board hooked up to an Arduino Uno:

  • VCC and GND are connected to VCC and GND on the Arduino.
  • SDA and SCL are connected to SDA and SCL on the Arduino.
  • SQW is connected to digital pin 2 on the Arduino.

I have the code below to invert the state of the onboard LED, when the square wave output of the RTC falls.

The problem is, the LED is not changing at all; It stays off.

If I use a Dupont cable attached to SQW on the RTC and quickly contact pin 2, the LED inverts it’s state as expected, but when it’s plugged in normally, the LED does nothing.

I can write and read the current date and time to the RTC no problem, I’ve run the basic blink sketch and can confirm the onboard LED does work, and I’ve tried using pin 3 for the interrupt and that doesn’t work either.

#include <Wire.h>
#define ledPin LED_BUILTIN
#define interruptPin 2

void setSQW() {
  Wire.write(0x07);   // Write to Register 7
  Wire.write(0x10);   // Set SQW to 1Hz

void invertLED() {
    digitalWrite(ledPin, !digitalRead(ledPin));

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), invertLED, FALLING);
void loop() {

I wonder if the internal pullup resistor in the UNO is not pulling "enough"?

You don't say which DS1307 breakout board you have so it's not possible to say if the breakout board already has a pullup resistor fitted onto the SQW/OUT pin. Have you tried manually adding an external pullup resistor just in case - maybe a 4K7 or similar?

Do you have a multimeter to measure the voltage on the UNO INT pin? At 1Hz you may be able to see the voltage change, depending on how quickly your multimeter responds.

I have the Elegoo DS1307 breakout board (DS1307-Module-V03), that comes with their "Most Complete Kit".

The multimeter didn't show any voltage changes before adding the pullup resistor, now it does.

Adding the external pullup resistor fixed the problem. Thank you!