Instructables

555 pwm AND frequency controllable?

Hello,


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,

Elecotrials

Picture of 555 pwm AND frequency controllable?
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
Electorials (author)  steveastrouk3 years ago
Hello again,

That method sounds very logical, and easy, but not with the components I have now :/

you also mentioned it would be possible with multiple 555's, how is that?
Set the first 555 as a square wave generator, of variable frequency, set the second as a one shot of variable width....

Steve
Electorials (author)  steveastrouk3 years ago
I also thought of that, but te problem is that changing the frequency will also change the duty-cycle because the on-time-length stays equal, and the off-time-length becomes larger :/
Have you any op-amps ? You can do this with two of them !

Steve
Electorials (author)  steveastrouk3 years ago
I have one IC with 4 op-amps inside it :)
Electorials (author)  Electorials3 years ago
ok, I'm testing some stuff with it and I'm getting somewhere :D
I have an oscillator already. I tried to create the circuit my own and it's working perfectly already :D
Electorials (author)  Electorials3 years ago
something really weird happened.
It was working perfectly, I could change frequency, duty cycle from 0 to 100 and output voltage (top to top voltage) also from 0 to Vcc
I tested on an LED, working great, I could clearly see the duty cycle working fine,
and the frequency was also perfectly adjustable now.

Then I tested on a speaker, also no problems.

After that, I tested on my flyback, with a MOSFET and the two UNUSED (totally not connected) OpAmps died :S

the mosfet is still intact, the two other OpAmps are still working (for switching on and off) but they don't work for amplifying anymore :(

is it possible that because the IC legs were not connected, that static voltages were building up on those legs (caused by the flyback transformer)?
maybe that killed the IC?
mspinks2 years ago
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.
Electorials (author)  mspinks2 years ago
oh that's not such a good result :/

I think we shouldn't use 555 timers for this.
They are very good for frequency but not for PWM controlling.

It's a lot easier with two opamps:

First op amp creates a variable frequency sawtooth
Second opamp has a referance voltage which gets compared to the sawtooth
-> perfectly individual frequency and 0-100%PWM adjustable

like this one: http://www.instructables.com/id/The-ultimate-PWM-driver-for-many-applications/step2/The-schematic/
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.
Electorials (author)  bob4analog2 years ago
Hello,

Yes indeed, a simple POT should do the trick ;)
Thank you for the reply!

Electorials
Electorials (author)  mspinks2 years ago
Thank you!

And sorry for my late reply :/
It sounds like pin5 would be a good solution. I'll have to test that ;)

Greetings,

Electorials
bob4analog2 years ago
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.
Electorials (author)  bob4analog2 years ago
But I guess it's easier then to just use two opamps, in one IC.
Using a second 555 as comparator is a little weird because an opamp can do the same thing with less connections.

However it is true that you can trick two 555's into a nice PWM controller.
NathanTaub3 years ago
http://www.instructables.com/id/Insanely-easy-independent-control-of-frequency-and/

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.
Electorials (author)  NathanTaub3 years ago
Hi,

Thanks for helping!
It looks like a nice idea. Did you invent this yourself or did you catch the idea from somewhere else?

And also, have you tested this yet?
It looks like it would work though.

Thanks,

Electorials
I suggest using an IC that is intended to do this.  For example,  the SG3524
http://www.ti.com/lit/ds/symlink/sg3524.pdf
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.
Electorials (author)  Jack A Lopez3 years ago
Thanks for the reply, I'll maybe try to do that, but it's sad that I just bought 555 timers for this project when I can't use them hehe
C'est la vie. BTW, what range of frequency, and what range of duty cycle, are you looking to achieve?
Electorials (author)  Jack A Lopez3 years ago
I would like to have really wide ranges:
5kHz to 50 or even 100kHz
and duty cycle from 0 to 100% or something close to that like 10 to 90%