PWM with Hex Schmitt Trigger: I'm confused

Discussion in 'The Projects Forum' started by DaedalusYoung, Sep 29, 2010.

  1. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Hi everybody, I'm new here :)
    I have a question regarding a PWM circuit using 74AC14 chip. I want to construct a simple thingy with three independently variable LEDs (conveniently red, green & blue) and the circuit I found at robotroom.com would allow me to fully use the 6 Schmitt Triggers of said IC.
    I made this circuit on a breadboard and it appears to work. But I don't have an oscilloscope to visualise the output. But the circuit (and robotroom's explanation) leave me confused.
    If you look at the explanation at this page, you see what's happening, the one Schmitt's input is low, so output is high, charge flows through R2 and D1 into C2. So far so good.
    But then, when the capacitor is charged enough, he explains it will discharge and there'll be a current going through D2, back into R2 and then into the Schmitt's output pin. This part I don't get. Why would charge flow through a resistor into an output pin, when there's a perfectly resistance-free path waiting for it, directly connected to 74AC14's input pin? Wouldn't the cap discharge directly and always fast, without resistor, into pin 1? I can't find any info in the chip's datasheet about output being a current sink when low.

    But that's not all. If you read on, on page 4 of the explanation, you'll see he directly hooks up output 1 (pin 2) to input 2 (pin 3), so that anything connected to the output, the device to be modulated (like an LED or a transistor) will not interfere with the whole RC contraption. Well that's all fine.
    But if we follow the explanation of the earlier page, as to how this circuit works, with the cap discharging in output 1, wouldn't that mean the capacitor is really discharging into input 2 instead?

    So you see this has me confused. I can see how this would work, but it would be the same if we'd leave D2 out and that wouldn't result in an optimal PWM, I think. I'm probably overlooking something, so any help is welcome.
    Thanks in advance!
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Inputs are very high resistance so not much current ever flows into or out of them.
    The outputs can be either high or low and have low impedance. Maybe thinking of them as just a switch connected either to the positive or negative rail would help.
    Let us know if this hasn't helped.
     
    DaedalusYoung likes this.
  3. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Thanks for your reply!
    So if I understand correctly, as the capacitor charges, the voltage rises. The input senses this and when voltage gets at 2/3 Vcc, it flicks the output off and so the capacitor discharges into that, so the voltage goes down until 1/3 Vcc and the cycle repeats. It makes sense! :D
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    The voltages for an IC such as the 7413 or other hex Schmitt trigger are not like a 555 or other variation. The upper and lower trip points are not 1/3 and 2/3, you need to refer to the data sheet.

    A 555 is designed to have 1/3 and 2/3, it is part of its design, but it is a mistake to assume this is a universal characteristic.

    Certain oscillators, such as 555 Hysteretic Oscillator, will work with any inverting Schmitt trigger, which is what you are referring to. You can the triangle wave on any of these designs.

    You are using two diodes to gate the current two different directions. All well and good, but diodes are both resistors and non linear below their dropping voltage. This means using a design similar to the 555 PWM Oscillator is neither not linear on the edges of the pots range, where the diodes characteristics become major. The exact PWM % isn't stable, and frequency isn't stable either.

    You can reduce, but not eliminate these problems by using Schottky diodes, as they drop a lot less voltage (0.2V as opposed to a silicon diodes 0.7V drop).

    If you add a comparator you can have both stable frequency and stable PWM, over the full range. The circuit you are using is simple, with simplicity comes flaws. This is almost a maxim with electronics.

    Chapter 5 of my article LEDs, 555s, Flashers, and Light Chasers discusses PWM somewhat. While you aren't using a 555, the basics still apply.
     
    DaedalusYoung likes this.
  5. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Thanks Bill, I'll have a good look at your articles, it looks very useful, I just need more time to read it properly.

    The datasheet says Minimum and Maximum Hysteresis are 0.4 and 1.4V (typically 1V) and Minimum Negative and Maximum Positive Thresholds are 0.9 and 3.2V (at Vcc 4.5V).
    So if I understand correctly, at Vcc 4.5V, any voltage at input pin lower than 0.9V will be considered low and any voltage higher than 3.2V is high, but in normal operating conditions these are closer together, difference never more than 1.4V (typically 1V)?

    I will definately check out Schottky diodes. Although for this project it's not very critical, I can keep it simple and have instability, I can always make a better version when I've learnt more. And that's not such a bad idea really, by that time to make a more complex, but better version and compare the two :)
     
  6. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    A rather neat side characteristic of any Schmitt Trigger is that dead space between the upper and lower can be used to treat the Schmitt Trigger as a bistable multivibrator. Here is how it is done...

    555 Bistable Multivibrator
     
  7. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Oh yes, I see :) It's not something I need right now, but it's good to know the possibilities. Thanks!
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you need PWM over a wider supply range than 5v, you could consider using 4000 series CMOS IC's like the 4093 quad Schmitt-trigger NAND or the 40106/4106 hex Schmitt-trigger inverters. Many 4000-series CMOS IC's can operate from as low as 2v to as high as 16v.

    If you're trying to PWM something using MOSFETs, select a MOSFET with a low total gate charge, usually specificed as Qg.
     
  9. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    I'm planning on using a 2N3904 transistor to PWM a few LEDs, which total current would be about 100mA (when fully on), as displayed at this example page, but just LEDs instead of the 7-segment display.
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, so if you use the 4093 quad Schmitt-trigger NAND or the 40106/4106 hex Schmitt-trigger inverters and run them from 12v, you would need 10mA base current for a 100mA collector current.

    Rbase ~= (Vin - Vbe) / (Ic / 10)
    Rbase ~= (12 - 0.7) / (100mA / 10)
    Rbase ~= 11.3 / 0.01
    Rbase ~= 1,130
    The closest standard value is 1.1k Ohms.

    That's a pretty heavy load for 4000 series CMOS, and would probably prevent the PWM portion from working properly; it would get "stuck".

    If you used logic-level MOSFETs instead, there would be no current requirement once the gate of the MOSFET was charged/discharged.

    You might consider using IRLD024 N-ch logic level power MOSFETs instead; Digikey,Mouser and AvnetExpress among others sell them. They come in a very handy 4-pin DIP package - great for breadboarding & prototyping.
     
  11. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Ok, thanks.
    Would it get stuck because the transistor requires too much current from the IC, so there's not enough left for the capacitor to charge? Does it matter that in the original circuit, the PWM output is sent through a second logic gate so that anything connected would have no effect on the PWM?
     
  12. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Most of these kind of circuits use a very sensitive area of the oscillator, and load it down too much. This is why my design uses Darlington transistors, they load this area extremely lightly. A single transistor with 200Ω and a gain of 120 would load it with 24KΩ, a Darlington would load it with 2.88MΩ.

    The circuits we have been talking about are very analog. PWM is digital. You can use a PIC or some other µC, it will require a lot less parts, but programming them is work.

    I'll get back with you on the schematic, it will be loosely based on chapter 5 of my article, LEDs, 555s, Flashers, and Light Chasers.

    What chips do you have access to (since you don't have your location on your profile)? I'm looking for 7555 or 7556 (both CMOS versions of the 555/556), and a LM393 or LM339.
     
  13. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    I'm in The Netherlands, Europe. I now have a few 74AC14 chips here, as well as some 40106 chips, which I got for a future project. But I can easily get 7555 or 7556 chips , I see LM393P 1.3ns in the list and also some LM339 chips.
     
  14. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    Hello,

    With the 74AC14 you will be restricted from 2 to 6 Volts.
    With the 40106 you can go upto 15 Volts.

    Bertus

    PS I am from the Netehrland too.
    You can edit your profile to add the location.
     
  15. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Yeah, I'm using a 9V battery (may replace with wallwart for final gadget) with 7805 to power the chip, but planning to use full 9V for the LEDs (so I can have 4 parallel arrays of 2 LEDs in series to keep total current for 8 LEDs 100mA).

    I have added GMT in the location field, I already had Netherlands in there. It should be showing up, or do I need to set something in Profile Privacy? I have 'Everyone' on all options, except Contact Info, which I have set to 'Registered Members'.
     
  16. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
  17. DaedalusYoung

    Thread Starter New Member

    Sep 29, 2010
    13
    0
    Thanks Bertus, I'm obviously at the right forum, so much help and useful advice and info!
    I did notice the eBook, had a quick look at some pages, but I will read more when I have more time, probably during the weekend.
     
  18. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    The 40106 and LM393 look like good choices. If you ever want RGB (red green blue) LEDs you can use a LM339 (quad comparator) instead of a dual comparator (LM393). A dual 7556 would also work, but I'll go with the 40106.
     
  19. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    OK, here is the first attempt. I have never built this particular circuit, and I don't know the formula for the two oscillators. I was aiming for 10Khz as the modulating frequency, and .5Hz for the slow oscillator. Variations of it have worked well for other applications though.

    [​IMG]

    I made the following assumptions. 20ma for D1, and 2.0V Vf for the LED, 9VDC = Vcc. You can add a variable resistor in series of R2, and you may want to drop the capacitor to 47µF to 100µF.
     
    Last edited: Sep 30, 2010
    DaedalusYoung likes this.
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's a circuit I whipped up for someone a few months back; it uses a single LM339 quad comparator IC plus supporting resistors and capacitors.

    You're planning on using a 7805 regulator with your 74AC14; that will make your battery run down that much faster. Try something like this instead.
     
    DaedalusYoung likes this.
Loading...