Author Options:

555 pwm AND frequency controllable? Answered


I've been breaking my head on this for a while now, and still couldn't find a correct solution for this.

I want to be able to adjust the duty cycle (pulse width) with one potentiometer, and the frequency with another potentiometer, using a 555 timer.
Adjusting the frequency shouldn't change the duty cycle! (which is the problem in All of the circuits I find online).

This is an example of a circuit I find online, many of the circuits look just like this one (see picture)

Now, the problem is that when you increase the resistance of the potentiometer for adjusting the frequency,
that makes sure you can never get 0% or 100% duty cycle anymore! or not even close to that.
It's because increasing that resistance, also decreases the 'discharging current' of the capacitor, so it will also increase the discharging time when that's not wanted.

Without R2 it works perfectly, from 0% to 100% duty-cycle; but with the frequency potentiometer it all gets messed up.

It's a little difficult to explain, I'll try it with another example :)

To get 0% duty-cycle (or something close to that, like 10%), you'll need to make sure the path for Discharging the capacitor goes near 0Ohm.
Increasing the potentiometer for the frequency makes that impossible because it's in series with the capacitor's charging and discharging circuit. So that would also increase the discharging time while I don't want that.

When the resistance of the frequency potentiometer increases, the duty-cycle gets variable between just something like 45% and 55% (example) so that's not good.

Is there any way do do this? :/

Thanks in advance,



Don't do it with a 555, or at least not one on its own. The classic method is to generate a sawtooth of fixed amplitude, and then put that into a comparator, with a variable voltgae to compare it against. The sawtooth genny is variable frequency


remember you can use a 555 and with an opamp on it's cap and get duty from the opamp. the resistors above and below the pot is the same value as the pot.

Well... the 555 certainly has it's limitations, but I think it can be 'tricked' into doing what you want it to.

I've played with these chips and I even made an PWM for a transmitter, altho I did use a comparator after the 555, and the audio input was connected to the comparator reference...worked great!

The only other idea I can think of (rather than the pin-5 adjustment method), is to use a 556...or just use two 555's. the 2nd 555 can be simply set up as just a comparator.

The saw-tooth / triangle waveform from the timing capacitor can be connected to a small 1 transistor buffer, then connect to pin-6. Apply the variable bias voltage at pin 6 thru some kinda resistor; the waveform will 'ride' on the DC bias and you should be able to adjust it wherever you want.

This is theoretical at this point. I've made mine work before by using a similar method, but I gotta go back thru my drawings and find it, then I'll be glad to post it.

Yes, you can get a 'tailored' chip that'll do it all. But if yer just look'n for a simple, elegant way to do it using readily available parts, I think with a little perseverance, it can be done with an ordinary 555...or two.

You are precisely correct. The frequency should not change the duty cycle. Something I've thinking about for quite a long time (I'm glad I'm not the only one who was bothered by this) I believe the answers we seek lie within the poor, misunderstood pin 5 which always gets left out. Basically, from what I gather, you make an astable pulse train (the sample rate I believe) which triggers a monostable. But make sure the time period of the monostable is slightly less than the period of the astable. (Something about keeping it from retriggering.) So the duty cycle would only be about 0-95% or whatever the percent the monostable period is of the astable I think. Apply your control voltage to pin 5 and it will set the duty cycle and stay at the correct percentage no matter the frequency. You could even apply a sine wave to pin 5 if you want to. It should produce the pwm equivalent. (at least I hope) I'll would like to try experimenting a bit this weekend. I'll let you know if it works out.

Good point! I've also seen 'frequency' and 'pulse width' used interchangably with referring to PWM's (such as speed controlers for DC motors). With PWM's, pulse width duty cycle changes, NOT frequency.

And pin 5- yes, this would / should make a good control point for adjusting the pulse width. Yes, adjusting control voltage to pin 5 should set the duty cycle without disturbing the RC time constant. The only caveat, is that the internal comparator (pin 5) is connected to a pull-up resistor to VCC (pin 8). So if an external voltage source is used and connected to pin 5, it should probably be a low imedance source such as found with an op-amp output in a voltage follower confiuration. Or, perhaps just a simple pot from pin 5 to ground would work for manually adjust ing the control voltage (It needs experimenting with this).

I was able to conduct my experiment finally. I set up a simple PWM similar to the example in the datasheet using two 555 timers and a pot to control the pulse width on pin 5. Unfortunately, it didn't work quite as well as I had hoped. If you'll recall, the comparators have two voltage thresholds: One at 1/3 Vcc and the other at 2/3 Vcc. Pin 5 only allows you to change the upper threshold voltage level. So in this case I can vary my pulse width from 33.3% to 99%. This wasn't enough for what I wanted, but it certainly did work to a certain extent.


It's not particularly clear -- I kinda rushed the instructable when I saw this question -- but I think that with this information you should have no trouble building the function generator you want.

Have you any op-amps ? You can do this with two of them !


Set the first 555 as a square wave generator, of variable frequency, set the second as a one shot of variable width....


C'est la vie. BTW, what range of frequency, and what range of duty cycle, are you looking to achieve?

I suggest using an IC that is intended to do this.  For example,  the SG3524
is an oscillator IC that lets you control its duty cycle, by way of a voltage input.  The frequency of the oscillator is set by two external components, a resistor and a capacitor.   Using this IC, it should be possible to build a circuit with two knobs, i.e. two potentiometers, one pot that adjusts frequency, and a second pot that adjusts duty cycle independent of the first pot.  Let me know if you want some hints as to how to build this circuit.

The only reason I mention the SG3524 is because I have used that one a couple of times, and succeeded in making it work.  I think I've even got a few of the IC itself around here somewhere.  Also this IC should be cheap, about the same price as a 555, but maybe not as widely available.