555 timer vs PIC controller

Discussion in 'General Electronics Chat' started by drkblog, Sep 25, 2013.

  1. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    I need a simple circuit capable of creating pulse trains with a 38kHz carrier. Each pulse train should have 12 pulses, 600µs width, with the 38kHz carrier. There must be a pause of 3ms between each train.
    At first I though I could use a 38kHz crystal for the carrier and a LM556 (Dual 555) with one timer astable at 1.2ms 50% duty cycle and the other astable for the 3ms pause. But, to my own surprise, 38kHz crystals aren't easy to find. Then I though of replacing the crystal with an LM555 astable at 38kHz.

    At this point I wonder if such a circuit makes sense. Since I could create that signal with a 8-pin PIC microcontroller like PIC12F629. The circuit would be a lot smaller and much more simple (this PIC has internal 4MHz clock). I could easily change the signal updating the code. Even when using a PIC12F629 is going to be more expensive than the timers, there's no big difference really. Or I could find a cheaper PIC one-time writable.

    So my question is: Am I missing something here? Can you think of any reason for staying with the timers?
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Too bad I am limited by the minimum word count on posts, as my complete answer is:

    No.
     
    drkblog likes this.
  3. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,226
    Depending on the current you need for the IR LED the timers may drive it without powering it up with something like a FET.
     
    drkblog likes this.
  4. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    I thought about that but I have to make the led work at its maximum. So I guess I will need a transistor anyway (I have to check the led datasheet).
    But, even if I can save a transistor, I think it is worth to use the PIC.

    PS: Why did you suggest a FET instead of a BJT?
     
    Last edited: Sep 25, 2013
  5. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,226
    I thought FET when you said micro. They are often easier to drive with the low current outputs, but either would work.
     
    drkblog likes this.
  6. JohnInTX

    Moderator

    Jun 26, 2012
    2,340
    1,016
    Its not too difficult to generate a pulsed 38KHz with a PIC. One way is here. Add a counter to the TMR2 overflow IRQ that toggles the IO line. Maybe that's enough.

    Have fun.
     
    drkblog likes this.
  7. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    In fact, I forget to mention it but I used an Arduino for testing such signal :)
    Now I have to find the cheapest PIC available in Buenos Aires, or use the PIC12F629 which is 2 USD.

    About the led: I'm reading QED234 datasheet, taking the forward current to 400mA moves the radiant intensity from1 to 4. Datasheet states that maximum continuous forward is 100mA and peak current can be up to 1.5A top. But there is no clear information about the how long can be that peak, maybe it's 100µs but not sure.

    Can I safely make 1A flow through the LED using this signal? Of course I'm aware the LED is going to die if the program has a bug and stops with a high level in the output.
     
  8. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,226
    If your bursts are continuous I wouldn't go over 300ma. The forward voltage at 300 ma. is about 2.2volts so peak power is 660 mw. If you have say 14 cycles and another 14 off it would be about 25% duty cycle - so 165 mw. Spec is 200 mw max.
     
    drkblog likes this.
  9. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    You are right. In fact, I have to subtract 2.65 mW per ºC over 25ºC. I think a summer day under the sun (even when the LED won't be right under the sun) the temperature could raise up to 35ºC. I have to set maximum power dissipation to 173.5 mW in my calculations.
     
  10. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,226
    Seems about right, but right at the limit.
     
  11. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    I'm back with this circuit. I'm going to divide the pulse train along eight LEDs using some sort of clock divider circuit. But in the end I'll be using eight LEDs in turns. A pulse train of 16 pulses is going to turn on each LED twice.
    According to my math, if I start with a 50% duty cycle in the 38kHz signal, dividing by eight LEDs takes me to 6.25% duty cycle (even if there is a continuous pulse train). If I take 173.5mW maximum from my previous post, using 6.25% duty cycle is like raising the power dissipation maximum to 2776mW.
    So I should be able to use 400mA (which is 880mW at 100% duty cycle) or even more. Am I right?
     
  12. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    If you are going to use 8 LEDs, why not just run them in parallel at 1/8 the desired output power?

    Bob
     
  13. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    These eight LEDs work one at a time. When the first one is on, the rest is off. Then when the second one turns on, the rest is off.
     
  14. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    Yes, I understand that, but I thought the only reason for it was to increase the power you could output. Maybe I am wrong and they are in different places or pointed in different directions. If not, running all of them at lower power is more efficient and less likely to damage them.

    Bob
     
  15. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    Yes, each LED is placed in a specific position for the purpose of the circuit. I need them to turn on in turns. Eventually I could duplicate the LEDs (to 16) and put them in parallel pairs, resulting in eight pairs of LEDs. In that case I can reduce the current in the LED to 50% and get the same radiant intensity. Of course, it's more expensive.

    I have to start thinking in the power dissipation on the switching transistor.
     
  16. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I would rather run 8 LEDs in parallel, each seeing 1/8th the current then each seeing the full current for 1/8th of the time.

    AFAIK LEDs loose efficiency when driven harder, so it may even be brighter.
     
  17. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    That's not the case of this LED. Check figure 1 http://www.farnell.com/datasheets/48181.pdf
     
  18. drkblog

    Thread Starter Member

    Oct 4, 2012
    109
    0
    There is another issue with this circuit, which I would like to solve. If the main clock (created with a PIC micro) freezes, there is a good chance of one LED staying on. If that happens the LED, or the transistor, or both are fried. Is there something I can do to prevent this?
     
  19. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,281
    1,226
    I suppose since it is pulsing at a 50% duty cycle you could add a current sense resistor and integrate it. When hung the current would be twice as high/ I don't know who (what) you would tell :eek: so I guess you would need a hardware latch and some gates to shut them off. Or you could do the same thing with the clock - might be easier.
     
    Last edited: Oct 17, 2013
    drkblog likes this.
  20. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Use the PIC's watchdog timer set to a short period, to ensure the PIC always resets and clears the output pins if a glitch occurs.
     
    drkblog likes this.
Loading...