# Keeping duty cycle constant while changing frequency

Discussion in 'Math' started by magnet18, Mar 25, 2011.

1. ### magnet18 Thread Starter Senior Member

Dec 22, 2010
1,232
124
Alright, I have the equations F=1.4/((R1+2R2)*.000000001) and D=R1+R2/(R1+2R2)
and I need to pick a frequency and keep that frequency while getting different duty cycles, what's the best way to do this, short of an overly excessive 3D graph?
Thanks

2. ### Georacer Moderator

Nov 25, 2009
5,142
1,266
I don't see where that problem could be applied, but the only solution I can see it to remove the variable term R1+2R2 from the F equation. For example:

Say that you want F=1kHz. You write:
$R_1+2R_2=\frac{1/4}{10^{-9} \cdot 10^3} \Leftrightarrow \\
R_1+2R_2=0.25 \cdot 10^6 \Leftrightarrow \\
R_1=250K-2R_2$

As long as that relation holds, no matter what the Duty Cycle will be (as a function of R1 and R2), the frequency must be stable.

In fact the Duty Cycle will be:
$DC=\frac{R_1+R_2}{250K}$

3. ### shortbus AAC Fanatic!

Sep 30, 2009
4,004
1,525
Is this just a math problem, or is it for your plasma speakers? Are you using a 555 to generate the frequency?

If yes to the second question, why not use Bill Marsden's PWM circuit? http://forum.allaboutcircuits.com/showpost.php?p=117641&postcount=6
The one in figure 4.3 works real good for a stable frequency variable duty cycle.

4. ### magnet18 Thread Starter Senior Member

Dec 22, 2010
1,232
124
Yes, its for the plasma speaker, yes its a 555, and because I have this design finally debugged and don't have any op-amps to use

@ georacer, I'm not sure i follow entirely... I think I get the first part (assuming the 1/4 is supposed to be 1.4), but basically I should just pick an R1 value and modify the R2 value accordingly?

5. ### Georacer Moderator

Nov 25, 2009
5,142
1,266
Oops, sorry for the typo. 1/4 is 1.4 actually.

As for your question, yes, you pick a value for R1 and use the relation R1=250K-2R2. Mathematically, it should work.

6. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,677
900
What duty cycle do you want? Variable frequency with 50% duty cycle is quite easy to do, if that will work for you.

John

7. ### shortbus AAC Fanatic!

Sep 30, 2009
4,004
1,525
The Opamp is a 339 comparator not a regular opamp.

You might want to consider this fact about the 555; "Note that the duty cycle of the 555 timer circuit in astable mode cannot reach 50%. On time must always be longer than off time, because Ra must have a resistance value greater than zero to prevent the discharge transistor from directly shorting VCC to ground. Such an action would immediately destroy the 555 IC." Taken from; http://www.play-hookey.com/digital/timer_555.html

I've also read that in some of the 555 App. notes. And that when you do vary duty cycle on a 555 the frequency changes/drifts from the base frequency. Normally the 555 is used for variable frequency not duty cycle.

Thats why you use the comparator with the 555. The 555 sets your frequency (triangle wave) and the comparator changes the duty cycle by switching at the voltage point on the triangle wave selected for duty cycle.

But then again its your project.

8. ### magnet18 Thread Starter Senior Member

Dec 22, 2010
1,232
124
@georacer, thanks

@ john, by keeping R2 much larger than R1, or is it another way using only the 555?

I have no comparators either

This can be overcome with a diode, but it changes the equations
In any case, I don't intend to test lower than 50% duty cycle

I think I'll be OK, I've simply decided to set an R1 value and test at many R2 values, then pick another R1 value and test at the same R2 values again
Rinse and repeat

Which is why I'm going into remission for a few hours to collect data... all hundred something points

9. ### Wendy Moderator

Mar 24, 2008
20,765
2,536
Actually, a 555 will do it, but not with that schematic. I've shown how to make duty cycle and frequency totally independent, it is pretty easy. See Figure 4.3 of LEDs, 555s, Flashers, and Light Chasers, it works extremely well and can do a full 100% with careful component selection.

Another approach is this...

My Cookbook

The diode messes up the math, but the resistors are decoupled, and you now have two relatively separate RC equations for on/off times.

The problem with the original oscillator you were looking at is you can't vary the frequency or duty cycle without adjusting the other. The only think you can do is make R1 small enough to minimize the effect. The smaller value R1 is, the more square the waveform duty cycle, and the less effect R1 has on the frequency. Make R1 small enough however, the 555 burns up.

10. ### shortbus AAC Fanatic!

Sep 30, 2009
4,004
1,525
Bill, the schematics you just posted, if you put a pot in place of one of the resistors(R1 or R2) then it will throw off either the frequency or the duty cycle when adjusting/changing the other, correct?

Maybe I misunderstood what Magnet was trying to do. Thought he was picking a frequency and changing duty cycle. Even with the diode adjusting one will change the other won't it?

frosr6 likes this.
11. ### Wendy Moderator

Mar 24, 2008
20,765
2,536
Yes, it will change the frequency. The only schematic I am aware of that will vary duty cycle without changing the frequency is the first on, the one in my light chaser article. There the decoupling of frequency and duty cycle is total.

The second schematic decouples the resistors from each other (which was my point).

The third schematic is basic, and everything depends on the other. It is mathematically precise however, as is the first schematic.

12. ### magnet18 Thread Starter Senior Member

Dec 22, 2010
1,232
124
Could it be done with just a 556, or 2 555's?

13. ### Wendy Moderator

Mar 24, 2008
20,765
2,536
No. The 555 is both the oscillator and triangle wave generator. The comparator is the PWM modulator. Wookie and Ron have shown some good designs that use a quad comparator to do the same thing, the theory of operation is very similar (one of the comparators are used as a schmitt trigger).

With just a little modification you can turn this into the heart of a class D amplifier, or (looking at it just a little differently) a voltage controlled PWM circuit. While it will work as is, the triangle wave should be linear for best audio reproduction. The triangle wave doesn't need to be symmetrical for good performance, just linear.

I'm not quite clear on the equation used for the frequency, it will be approximately F=.7/(RC).

I'll draw a high drive PWM circuit if you want?

Last edited: Mar 27, 2011
14. ### magnet18 Thread Starter Senior Member

Dec 22, 2010
1,232
124
By my earlier comment what I meant was if it would be possible to wire another 555 as the comparator? Guess not.

Thanks, but what I'm thinking now that I have it working somewhat