Go Down

Topic: external crystal for better timing attiny85 (Read 220 times) previous topic - next topic

creamers

Oct 30, 2014, 09:23 pm Last Edit: Oct 30, 2014, 09:47 pm by creamers
Hi,

Thank you for helping me out on my previous topic (calibrating attiny85), couldn't do it without the help.

I calibrated my attiny85 and it was off only 1,66% , but for my purpose it just too much. (it needs to dimm on and off some ledstrips for multiple days)


question:  can you guys point me into a good direction about using and setting up crystals on an attiny85.? (some sort of instructable)

I believe I read it cannot be > 20Mhz for the attiny85. What about the precision, the higher the better? What's more precise, crystal (+ capacitors) or ceramic resonators or watch crystal ?

Please take into consideration I'm a n00b ;)


dannable

I don't know how to connect one to an ATTiny, but if you want accuracy you want to be looking for a Temperature Compensated Crystal Oscillator (TCXO).
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Tom Carpenter

A crystal is far more accurate than a ceramic resonator (which is, not entirely, but essentially what is inside the chip already).

You can connect a crystal up to an ATTiny in exactly the same way as you would to an ATMega. The trouble with using on for an 85 is that you lose 2 of the 5 I/O pins in the process.

If you use a TCXO or other crystal oscillator, they produce a TTL/CMOS square wave which you feed in to the ATTiny using just 1 I/O pin instead of 2.

For oscillators the lower the ppm the more accurate. Crystals tend to be anywhere from 10ppm to 100ppm but they also have a temperature tolerance and also depend on how accurate your capacitor loading is.
~Tom~

Docedison

Thermal stability is also Most important... Make Certain that you use NP0 types.. Chinese parts usually have a black dot of paint on the top of NP0 types..
If the non NP0 type caps drift much thermally you will not only have timing errors but the oscillator may well quit or become very sensitive to both thermal and Vcc variations.. Especially at low Vcc conditions.
It's a common thought that the 328 will work fine @ 3.3V & 16 MHz crystal.. And 99.9% will work fine.. @ 20C, however at Low or High temps you may well find the clock drifting or intermittent.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

creamers

#4
Oct 31, 2014, 08:09 pm Last Edit: Oct 31, 2014, 10:59 pm by creamers
Thank you guys for explaining!

I think the TCXO is the best but litterly and figurally to big for my small project.

What about using a "32.768Khz Cylinder Watch Crystal Oscillator " ?  

Asking your experience, at what % do you guys think it can drift off clockwise looking at it a few days ? (assuming temperatures between 0 - 40 celcius)

You know any projects about a attiny with such a oscillator ?

*EDIT: found this: LINK  and this LINK

I see he doesn't use resonators with this type crystal ?

Coding Badly

I calibrated my attiny85 and it was off only 1,66%
Was the tuning voltage the same as the testing voltage?


Docedison

https://www.tindie.com/products/bot_thoughts/eezee-attiny244484-breakout/
eezee tiny 84 has provisions for a 16 MHz resonator (stock).
eezee tiny once made a board W/resonator too, I have one...
Kind of a waste but simple enough..
There is a lot of Tiny BOB's on Tindie... I own the 8, 14 and 20 pin eezee tiny boards W & W/O resonators and I like what I own, they work well.. Stand alone or plugged into a breadboard.
All have 6 pin ISP programmer capacity.. Nice well thought out products

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

creamers

#7
Nov 01, 2014, 08:56 am Last Edit: Nov 01, 2014, 09:46 am by creamers
Was the tuning voltage the same as the testing voltage?


Yes I didn't move the table ;)
I also tried it several times to see if it gave me the same value.
*edit: tried today again and it gave me the same value today as it did several days back.

Maybe I should just buy and try to see what result it gives.

Buying a "32.768Khz Cylinder Watch Crystal Oscillator"  doesnt require caps?
Or buying a "Crystal 20MHz" with 2 x caps 20pF  ?

What would work best for a attiny85 5v, between 0 en 40 celcius ?

Erni

I once tried using a watch x-tal @32 kHz without luck.
The problem is that you have to use a very slow upload speed.

The TinyISP has an option:

Code: [Select]
#define PROGRAMMER_SPI_CLOCK  SLOW

But that was not slow enough in my case (or I made some other mistake)

I think the easiest option is to use a 16 MHz x-tal, it is in the boards.txt by default.

Riva

I was thinking you could you use a DS3231 but only connect the 1Hz output to your tiny and count seconds but this is not enabled by default so you need to program over I2C first.

Depending on what country your in maybe you could use a radio clock module and one again use it's 1Hz output to count seconds.

creamers

Thank you for the tips !

Found this to calibrate your attiny with code. Could be useful for someone finding this thread.

binary clock

And yes, think I just have to use a crystal for simplicity...cause my attiny is definately not running consistently 

Go Up