So im building a project which relies on having an accurate time clock ticking away to trigger various things within my house all defined within a schedule.
This issue is when I sync the time clock via my serial I can get it 7 seconds behind my PCs time which im fine with but within 24 hours or so its about a minute in front! Iv re synced it many times and get fairly consistent results...
This is obviously a deal breaker for a schedule based system and is know where near what I expected to be able to get even with a "cheap" DS1307 from ebay!
Im using the <DS1307RTC.h> library which is linked to from the Arduino Library page so it should not be the issue?
Do you think I have a factory dud? Is there a chance my project code could be causing the time drift? I do not do any kind of RTC write commands, I set the time using a separate demo sketch then upload my real project seconds later.
Horendus:
Im using the <DS1307RTC.h> library which is linked to from the Arduino Library page so it should not be the issue?
I'm not familiar with the library and don't see it on the Arduino Library page, but it's possible that you are using it incorrectly. Does the library come with any examples? If so, I suggest you see whether any of those would enable you to check the accuracy of your clock.
I recommend paying the premium for an RTC with the DS3231 chip in it. DS3231-based RTCs can be had from cheap Asian exporters for about $7 if cost is a concern.
I have a few more DS1307 on the way which im looking forward to testing to see if I get the same POOR results.
In the meantime i will also order a DS3231 time chip as keeping accurate time is the underpinning of my project and having to re sync my current clock with my PC every other day is a massive pain!
CrossRoads:
Or, tack on a 12, 15, 22pF cap per the datasheet and slow the crystal a little if it's really gaining that much time.
Im not that concerned with salvaging a potentially faulty RTC, rather replace it
terryking228:
The library demo updates the RTC time. Is that what you are using to "set" the clock?
Gaining a minute a day is unusual; sounds like hardware to me. What hardware are you using? Maybe it is getting power supply noise??
Probably need to substitute a different hardware clock....
Hardware is a Arduino Mega, Ethernet shield and DS1307 clock.
Im using this command in the setup loop setSyncProvider(RTC.get); and this command to grab the current time as variable t
time_t t = now();
What im I will do right now is re sync my timeclock (as over night it has gained 37 seconds) and leave the clock un connected to my project. In 12 hours I will plug it back into my project and see if its gained the same amount of time while being disconnected. This will answer my question to whether my project is influencing my RTCs time keeping abilty.
Horendus:
What im I will do right now is re sync my timeclock (as over night it has gained 37 seconds) and leave the clock un connected to my project. In 12 hours I will plug it back into my project and see if its gained the same amount of time while being disconnected. This will answer my question to whether my project is influencing my RTCs time keeping abilty.[/b]
Best way to go.
I do have to chuckle at your "handle" here - "Horendus" - as in Horology.
Horendus:
This is obviously a deal breaker for a schedule based system and is know where near what I expected to be able to get even with a "cheap" DS1307 from ebay!
Do you mean a DS1307 chip or a RTC module complete with 32768Hz crystal?
Do you think I have a factory dud?
If its just a chip you bought, then possibly, but its more likely to be a clone. And if so where
did you get the crystal?
If its a cheap module the crystal is likely out-of-spec (maybe factory reject, but see below).
Be aware that RTC modules are not normally very accurate as they use standard watch quartz
crystals which are designed to work at body temperature and typically don't have to cope
with a wide range of temperature.
I also suspect that many watches these days use cheaper low-spec crystals and have a frequency-correction
value pre-programmed into the controller chip during manufacture - thus a lot of watch crystals are
not as high a spec as you'd imagine. Well I can see this being a plausible cost-reduction measure.
Nope these ebay rtc clocks are that bad.. i used an ethernet shield or serial usb to update time every few hours or modify the circuit slow the crystal...
Try a low value capacitance right across the xtal pins on the DS1307.
See Slow Clocks section:
Stray capacitance. Stray capacitance between the crystal pins and/or to ground can slow an RTC down. Therefore, care must be taken when designing the PCB layout to ensure the stray capacitance is kept to a minimum.
The right-angle connectors came soldered on. They were a b****rd to get off!
Heat gun or as my soldering instructure said heat every pin with the soldering iron, then simply pull each pin out one at a time, it's a bit time consuming but it worked great for me... or simply use a heat gun.