Crystal Oscillators

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Crystal Oscillators

Post by vraedac »

I am interested in building a binary clock. I looked to the tutorial for constructing the Monochron, but this uses a crystal + RTC setup that seems to be a bit overkill for my project; I really don't need to keep track of the date or keep time when the device is powered off. So I have been trying to find out how to use the crystal by itself, but haven't had much luck finding an explanation as to how these things work - some sources indicate I will need to build a complex circuit with capacitors around the crystal, others seem to imply that this isn't necessary. So, the question is - How do I use a watch crystal WITHOUT an RTC as the clock for a circuit?

I found this device http://www.datasheetdir.com/FD5175TLE-3 ... 0+download Which seems like it could work, but I would rather learn how to use the crystal itself rather than relying on this more complicated third party device.

thanks in advance for any help!

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

I think we will need more information to help. What microcontroller will you use? How accurate do you need the clock to be? What is the temperature fluctuations where the clock will be used?

Generic answer: The datasheet for your crystal will give you "load capacitance" where each leg of the crystal will require a capacitor to ground of that value.

vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Re: Crystal Oscillators

Post by vraedac »

well i was hoping to be able to do it without a uC at all, just a crystal with gates and counters/flip-flops, if that's possible. If not, i guess I would use the AVR ATTiny2313. The clock would be used indoors, with temperatures ranging roughly from 60 degrees to 80 degrees fahrenheit.

as for accuracy, this project is mostly for fun / learning experience, so it doesn't need to be perfect, but I would like it to be off by less than 10min per year if possible... is that reasonable?

I have seen schematics with designs like the one you described, involving a capacitor on each leg of the crystal; in such a design, where is the output voltage measured? as in, where is my 32.768 khz wave?

thanks for your help

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

You definitely CAN do it without a uC, but IMO it would be more work. But, thats just because I have never done it that way before.

I asked about temperature because crystals are temperature dependent. A 32.768kHz crystal will usually have a 20ppm tolerance in its temperature range. To convert parts per million (ppm) to percent divide by 10,000. So, a 20ppm crystal will have a full scale temperature dependent tolerance of +/- 0.002%. If you are at the far end of the tolerance range then 8760 (hours in a year) %0.002 of that is 17.52 hours so, no, it would not be accurate to within 10 minutes a year.

There are temperature compensated crystals that are more accurate. But, they are expensive. You can use mains frequency as a clock source. This is very common in clocks because the LONG TERM frequency is very accurate. You can use GPS data or a number of other things.

Now, if the average temperature of the crystal is close to the speced temp (usually 25c) then it could be accurate to 0.000xxx in a year. I am just pointing out some food for thought.

Good luck on your project and keep us posted on your progress.

-Pete

vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Re: Crystal Oscillators

Post by vraedac »

if by "mains frequency" you mean an AC source, then that is not applicable here because I want this clock to be battery operated.

if it is possible to do it without a uC, then that brings us back to my original question: HOW? How would i use one of these crystals as the clock for a counter or flip flop?

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

I think I will have to recuse myself from this discussion as I am not familiar enough to give good help. However, I do recall a few projects that I think are doing just what you want and I will try to post some links to them when I have a bit more time.

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

Do you have a method of measuring frequency? Such as an oscilloscope?

vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Re: Crystal Oscillators

Post by vraedac »

unfortunately no, i don't :? can't afford one of those right now... was hoping i use a 15-bit counter circuit to test the crystal setup

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »


vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Re: Crystal Oscillators

Post by vraedac »

yeah, that's perfect, thanks :)

although after looking at that example, the uC route is starting to look more attractive... I wanted to avoid the complexities of i2c that are required when using the crystal with an RTC + uC, but have been unsuccessful in finding an example of crystal + AVR microcontroller that does not use an RTC, so that is why I thought to ditch the microcontroller altogether. Any information on how to do this?

sirket
 
Posts: 128
Joined: Fri Oct 26, 2007 8:46 pm

Re: Crystal Oscillators

Post by sirket »

pm6041141 wrote:If you are at the far end of the tolerance range then 8760 (hours in a year) %0.002 of that is 17.52 hours so, no, it would not be accurate to within 10 minutes a year.
Erm ... .002% = .00002

8760 x .00002 = .1752 hours - almost exactly 10 minutes- and that's assuming you're at the far end of the accurracy range.

sirket
 
Posts: 128
Joined: Fri Oct 26, 2007 8:46 pm

Re: Crystal Oscillators

Post by sirket »

vraedac wrote:yeah, that's perfect, thanks :)

although after looking at that example, the uC route is starting to look more attractive... I wanted to avoid the complexities of i2c that are required when using the crystal with an RTC + uC, but have been unsuccessful in finding an example of crystal + AVR microcontroller that does not use an RTC, so that is why I thought to ditch the microcontroller altogether. Any information on how to do this?
You build a small circuit using the crystal as a clock source for the MC. On the MC you start one of the timers and count down. When it reaches 0 you increment your first counter. With the right divisors this first counter might count seconds. When that reaches 60 you increment minutes- and so on.

Beyond simply counting- you also need to display your information. 7 segment display decoders and/or multiplexing get involved here. I know a lot of the introductory PIC books use to cover these topics- not sure about AVR based books but they have to be out there. If you don't already own one i would suggest either buying one- or going down to the library and seeing if you can find something relevant.

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

Erm ... .002% = .00002

8760 x .00002 = .1752 hours - almost exactly 10 minutes- and that's assuming you're at the far end of the accurracy range.
This is correct. I am not sure where my mind was when I wrote that post.

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: Crystal Oscillators

Post by pm6041141 »

although after looking at that example, the uC route is starting to look more attractive... I wanted to avoid the complexities of i2c that are required when using the crystal with an RTC + uC, but have been unsuccessful in finding an example of crystal + AVR microcontroller that does not use an RTC, so that is why I thought to ditch the microcontroller altogether. Any information on how to do this?
Is this helpful? Schematic is in eagle format.

http://daqq.eu/index.php?show=prj_avr_clock_1

vraedac
 
Posts: 8
Joined: Wed Apr 07, 2010 2:06 pm

Re: Crystal Oscillators

Post by vraedac »

that certainly seems to be exactly what i asked for, though the code is more complicated than I expected.

thanks all for you help

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”