2

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.

Felice Pollano
  • 853
  • 9
  • 20
  • @CamilStaps should e 32768, I added the datasheet anyway – Felice Pollano Apr 22 '13 at 18:39
  • @CamilStaps well, I'm an hobbist, not a real EE :) so not so easy. The datasheet claim a +-20ppm tolerance, I would like to study if that tolerance is compatible with my drift. – Felice Pollano Apr 22 '13 at 18:43
  • 2
    That crystal comes in 6 pF and 12.5 pF versions. Are you sure you have the right one? – markrages Apr 22 '13 at 18:47
  • 5
    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. – markrages Apr 22 '13 at 18:48
  • This seems like a capacitance issue to me. I can't say more without some good quality photos of the board itself and list of all components (including capacitors). My advice would be to take a look at the square wave out on the RTC (also what tools do you have available) and check exactly which frequency you're getting. This would most likely be solved by rearanging components on the board and using small 1 pF capacitors in strategic locations. – AndrejaKo Apr 22 '13 at 18:49
  • @markrages good question: there was not such information in the order :( – Felice Pollano Apr 22 '13 at 18:52
  • @AndrejaKo well, some advice on strategic location? – Felice Pollano Apr 22 '13 at 18:53
  • @Felice Pollano Most likely from the crystal to ground. On the other hand, since the clock is late, I'm not sure anymore if that would help, because we'd be increasing already too high capacitance. – AndrejaKo Apr 22 '13 at 18:59

1 Answers1

3

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.

Felice Pollano
  • 853
  • 9
  • 20
  • A RTC takes very little power, a few mA at most during communication (i2c/spi/etc), and the Arduino has 5v regulated, not 6v. – Passerby Apr 28 '13 at 18:37
  • @Passerby you are correct about the current topic, I can' explain *why* but with an external power it works like a charm – Felice Pollano Apr 29 '13 at 05:51
  • 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? – Passerby Apr 29 '13 at 06:35
  • @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? – Felice Pollano Apr 29 '13 at 07:23
  • 0.1uf/100nf is the standard size decoupling cap, so yes. – Passerby Apr 29 '13 at 15:46