clock x-tal vs. other x-tals

I just disassembled an electric clock, and found a clock crystal inside, I presume it is 32768kHz

That made me wonder: Why are clock x-tals always this frequence, or are they ? Are they generally more precise than for example a 16mHz x-tal, or is it the lower frequence that make them more precise. By looking around I can see the precission for clock x-tals are 10-15 ppm (which as far as I have seen is parts per million)

So I was wandering: if I used my clock crystal on a ATTiny85 I might get a DIY RTC?

32768Hz crystals (tuning fork crystals) are used with RTC, clocks, watches as they are a good compromise between size, precision, oscillator power, temperature stability at 28degC (wrist temp), etc. The value is 2^15 so easy to divide in order to get 1second tick. They are not generally more precise than bigger values. Not all clocks have this value, any easy to divide binary value is good.

From the Attiny 85 datasheet

Low-Frequency Crystal Oscillator To use a 32.768 kHz watch crystal as the clock source for the device, the Low-frequency Crystal Oscillator must be selected by setting CKSEL fuses to ‘0110’. The crystal should be connected as shown in Figure 6-5. To find suitable load capacitance for a 32.768 kHz crysal, please consult the manufacturer’s datasheet.

Do you have a way to burn the fuses? An AVR ISP is needed.

Thanks

@pito So you are saying that it is not the x-tal, but the surrounding electronics that makes a RTC more precise than a ATtiny85 with a clock x-tal ?

@CrossRoads Yes I have a programmer, I use TinyISP as it has an option for programming mcu's with slow clock.

An ATtiny85 with a 32.768KHz crystal will be no more or less accurate as an RTC with an identical crystal. The difference is that an attiny is not designed to be a real time clock. It has a CPU which processes instructions in a proceedural manor. If your program is doing other things, not just counting from 0 to 32767 and incrementing the time, then your counter could be inaccurate if it misses a count. An RTC is dedicated piece of hardware designed to do nothing but keep track of time (maybe store the time/date with a battery backup to stop it resetting). This means it is likely to be accurate.

With a clock crystal attached to an attiny, you could use a 16bit timer running with a 1:1 prescaler with the timer set to overflow at 32768. Then on every overflow increment your seconds count. That would work fine as the timer will run independently of the CPU and would do just as good a job as an RTC.

That would work fine as the timer will run independently of the CPU and would do just as good a job as an RTC.

Thanks Tom, that was the answer I was hoping for. I just gave it a try, but something went wrong, the t85 became unresponsive, and I had to use a HV programmer to bring it back to life. Anyway I wil try again, maybe I burned wrong fuses.

What fuses values did you set?

I used low D6 high D7 Extended FF

That seems fine. You may want to check that you got the high and low the correct way around, otherwise it would select external clock source, rather than low frequency crystal.

You could also try "low = E6" as that gives the crystal longer to stabilize.

Its possible also that your load capacitors were wrong and that the crystal wasn't oscillating. Clock crystals can be quite finiky due to their low frequency.

Low frequency crystals like the 32.768kHz need less power to oscillate than ones in the MHz range, making them more suitable for watches - they thus became a stock item and are dirt cheap.

They are actually tuning forks made of quartz sealed in a vacuum. The temperature stability for this cut of crystal is poor (not such a problem in digital watches - they are kept at a fairly constant temperature by the wearer!)

They are actually tuning forks made of quartz sealed in a vacuum

I certainly hope that this is an analogy, since it is not physically true.

KeithRB: I certainly hope that this is an analogy, since it is not physically true.

Correct. Here is a tiny bit about how they work: http://ecee.colorado.edu/~mcleod/pdfs/IADE/lectures/ECEN%201400%20Lecture%2017%20Crystal%20Oscillators.pdf

KeithRB:

They are actually tuning forks made of quartz sealed in a vacuum

I certainly hope that this is an analogy, since it is not physically true.

What part of his statement are you taking issue with?

"tuning fork made of quartz".

KeithRB:

They are actually tuning forks made of quartz sealed in a vacuum

I certainly hope that this is an analogy, since it is not physically true.

Really? http://en.wikipedia.org/wiki/Tuning_fork#In_clocks_and_watches

They are tuning forks, indeed. A normal cut crystal @32kHz will never ever fit into such small package. Such crystal would have >10mm diameter, afaik..

Well, shut my mouth! I learned something today.

Well, shut my mouth!

Can't. You're foot is in it. :-)

I learned something today.

Me too. I had always assumed that the expression was not exactly descriptive...