Transistor Affecting Timings?


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Here's a video which shows how the two LEDs start off in sync (first 10s) and then gradually go out of sync (last 10s - clip has been edited for length)


  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Those look like ceramic resonators. (?) The ceramic resonators aren't that accurate and I bet that the actual frequency differes ever so slightly between the two so your timing drifts. Capacitance in the breadboard may also have an effect on tha actual frequency.

    If you really need to keep them in sync then I'd suggest driving both PICs from one oscillator or sync them thru one of the spare I/O's but I suspect that's not physically possible (?). Next suggestion is to use crystals instead of resonators, moving on from there there's almost no end to how much you want to spend to be accurate - temperature compensated?, oven controlled?, rubidium? - you name it.

    /Henrik.

    EDIT: I looked at a couple of resonators and they had a frequency tollerance of +/-0.5% typically. If you're unlucky and get one at +0.5 and the other at -0.5 (very unlikely but still) the difference between the two is 1%. Your 1000ms delay becomes 995ms on one and 1005ms on the other.
    Last edited by HenrikOlsson; - 19th April 2012 at 06:24.

  3. #3
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    I agree with Henrik, that syncing PIC's is the easiest way to proceed.
    If you use internal 4MHz OSC in master PIC and set GP4 pin to provide Fosc/4 out, then your system will be in sync. Rest of the PIC's will use master PIC clock as reference.

    Two totally independent systems are always out of sync, already from the beginning. Difference might be small at the beginning, but....
    Last edited by Gusse; - 19th April 2012 at 07:48.

  4. #4
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Quote Originally Posted by RossWaddell View Post
    Here's a video which shows how the two LEDs start off in sync (first 10s) and then gradually go out of sync
    It should be easy to prove to yourself it has nothing to do with the transistor - make the second circuit exactly like the first and observe how EXACTLY the same loss of sync happens.
    Having 2 unrelated free running oscillators stay in sync is not a reasonable expectation. (Oscillators 101)

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    It can be EASY to check the OUT OF SYNC problem by having ONLY 1 of the PIC's with a resonator running and use the OSC output from the one running the resonator connected to the OSC input of one with out a resonator. There by both PIC's will be running at the EXACT same frequency. Unless there is some difference in the code running on each PIC they should not fall out of sync.
    Dave Purola,
    N8NTA
    EN82fn

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Hi,

    We also could raise scheme 1 ( unbuffered led ) will produce little heat inside the pic chip... then somewhat disturbing the oscillator ...

    .6v loss ( typ. ) @ 10 mA = 6mW ... @135°C / Watt = 1°C !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    RossWaddell,

    Why don't you use a 16F or 18F PIC series with an internal oscillator. Also, you can drive the 4 LEDs from 4 different ports without transistors. Or with Vcc=5V you can even drive two LEDs per port without a resistor (the PIC has an internal resistance).

    You can also try the same timming experiment that you did above with a 16F or 18F PIC, using the internal oscillator, to see what happens.

    Robert
    Last edited by rsocor01; - 19th April 2012 at 15:01.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    I also thought last night about removing the transistor on the 2nd PIC to test the timings and lo and behold - it also goes out-of-sync after a minute or so. I would agree that the most likely explanation lies with the tolerance of the resonators.

    To clear up a few misconceptions: I'm not trying to link the two PICS/LEDs. I had used the first schematic to test out the timings (I videotaped the blinking to match the frame rates to my source movie) and was disappointed to see it different when hooked up to the transistor (which turns out to be not relevant). I hadn't accounted for the tolerance of the resonator so either I need to use these specific components when finalizing the circuit or provide a way to tweak the timings during runtime (reading a pot, for example).

    Some final questions (I hope):

    * Is there a better resonator/oscillator I should use which would be more accurate (higher tolerances)? I was using 20Mhz because I thought the 12f629's built-in 4Mhz wasn't sufficiently accurate. Henrik - you mention this in your post so if you know an oscillator component that would be better please let me know.

    * Gusse - I've thought about using the clock output of one PIC to be the input on other PICs but it never seems to work for me. Are saying I can dispense with the 20Mzh external resonator/oscillator, remove the define and just connect GP4 to CLKIN on the other PIC?

  9. #9
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Quote Originally Posted by RossWaddell View Post
    I've thought about using the clock output of one PIC to be the input on other PICs but it never seems to work for me. Are saying I can dispense with the 20Mzh external resonator/oscillator, remove the define and just connect GP4 to CLKIN on the other PIC?
    What is your realistic accuracy requirement and where does it come from?

    If LED blinking was just a trial circuit for your end application, then OK. But if your application will be LED blinking device, then I don't get why internal 4MHz OSC with +-1% tolearance would not be enough. +/-1% means max. 5ns/cycle deviation between two corner oscillators (every 50s, 1s time difference). OK, it is quite much, but everything is relative...

    20MHz +/-50ppm means +/-1kHz deviation => an error of 26 minutes per year. Is this OK?
    With VCTCXO you can have less than +/-1ppm stability.

    If you want to use GP4 as an output, then you need to use internal 4MHz OSC, GP4 is multiplexed to OSC2 so XTAL cannot be used.
    With external clock source you can use PIC in EC mode.
    Last edited by Gusse; - 20th April 2012 at 08:22.

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Charlie - I'm not trying to lock the two PICs in phase. Please see my earlier post where I tried to clear that up:

    To clear up a few misconceptions: I'm not trying to link the two PICS/LEDs. I had used the first schematic to test out the timings (I videotaped the blinking to match the frame rates to my source movie) and was disappointed to see it different when hooked up to the transistor (which turns out to be not relevant). I hadn't accounted for the tolerance of the resonator so either I need to use these specific components when finalizing the circuit or provide a way to tweak the timings during runtime (reading a pot, for example).

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Robert - the 12f629 has an internal 4 Mhz oscillator calibrated to 1%. I'd prefer something more accurate hence the external oscillator.

  12. #12


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Maybe a 20 Mhz crystal oscillator with capacitors is the way to go?

    "Crystals provide accurate timing to within 50 parts per million (PPM)"

    If that's true, then that's better than a resonator with 0.5 % accuracy.

  13. #13
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Quote Originally Posted by RossWaddell View Post
    Maybe a 20 Mhz crystal oscillator with capacitors is the way to go?

    "Crystals provide accurate timing to within 50 parts per million (PPM)"

    If that's true, then that's better than a resonator with 0.5 % accuracy.
    Actually it is a 0.005% accuracy!!!!! Yes, the external oscillator might be the way to go.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  14. #14
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Transistor Affecting Timings?

    Quote Originally Posted by RossWaddell View Post
    Maybe a 20 Mhz crystal oscillator with capacitors is the way to go?

    "Crystals provide accurate timing to within 50 parts per million (PPM)"

    If that's true, then that's better than a resonator with 0.5 % accuracy.
    To repeat my earlier post, you will NEVER get them to stay locked in phase using 2 different oscillators - this really is oscillators 101. You are simply wasting your time trying, it is not fundamentally possible. One needs a reference from the other, it's just that simple. There are many ways to do this, including the examples already given.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts