ATTiny85 and ATMega168 timing off?

I spent some time today playing around with loading sketches into an ATtiny85. I edited the standard 'blink' example to flash the LED on and off at 250 ms intervals. I modified he sketch for pin 0 on the tiny85. Loaded the sketch into it with a Seeeduino (Mega168) as an programmer. I then loaded the same sketch into the Seeeduino.

Using the Seeeduino to power the breadboard with the Ttiny85 I watched as the two just happily blinked away. Afte a short time they were out of sync.

So, what's the deal?? The tiny85 is using it's internal default clock setting (1 MHZ) and the Seeeduino has an external 16 MHz crystal.

That's the deal - internal clock vs a crystal.
Read the data sheet, it discusses the accuracy of the internal clocks.

Some details to CrossRoads' post...

Crystal accuracy is typically better than 100 parts-per-million. The best Atmel guarantees from the internal oscillator is about ±1% (in my experience, you can get about ±0.2% under the right conditions). If you have not calibrated the internal oscillator it can be off by as much as ±10%.

A practical example... Let's say you want to delay for five minutes. With a crystal, in the very worst case, the actual delay might be five minutes ±2 milliseconds. With an uncalibrated oscillator the actual delay might be five minutes ±30 seconds. If the oscillator is calibrated, the actual delay might be five minutes ±3 seconds.

Heh. I guess this is a good practical example of how much off it can be!

:wink:

I'm not so sure about that.

If you want to test clock accuracy this way, you need to use the blink without delay rather than the "standard blink" example. The standard blink sketch will have a different interval due to the difference in clock frequency (1MHz vs 16MHz) that is likely to be much more significant than what can be expected from clock inaccuracy issues.