Bill Marsden's PWM circuit

Discussion in 'General Electronics Chat' started by shortbus, Oct 26, 2010.

  1. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
  2. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Nope. Pin 2 and 6 connect make the 555 a Schmitt Trigger, which is the whole point. The circuit is a really simple triangle generator, which I showed in the schematic.

    [​IMG]

    Side note, you can find all my images in my albums, which are also open to the public.

    Pin 5 has lots of other uses. Mostly it is the 2/3 point in the resistor chain that sets the 1/3 and 2/3 volt references the 555 uses. You can use it to vary frequency, but the triangle wave will bounce between the 1/3 voltage point and the new voltage. The peak to peak of the triangle wave will grow or shrink accordingly.

    This circuit depends on the two (1/3 and 2/3) set points for proper operation.

    However, I am a strong advocate of experiment and find out. Play with it, make it, see what it does. If something happens you don't understand ask (I like to figure things out myself, it is part of the fun).

    BTW, I just did a total rewrite of the whole article, mostly adding new material. A lot of it leans heavily on this circuit for new stuff. Faders and flicker circuits for example.
     
    Last edited: Oct 27, 2010
  3. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Thank you Bill for the answer! I have a couple of questions, in your circuit are the out puts from the LM339 and pin 3 of the 555 synchronized? Do they change state at the same time?

    Should pin 5 on the 555 be coupled to ground with a capacitor or just left floating in this circuit?

    Thanks again, cary
     
  4. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Is there a on-line calculator for figuring the resistors (R1, R2) and the capacitor (C1) for a given frequency? The calculators I found using Google require knowing the values and it gives the frequency.

    cary
     
  5. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    OK, last first. The equation is on the schematic, and the resistors are in series, which mean they add. You must have some resistance in the circuit, or the 555 could be damaged.

    Calculators are cheap, I keep one on my desk next to the monitor. I don't need or use online calculators much, but then I used slide rules before I used calculators.

    The 555 oscillator is based on a 555 Hysteretic Oscillator. The triangle wave points match up with the square wave edges, so there is a 90° phase difference there. However, the PWM square wave and 555 square wave will be in exact sync.

    [​IMG]

    Whether pin 5 has a capacitor or not depend on your application. A lot of folks would put on there on general principle. It can't hurt, and it might help. Basically if the circuit is in a noisy environment (power supply noise that is) you will need it. For general experimental use I don't bother.
     
  6. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Always 90° degree?

    Does phase difference even be meaningful for two waves with same frequency but different shape/form, e.g. one sawtooth and one rectangular?
     
  7. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Actually it does. If you look at the fundamental sine wave wave buried within the waveform the 90° is real. If you use a comparator to convert the triangle the 90° is real (hmmm, we've had more than one thread asking for that, have to remember it).
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    This part is written just a bit confusingly:

    In a standard BJT (transistorized) 555 timer, there are three ~5k resistors in series that set the threshold and trigger trip points at (nominally) 2/3 and 1/3 of Vcc; 2/3 being threshold (reference for pin 6) and 1/3 being trigger (reference for pin 2). CTRL, Pin 5, is connected to the upper junction, or the normal 2/3 threshold.

    If you force pin 5 to be some other voltage, then the trigger will be ~1/2 of the voltage input on pin 5. When the 555 is wired as an astable multivibrator (oscillator), decreasing the voltage on pin 5 will cause the output frequency to increase; and as the voltage on pin 5 decreases, the duty cycle of the output decreases. [eta] If the voltage on pin 5 decreases below ~1.2v, operation becomes unstable. See the 1st attachment.

    CMOS 555 timers use much higher value resistors for the threshold and trigger divider; 100k is pretty common. Consult the datasheet for your particular timer to determine the value used.

    It is typical to use a 10nF (0.01uF) cap on a BJT 555's pin 5 to ground to keep the threshold level stable. For a CMOS 555, a 470pF or 510pF cap would be equivalent. Using a 10nF cap on a CMOS 555 would cause it to take 20x as long for the output frequency to become stabilized, as 100k is 20x 5k.

    With either timer wired in a standard astable multivibrator configuration, the very first output pulse will be considerably longer than subsequent pulses. If this is of concern, you can effect a cure by dividing the timing cap's value by 3, and use 2/3 the capacitance to ground, and 1/3 to Vcc. See the 2nd attachment.

    Note that at a minimum, the bjt 555 timer requires one 0.1uF (100nF) metal poly film or ceramic capacitor placed directly across the Vcc and GND terminals, and one 1uF or larger aluminum electrolytic placed across Vcc and GND nearby. Otherwise, the momentary dead short across Vcc that occurs when the 555 changes states will lead to unpredictable (unreliable) operation.
     
    Last edited: Oct 28, 2010
  9. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    As I've said before this forum is the best of the best!

    Thank you all, Bill, SgtWookie, eblc1388, for your answers! Sorry that my questions sound so dumb, but I do learn a lot from you guy's.

    cary
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    They haven't been "dumb questions", just "good questions".

    It would take a good bit of tinkering to figure out just what was going on if someone didn't explain it.

    If you refer to National Semiconductors' datasheet on the LM555, you'll see a schematic of the "guts" of the IC. It's worthwhile to build it in a simulator such as LTSpice, and play around with it. Much faster than breadboarding.

    BTW, the "NE555" that comes with LTSpice does not accurately represent a "real world" part; it is optimized for simulation speed. It has the output voltage swing of a CMOS 555, and the current source/sink capability of a bjt 555.
     
  11. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    As for the comment about dumb questions, I am in total agreement with Wookie. Even if the answer seems simple after the fact, asking the question is not dumb. It saves a lot of time in the long run, and prevents misunderstandings.

    The hysteretic oscillator is not limited to the 555, it is just a convenient chip to use. Other chips, such as the 7414 or 40106, have six inverters in a package, and they work just as well for this. An inverting Schmitt Trigger has been referred to as a single bit A/D (so have comparators), and seems to have a lot of odd applications that are frankly analog. Many of the 555 circuits I have come up with can be replaced with a alternate design or chip that has an inverting Schmitt Trigger on them.
     
  12. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Thank you for being kind about dumb questions. I can make about anything from metal or wood, reverse engineer from pictures in a catalog, wire a house or car, but electronics is kicking my butt !

    OK, new question, the formula is - F= 0.7/ (R1+R2)C1) How do you know what values to try first for the resistors and cap? For you guy's that have been at this for a while you probably have a good idea what to try, but is there a rule to use for a first try?

    This is stuff that I can't seem to find in any book or on the web. Is there a "rule of thumb" for this ?

    cary
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Have a look here:
    http://www.schematica.com/555_Timer_design/555_Timer_Free.htm

    Download it, and give it a go.
    I've been using their Timer Pro for a few years in the "demo" mode. Seems to be pretty decent.

    Where possible, I like to keep the timing cap at 0.47uF or smaller, because the larger the uF, the larger the physical size, and generally the more leakage you get. Also, it's easier to get tighter tolerance caps (like poly metal film) in the lower sizes. Aluminum electrolytic caps aren't that tight with their tolerances.

    Resistors are pretty much the same size over a wide range of resistances, until you get fairly low in resistance for the Vcc; then you need to increase the wattage rating and the physical size goes up.

    Keep in mind that if you're using the original astable configuration consisting of R1, R2 and C1, you want to keep the maximum current in R1 to be under 10mA, as pin 7's saturation voltage starts getting pretty high after 15mA, and power dissipation in the IC goes up. A minimum of 100 Ohms per volt of Vcc is a good rule of thumb there. More is even better.

    If you start getting into really high values for R1/R2 (like >5Megs) then it's time to look at increasing C1.

    If you start getting into really low values (say, under 1k) for R1/R2, decrease C1.
     
  14. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Sounds good to me.

    The exception is really long time durations. You may have to have both a large capacitance and resistance. Old electrolytic capacitors tend to be leaky, which is a circuit killer. There are ways to rejuvenate them partly, or you use a newly manufactured capacitor. Interestingly, working them keeps them fresh, it is sitting around that makes them degrade over time.

    Some folks take a generalization and make it more than it is. I have used 1000µF up to 4700µF in a 555 timer with no problem, but I am also aware a problem can spring up. I have seen folks claim it can't work, which is not true. The correct statement is it may not work, you have to understand why it is so to use it correctly. I have also used really large resistors with small electrolytics, another supposed failure, with no issues.

    Something I have found to be an interesting experiment is to watch a capacitor charge or discharge with a DVM. With long RC durations it is eminently practical to do so.

    Drift is also a problem. A large electrolytic is not stable like smaller values. If you have a circuit that is measuring 5 minutes you might be able to live with ±10 seconds or more of drift. It depends on the application.
     
  15. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Sgt. and Bill thanks again for your help!!!!!!

    cary
     
  16. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Help!!! I've spent so much time with a 555 calculator that my eyes are crossed and my brain is about to explode!

    I'm trying to get a R1, R2, C combination that will give 5 kHz on one end and 50 kHz on the other, is it possible? I can't seem to get one that will do it.

    Would some one be willing to help?

    Thanks, cary
     
  17. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    This is basic algebra, set up the two equations and solve. First though, show the configuration you want to use. This one?

    [​IMG]

    R1 should be a constant, to make things simpler. Say, 1KΩ. This means you get to play with C1 and R2 to find a balance between the two values, with R2 being a variable. You will also need a series resistor, call it R2a. Goes without saying you want standard values for the resistors/capacitors.

    You could also use this configuration...

    [​IMG]

    Pick one.
     
  18. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    Bill, I want to use the Schmitt trigger schematic. Algebra was never my strong suit, got C's and D's in it back in 9th grade, about 48 years ago :( Even worse now!
     
  19. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Sounds like me and calculus.

    OK, work this from the resistors. Ra is a fixed resistor, and it will be much smaller than Rb, which is a variable. Eliminate all factors on both sides (0.7, C) and you have

    50K Ra = 5K (Ra + Rb)

    This is the resistor ratio of the two ends.

    50K Ra = 5K Ra + 5K Rb
    45K Ra = 5K Rb
    9 Ra = Rb

    Ra will be 1/9 the size of Rb. From there it is gravy.

    I'm picking an arbitrary 10KΩ for the variable Rb (because it is common variable resistor). Ra has to be 1.1KΩ (there really is such a size, however you can also use 1.2KΩ in parallel with 15KΩ). Plugging this into the formula

    F = 0.7 / (C(Ra+Rb))
    C = 0.7 / (F(Ra+Rb)), C works out to 0.0126µF

    This gives us ball part figures to work with.

    C = 0.01µF, for 50KHz you would need 1.4KΩ (rounding to 1.3KΩ).

    F = 0.7 / C (Ra+Rb) = 0.7 / 0.01µF (10KΩ + 1.5KΩ) = 6.09Khz
    F = 0.7 / C Ra = 0.7 / 0.01µF 1.5KΩ = 46.7Khz

    Close enough?

    Lets say for the sake of argument you took a 0.01µF and 0.0027µF in parallel.

    F = 0.7 / C (Ra+Rb) = 0.7 / 0.0127µF (10KΩ + 1.1KΩ) = 4.97Khz
    F = 0.7 / C Ra = 0.7 / 0.0127µF 1.1KΩ = 50.1Khz
     
    Last edited: Nov 2, 2010
    shortbus likes this.
  20. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Another thought, C = 0.015µF, Ra = 910Ω, Rb = 10KΩ

    F = 0.7 / C ( Ra + Rb) = 0.7 / 0.015µF (10KΩ + 910Ω) = 4.28Khz
    F = 0.7 / C Ra = 0.7 / 0.015µF 910Ω = 51.3Khz
     
    shortbus likes this.
Loading...