Sunday, September 28, 2014

Mike also noticed odd behaviour of the clock shields (both bubble and OLED) when powered from the 3.7V LiPo battery (as shown here). After a while, the RTC returns bogus time. A quick check of the DS1307 datasheet (page 3) confirmed my suspicion:

When 5V is applied within normal limits, the device is fully accessible and data can be written and read. When a 3V battery is connected to the device and VCC is below 1.25 x VBAT, reads and writes are inhibited. However, the timekeeping function continues unaffected by the lower input voltage. As VCC falls below VBAT the RAM and timekeeper are switched over to the external power supply (nominal 3.0V DC) at VBAT.

Therefore, if one really wants the clock(s) powered from LiPo, a step-up converter must be used.
Another solution is to replace the DS1307 with the (almost) pin-to-pin compatible DS1337. This one does not provide support for a backup battery, relying instead on the main power (Vcc). Which shouldn't be a problem with a LiPo. The software would need to set the ATmega328 to sleep when the LiPo voltage drops under a certain (e.g. 3.5V) value. Once the display goes blank, the user should know it's time to charge the battery. (Note that another nice feature of DS1337 is alarm capabilities.)

I actually went through a similar exercise in the past, when I had to pick DS1337 over DS1307, for the exact same reason, but I forgot about it.

Conclusion: do not use DS1307 when the design calls for powering from 3V3 or directly from 3.7V LiPo.