Modified Arduino DS1307RTC library that also works for MCP7940N

Posted on Monday, December 23rd, 2013 in Arduino, code, components by the machinegeek

Ray writes, “When your project needs a real-time clock (RTC), don’t you hate that the popular DS1307 costs several dollars? I recently came across Microchip’s MCP7940N, which is an inexpensive alternative to DS1307. On the hardware side it is pretty much a drop-in replacement (although Microchip recommends adding several extra elements). The software requires a few modifications. In this blog post I describe how to modify an existing Arduino DS1307RTC library to provide support for both chips.”

For more information as well as the code download link, visit Ray Hobby blog.

Via the contact form.

This entry was posted on Monday, December 23rd, 2013 at 12:34 am and is filed under Arduino, code, components. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

6 Responses to “Modified Arduino DS1307RTC library that also works for MCP7940N”

  1. Oliver says:

    no caps near the crystal?

  2. Oliver says:

    Nope, the datasheet [1] on page 2? suggests to put 2 caps there.

    Page 16 has a recommended board layout also placing them appropriately. Values are left for the reader to find in the ‘text’, but 10pF + 12pF (or + 8pF depending on the crystal cap.) is recommended.


    • @matseng says:

      You are right according to the 2011-2013 datasheet. I was looking at the 2011 datasheet that was the first hit Google returned for me. (Can be found at the same url but named 25010A instead of 25010E)

      In that there was no mentions of external caps or example schematics/layouts.

      So the morale of this is “Don’t trust Google to return the newest datasheet” :)

  3. Oliver says:

    Heh, I didn’t even realiase there where multiple versions :p

    So where’s the caps! :p

    • Ray Wang says:

      The picture shown is a circuit that originally had a DS1307 RTC installed, which does not need load capacitor. As I described in the post, I used MCP7940N as a quick drop-in replacement, so you won’t see the caps. For reliability the caps should probably be added.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Drone: So these go for around $330 USD and NO published calibration procedure online or otherwise? Given what's inside - I don't think I'll be considering...
  • Pekka Akselin: This is ridiculous!? :-) We are back at 256(!) byte EPROMs that needed multiple, a handful, of voltages to run! :-(
  • KH: Let's try a back-of-envelope calc balancing energies. From MCP1700 datasheet, there are graphs for a 200mA load step. Estimate the energy shortfall as 12uJ. Say...
  • Daniel: It's been a week and my comment is still awaiting moderation. Apparently the CIA doesn't want their involvement known?
  • KH: Agree, so okay, I guess he must have learned from somewhere. 100nF and 1000uF is so far apart, that was jarring; it's more magic incantation...