DS1307

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folcks,

I built an simple data logger with Atmel 2560, EEPROM and a RTC (DS1307) shield.
One month after I realized an error about 1 minute for day.
I changed shield, same error. 
Now I set time on RTC twice a day.
Why this big error?
Can You suggest me similar RTCs?

 

Thx in advance 
Best regards

Last Edited: Thu. Nov 24, 2016 - 09:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

zemmo wrote:

I built an simple data logger with Atmel 2560, EEPROM and a RTC (DS1307) shield.
One month after I realized an error about 1 minute for day.
...
Why this big error?

 

The DS1307 uses an external crystal which determines the accuracy of the time keeping.

 

From the DS1307 datasheet:

Connections for Standard 32.768kHz Quartz Crystal. The internal oscillator circuitry is designed for operation

with a crystal having a specified load capacitance (CL) of 12.5pF.

Note: For more information on crystal selection and crystal layout considerations,

refer to Application Note 58: Crystal Considerations with Dallas Real-Time Clocks.

 

Do you have the part number of the crystal used on the shield that you are using?

 

If the error (1 minute per 24 hours) is consistent, you can compensate for the error in your 2560 firmware.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I suspect that the simple answer is :  CHEAP module from Ebay.

 

In the days when you bought a dev board at a realistic price,  the components were all quality controlled.

Or you bought a DS1307 from Farnell, Digikey, ... and mounted it on an unpopulated dev board.

Look at the Distributor prices for DS1307.

 

When an Ebay vendor sells a module with DS1307, crystal, AT24C32 for $1,  she must be cutting a few corners.

 

The chips seem to "work" but the crystals are seldom accurate.

I just assume that these modules are assembled with QC reject components that come out of a factory through the back door.

 

Digikey have got to make a profit.   Look at their 1000-up prices as a guide.

Ebay vendors have also got to make a profit.    They get a special deal from ChinaPost but quality components will still cost money.

 

You will probably get success by simply replacing the crystal with one from a respected source.

 

Oh,  I am as guilty as anyone for buying "cheap" modules from Ebay.   They are useful for "learning" but I would not want to use them in commercial products.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Typed a response yesterday, but probably forgot to click on "post".

 

Dallas makes a lot if time keeping ic's. so go check their site for part numbers.

I believe I saw a DS3231 with an accurracy of 2ppm over 0 to 40 degree C. (That's about 1s in 6 days).

Chips in this accuracy range are more expensive, but they have the crystal built into it to keep tighter controll over stray capacatiance etc.

 

You can also experiment a bit with the capacitor values on your circuit.

An old trick from the HF world is to twist 2 pieces of insulated wire together to make your own adjustable capacitor.

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thx Chuck99,david,Paulvdh for your reply,
Yes David, I think the problem is the cheap Shield bought on Ebay, today I buy one from adafruit :)
Chuck99 Tomorrow I will change the bad crystal with one good
Paulvdh the average temperature is 10 degrees, I never hear your trick thx :)

Tomorrow I will measuring the frequency of  this cheap crystal

Thx for your support

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can "trim" a crystal with some extra parallel capacitance.   But only if the frequency is too high.

 

It is  cheaper and easier to just buy a crystal from a respected Supplier.  e.g. Digikey, Farnell, ...

Then you do not waste board space with home made trimmer capacitors (or genuine trimmer capacitors).

 

Of course software "trim" involves no pcb real estate.   You simply add/subtract milliseconds once an hour.

The time and effort required to calculate and implement any "trimming" is going to cost you inconvenience in any commercial product.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
The time and effort required to calculate and implement any "trimming" is going to cost you inconvenience in any commercial product.

Yeah, sure, but OP bought (probably a single) board from China, and his next from adafruit. So he's probably a hobyist and tweaking a capacitor this way can give him some insight in tweakability of crystals & influence of (stray) capacitance.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, yesterday I changed the bad Crystal.
After 18 hours works fine, I attach pic of  my "time-stamp"(clock in/on) prototype with iButtons.
The last time I buy a cheap module, big wasting time :)

 

Thx for your support

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The last time I buy a cheap module

And the last time you should buy a DS1307 if you want "precise" time.

 

Use the DS3231 or DS3232 (I use the DS3231), a lot more expensive but great.

 

Hai capito??

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,  but you still have "cheap" DS3231 modules on Ebay.  

 

I would guess that they are of a similar QC to the DS1307 modules.

 

As a general rule,   semiconductors that fail QC are still likely to work.

A crystal that is out of spec may run but not within the specified frequency range.

Replace the crystal and the DS1307 is probably fine.   At least for hobbyist purposes.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Instead of using a CHEAP_DS1307 module from eBay, use a cheap DS3231 RTC module from eBay.  The DS3231 incorporates a crystal internal to the IC and is much more accurate than the DS1307 for the same price.  The DS3231 shares the same data structure for its time-keeping registers as the older DS1307.  It does add two alarms and has a slightly different initialization.  There is no internal SRAM memory on the DS3231. 

 

The components are all quality-controlled on the cheap Chinese eBay boards.  These boards are cheap because of mass-production efficiencies rather than the use of "QC-reject components that come out of a factory through the back door".  Plus the Chinese government subsidies international mail shipments by offering very low rates to Chinese shippers using the "ocean-train" of hundreds of super-sized container ships constantly moving millions of little envelopes between Hong Kong/Shenzhen and Long Beach, CA (where these envelopes enter the US postal service and get delivered to your door).   The US Postal service only offers expensive air-transport for items being shipped out of the USA.  I don't know about the postal service in the UK or the Euro Union, but I assume that it is as bad, expensive, and as unproductive as the US postal service.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Js ho capito, grazie mille :)
@Js I understand, thank you so much. :)

I never used DS3231,
I got  some free samples of it By maxim this mornig 
Next days I will draw a simple shield with Eagle.

I don't buy another cheap module from ebay.

 

Thx for your support