Go Down

Topic: 2 independent ATtiny blinking at the same time (Read 66 times) previous topic - next topic

xisp34

I need 2 independent ATtinys to control some leds. I need both Attiny make blink the same leds at the same time. I can not wire them together and I don't need perfect synchronization. I expected switching them on at the same time they would blink same leds at the same time, but one system blinks faster than the other. So I tried adding external quartz crystal, but still one system blinks faster than the other. What to do?

igendel

My Adventures in the Making:
http://www.idogendel.com/en

jremington

The clocks on the two ATtinys will always be different, so unless they "talk" to each other, it is impossible for them to be synchronized.

mrburnette

#3
Nov 07, 2014, 01:36 am Last Edit: Nov 07, 2014, 01:39 am by mrburnette
Quote
So I tried adding external quartz crystal, but still one system blinks faster than the other. What to do?
Did you set the fuses to use the external crystal?

Quote
I don't need perfect
Anyway, assuming high-quality crystals and identical ambient temperature, you may get close with using small trimmer (or gimmick capacitor) to adjust the oscillators.  An o'scope would be useful.  Instead of syncing with power-on, sync with reset.  

I honestly do not expect a very happy outcome with manual settings, but it may get you close enough.

Ref: reference-oscillator-tuning


Ray

raschemmel

Did you use the same board file for both of them ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

JoeN

#5
Nov 07, 2014, 08:36 am Last Edit: Nov 07, 2014, 08:39 am by JoeN
I need both Attiny make blink the same leds at the same time.
I don't need perfect synchronization.
You really haven't given us any requirements here.  How long must this be run with only "pretty good" synchronization?  What is good enough, anyway?  How far apart are the blinks and for how long are the LEDs active?  You write engineering requirements like an art student.

A crystal might have an accuracy of 50ppm.  If I assume a run time of an hour and a 50ppm crystal, after 3600 seconds (an hour), the synchronization may be off by .18 seconds, pretty far off.  After two hours, it may be .36 seconds off, really pretty obvious for example if the LED is blinking every second, maybe not so bad if it is blinking every minute.  Again, not too easy to tell if this is within your requirements because of how poorly they are defined.  But if this works for you, use the crystal, make sure the fuses are set to use an external oscillator, and make sure both devices are reset at the same time.  The idea about trimming the crystal with external capacitance is a good idea too, maybe it will get you closer.  If not, probably you need some sort of radio synchronization.
I have only come here seeking knowledge. Things they would not teach me of in college.

Riva

Ditto JoeN's reply, we need more information.

You say 2 independent tiny's blinking the same LED's at the same time.
Why can this not all be done with a single tiny?
If they are blinking the same LED's then you have a connection between the tiny's that you might be able to exploit to synchronize them.

Go Up