issue with pwm duty cycle

Thread Starter

simeonz11

Joined Apr 29, 2008
98
So I have 50 % duty cycle signal that is driving an and gate , this signal is phase locked to another frequency via a frequency divider . This "other" faster frequency is always 50% duty cycle and that will never change

What I wish to do is control the duty cycle of this normally 50/50 duty cycle frequency . It will be opreating in the ranges of 1khz to 50 khz

I wish to control the duty cycle from a range to 0 to 100% so I can drive my and gate with this signal .

I am just not smart enough to figure out how I should do this , somebody plz help me .
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
If your input time base is going to be continuously variable, it'll be tough to get an accurate PWM duty cycle out of it.

One rough way to approximate it could be to use a microcontroller, counting the uC's clock pulses between positive edge triggers, then multiplying that number times the desired percentage of ON time. However, this means you'll have to have at least two positive-going triggers before you'll start getting a PWM output, and the accuracy will suffer as a function of the rate of change of the input trigger time and the uC's clock frequency.

Also, as the input frequency goes up, the accuracy will decrease.
 

AdrianN

Joined Apr 27, 2009
97
I would use a 555 in a monostable circuit. The only deviation from the classical monostable circuit is a differentiator circuit that needs to be connected in front of the monostable. This will help reduce the pulse width of the input signal, since the 555 monostable cannot output a pulse width smaller than the input pulse width, which, in your case is 50% of the signal period. The duty cycle can be varied with a potentiometer which acts as "R" in the monostable RC constant.

Here are some limitations though: The minimum dutycycle will be limited by the differentiator output pulse width. It cannot be zero. Also, I don't think you can cover the entire range of 1kHz to 50kHz with this circuit. 555 can cover the frequency range, but the time constant of the monostable, and the time constant of the differentiator might not cover it. You might need to split the range in two.
 

SgtWookie

Joined Jul 17, 2007
22,230
AdrianN,
I (very briefly) considered a monostable 555 timer solution, but discarded it. Were the input trigger a relatively stable frequency, the 555 timer would've been a good choice.

However, with the input trigger varying anywhere from 1kHz to 50kHz, I can't see a simple solution towards maintaining the PWM ratio across such a broad range - or even a somewhat more narrow range. Granted,one could use pin 5 to vary the trigger levels, but we don't know for certain what environment our OP is talking about - and analog solutions tend to be quite dicey in a high-noise environment.
 

AdrianN

Joined Apr 27, 2009
97
SgtWookie, yes, you are right. 1 to 50kHz is a broad range and I listed it in my limitations list. I posted this solution just in case simeonz11 would consider to go with a smaller range, and the time base is not continuously adjusted. The input pulse can be made small enough with a differentiator and, maybe, a formatting circuit like a fast comparator. 555 can see down to 2 us. Lower than that is a stretch. The monostable RC is the main limitting circuit. If the frequency is varied continuosly between 1 and 50kHz, the PWM ratio cannot be mantained. In that case, indeed you need a uC. But if the frequency is adjusted from time to time, the PWM can be adjusted as well. We don't know all the details of his application. Thank you for your input.
 
Top