RTC Breakout for DS1339 on Arduino - Low Cost, Battery Backup, 2 Alarms

Introduction: RTC Breakout for DS1339 on Arduino - Low Cost, Battery Backup, 2 Alarms

The most popular RTC for the Arduino is the DS1307, sold by Adafruit, Sparkfun, and others. However, it does have some drawbacks, the most notable of which is that its operating voltage is 5v, which meant I could not use it with my Arduino Pro Mini @ 3.3v.

That led me on a hunt for an appropriate replacement for the DS1307. Here were my design parameters:

1) Tolerant of a wide range of voltages, including 3.3 and 5 v

2) Battery backup, so I don't have to worry about resetting the date and time each time I power cycled it.

3) The presence of an alarm, so I could get timed interrupts (and possibly use that to manage power savings for the Arduino Pro Mini running off of battery.

4) DIP package preferably, so it would make for easier soldering (alas, this was not to be!)

The DS1307 is made by Maxim Integrated, and they have a dizzying array of RTC chips. After going through a whole set of datasheets, I was starting to get a headache! I finally settled on the DS1339, which satisfied all of my requirements, namely:

1) Tolerant of a wide range of voltages, from 1.8 V to 5.5V. In particular, I choose the DS1339-33, which has a voltage range of 2.97V-5.5V with the typical voltage as 3.3v

2) It had a battery backup

3) It had not one, but TWO alarms!

4) As a bonus, it also had a trickle charger

I set out to design a breakout board for the DS1339, which I've shared on


After I got the boards from Oshpark, I had to do some smd soldering. There are plenty of sites that tell you how to hand-solder smd components, so I won't go into that detail here. I added a solder jumper to the breakout board that can be used to enable/disable the pullup resistors.

After that, I actually needed a library to talk to the DS1339 from Arduino. The register format is different from that of the DS1307 (of which several libraries are available). Fortunately, I found a library for the DS1337 that was made specifically for the Mosquino, an Arduino compatible platform for extremely low power consumption. Fortunately, the DS1337 and DS1339 register formats were almost identical, with the exception that the DS1339 also had one more register for the trickle charger.

I forked the Mosquino DS1337 library, and made it more generic (you can specify which pins you are using for the external interrupts), made DS1337 and DS1339 subclasses (I could add trickle charger support for the DS1339, for instance), and also updated the example to be able to set and read the time, making it easier to set the time on the RTC module for the first time.

I've released it on github -


It is similar to any other Arduino library. Copy it over to the Arduino libraries folder, and restart Arduino. The DSRTCLib should show up under Examples.

Now you have a relatively low cost RTC module that is chock-ful of features, and can be used with a variety of Arduino boards.



Battery Powered Contest

Participated in the
Battery Powered Contest

Be the First to Share


    • Make It Bridge

      Make It Bridge
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Big and Small Contest

      Big and Small Contest



    Question 3 years ago on Introduction

    Nice board, this could be very useful for teaching. Do you have the Bill of materials or schematic for the PCB you posted on OSHPARK


    Answer 3 years ago

    Dear micromet,

    Please see my answer to the question below (from Cliff) for the Bill of Materials! I also have a later version revision G (that uses surface mount components and also a double-header design that you can simply plug into either the Arduino or the Raspberry Pi without any additional wires) available on my Tindie site - https://www.tindie.com/stores/UpbeatLabs/

    I believe you might have already found the site and placed an order there! (unless it is an incredible coincidence!) :-)



    8 years ago on Introduction

    Hello and thank you for this work. I would like very much to experiment with your design, but have a couple questions concerning the parts used. I understand that you use the 0805 form factor. Is this correct. Also please confirm the capacitor value as 22uF and identify the manufacturer and part number of the coin cell holder. I'm working on an arduino project and need the 3.3v with alarms solution. Your design is perfect for my prototype needs.

    thanks, Cliff


    Reply 8 years ago on Introduction

    Hi Cliff,

    Thanks! Yes, I use the 0805 form factor. Resistors are 4.7 kohm, and the capacitor is 0.1 uf. The battery holder is for CR1220 (12mm) with through hole mount. The crystal is 32.768k btw.

    Hope that helps!