I have a RTC ds1307 mounted on a prototype board ( the one with 3 pin stripped ), and I'm experiencing a delay of about 5 sec/day, far too big compared to some research I did. Can that delay be caused from extra capacitance added by the prototyping board or is just the crystal? This is the crystal I'm using.

  • \$\begingroup\$ Looks like the crystal to me. Are you sure you used 32.768kHz and not 32.000kHz? \$\endgroup\$ – Keelan Apr 22 '13 at 18:18
  • \$\begingroup\$ @CamilStaps should e 32768, I added the datasheet anyway \$\endgroup\$ – Felice Pollano Apr 22 '13 at 18:39
  • \$\begingroup\$ Correction of the last comment: no, 32.000 would make an even bigger drift. However, @Felice, your crystal may be just broken. Can you check with another one? \$\endgroup\$ – Keelan Apr 22 '13 at 18:40
  • 2
    \$\begingroup\$ That crystal comes in 6 pF and 12.5 pF versions. Are you sure you have the right one? \$\endgroup\$ – markrages Apr 22 '13 at 18:47
  • 5
    \$\begingroup\$ There are 86400 seconds in a day, so five seconds is 60 ppm out. This could easily be caused by improper load capacitance on the crystal. \$\endgroup\$ – markrages Apr 22 '13 at 18:48

Well, I solved the drift. After checking the crystal capacity and seeing it is correct as the frequency, I decided to power the Arduino power from an external power supply, my DS1307 uses the +5v from the Arduino board. With the new power supply the clock is accurate ( I can't see a drift of second in 24 h ). I don't know if it was a problem in having a barely enough voltage with the USB or if that supply was "dirty", but in any case the single cause was the power supply.

  • \$\begingroup\$ A RTC takes very little power, a few mA at most during communication (i2c/spi/etc), and the Arduino has 5v regulated, not 6v. \$\endgroup\$ – Passerby Apr 28 '13 at 18:37
  • \$\begingroup\$ @Passerby you are correct about the current topic, I can' explain why but with an external power it works like a charm \$\endgroup\$ – Felice Pollano Apr 29 '13 at 5:51
  • \$\begingroup\$ I would assume because the usb power supply is regulated over a long cable, while the vin supply is regulated at the arduino board's regulator. Do you have a decoupling cap for the rtc? \$\endgroup\$ – Passerby Apr 29 '13 at 6:35
  • \$\begingroup\$ @Passerby no I don't, it is probably the problem, but anyway the circuit will work with an external supply in the "production" case. I will add a decoupling cap too, I think 100nF will be ok? \$\endgroup\$ – Felice Pollano Apr 29 '13 at 7:23
  • \$\begingroup\$ 0.1uf/100nf is the standard size decoupling cap, so yes. \$\endgroup\$ – Passerby Apr 29 '13 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.