I am working with slightly modified example code for the Adafruit FeatherWing DS3231 RTC (real time clock) board. The DS3231 chip itself is from Maxim. Since the cell is described as a "backup battery" a literal interpretation suggests that you don't need the backup battery in order to operate the board if the board itself is powered and you don't mind that the device cannot remember the time when board power is lost. I might be taking the term "backup battery" too literally since it doesn't seem to work.

The Adafruit (Arduino) code:

> #include <Wire.h>
> #include "RTClib.h" 
> RTC_DS3231 rtc; 
> void loop() 
>     rtc.adjust(DateTime(2018, 1, 1, 0, 0, 0));
>     DateTime now = rtc.now();
>     Serial.print(now.year());
>     Serial.print(" ");
>     Serial.print(now.month());
>     Serial.print(" ");
>     Serial.print(now.day()); 

The output is:

2165 165 165 

The Maxim datasheet says this about the VBAT line which is the line between the DS3231 chip and the missing backup battery:

Backup Power-Supply Input. When using the device with the VBAT input as the primary power source, this pin should be decoupled using a 0.1μF to 1.0μF low-leakage capacitor. When using the device with the VBAT input as the backup power source, the capacitor is not required. If VBAT is not used, connect to ground.

So I connected it to ground and it makes no difference. I can't buy a battery until tomorrow morning. Can somebody please confirm that the backup battery is actually essential. EDIT: I installed a battery and it makes no difference.

Aside: A good reason for not having a backup battery if possible is to have fewer user serviceable parts.

  • Does your code work properly with a battery?
    – Gerben
    Oct 3, 2018 at 11:55
  • @Gerben, I installed a battery and it makes no difference.
    – H2ONaCl
    Oct 3, 2018 at 19:02
  • Glad to hear you figured the problem out. Nice job.
    – Gerben
    Oct 4, 2018 at 15:56

3 Answers 3


The problem was a bad connection for one of the serial lines.

I found the solution at this link.

The battery is not necessary to make this work.


Your code does not include the line(s) necessary to initialise the rtc.

in setup, you need something like


If you've followed the instructions from the Adafruit website for installing the RTC library:

  • Start Arduino IDE
  • File->Examples->RTClib->ds3231

This will open the RTC usage example.

Else, go to the example on the Adafruit Github page

look to the setup() code and see how they initialise the device

  • I have the call to rtc.begin in my setup. I only show the loop in the above code.
    – H2ONaCl
    Oct 3, 2018 at 3:38
  • Using the exact same code as the Adafruit example which is a read-only file so I know it is correct (Files>Examples>RTClib>ds3231) the year is still 2165, month 165, day 165.
    – H2ONaCl
    Oct 3, 2018 at 3:41

Assuming your code is in Arduino IDE "loop". Assuming

rtc.adjust(DateTime(2018, 1, 1, 0, 0, 0)); initializes the rtc.

Your code should be continually printing the rtc.adjust value.

Hence move the rtc.djust out of the "loop" and provide some kind of delay , say 1 second, to print rtc every second. Then we can take a look why your are getting wrong data.

  • Removing that line makes no difference. Every time through the loop the year is 2165.
    – H2ONaCl
    Oct 3, 2018 at 4:43
  • Does rtc.adjust returns anything - true / false /error ? Your rtc is not initializing / running .
    – Jan Hus
    Oct 3, 2018 at 4:50
  • I think .adjust is a void function.
    – H2ONaCl
    Oct 3, 2018 at 4:52
  • The Adafruit example at File>Examples>RTClib>ds3231 also says the year is 2165.
    – H2ONaCl
    Oct 3, 2018 at 4:53
  • OK its RTC 23:30 here ( no pun intended , so I'll tackle this tomorrow.
    – Jan Hus
    Oct 3, 2018 at 4:54

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.