DS1307 RTC not powered on when connected to battery (XIAO BLE Sense)

I understand this could be a bit silly of a doubt. I am using the DS1307 RTC with XIAO BLE Sense nRF52840 to print timestamp. Below is my code-

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include "RTClib.h"
#include "String.h"
RTC_DS1307 rtc;

void setup () {
  Serial.begin(57600);
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
  setLedRGB(true, true, true);
  delay(1000);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while(1) { 
      delay(500);
      setLedRGB(true, false, false);
      delay(500);
      setLedRGB(false, false, true); 
    }
  }
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); //device already setup
}

void loop () {
  DateTime now = rtc.now();
  if((String(now.year()) == "2000") || (!now.isValid())){
    setLedRGB(true,false,false); 
    Serial.println("Check RTC!");
  }
  else{
    setLedRGB(false,true,false);
    Serial.print(now.timestamp());
    Serial.println();
    delay(3000);
  }
}

void setLedRGB(bool red, bool green, bool blue) {
  if (!blue) { digitalWrite(LEDB, HIGH); } else { digitalWrite(LEDB, LOW); }
  if (!green) { digitalWrite(LEDG, HIGH); } else { digitalWrite(LEDG, LOW); }
  if (!red) { digitalWrite(LEDR, HIGH); } else { digitalWrite(LEDR, LOW); }
}

The RTC is connected to 5V/GND of XIAO BLE Sense.
When voltage is measured at VCC/GND, it is 5V with laptop and 1.1 V with battery. (The RTC also has a 3V battery for timekeeping)
I tried connecting 3V, 6V, 9V and 12V battery, but of no difference.

Is there a mistake in my hardware setup?

Edit: I stacked up 7 coin cells to reach 20V, and only then the RTC’s power LED is flowing faintly- but why would it require so much power when the rated power supply is 3.7V around?

Hi there,
What Kind of RTC ? Is it SPI or I2C ?
I don’t see any SPI.h if so?
I think your missing some stuff?
HTH
GL :slight_smile: PJ

The RTC is connected to 5V/GND of XIAO BLE Sense.

XIAO’s 5V pin is connected to USB 5V and not to the battery. In other words, the 5V pin does not supply current to the RTC when XIAO is running on battery power.