PWM duty cycle to frequency converter?

whoaru99

Epic Member
Anyone know of a circuit that will take duty cycle of a PWM signal and convert that to something akin to TTL signal whos frequency varies proportional to the PWM duty cycle?

For example, the PWM signal is 100Hz and typically varies between 23% and 78% duty cycle. From this duty cycle I would like to get a TTL-type signal that proportionally follows the duty cycle.

A range of TTL-type output that tracks 0-100% duty cycle would be most excellent. An exact scale factor isn't super critical, but from top of my head I something around 2.5Hz per 1% would work. I can confirm that a bit later but I'm OK with concepts at this point.
 
Guess I should note for the record in the past I have used a RC circuit to extract somewhat of an average voltage from the PWM signal. Then, fed that voltage to the VCO input of a function generator and used the function generator TTL output. It worked, sorta. Am hoping for something maybe a bit more streamlined and efficient than that.
 
Possibly you can probably use the VCO section of an MC14046B (or something similar) to replace your function generator. It has a voltage-controlled oscillator that can generate TTL output levels. Not sure about getting 250 Hz, you might need to run it faster and use a divider. That's an old chip, presumably there are newer ones.
 
xr2206 chip will also work - it's been around a long time too, but is still available. (it is actually overkill)
I would think a simple VCO circuit with some kind of integrator connected to your PWM.
Many chips used for audio oscillator circuits can be voltage controlled and have (or can be easily implemented) TTL output.
My 2 cents...
 
I think I'd go with a microcontroller. PIC, Arduino, AVR.... The 250Hz max frequency should be easily doable in even a fairly low power device.
 
I agree with Terry's suggestion, but if you want to stick with conventional analog signal processing, then I think you're looking for a 'ramp and sample' or ramp generator followed by a S&H (sample-and-hold) circuit driving a VCO. The ramp generator is reset at the start of each timing interval and simply allowed to run up. The S&H is triggered at the end of the timing interval, so it picks off a ramp voltage proportional to time duration and maintains a constant VCO control voltage between sample strobes.

There are many ways to implement these circuit blocks, depending on the degree of precision required. If the application isn't demanding, you could go with cheap 4000 series CMOS chips for much of it. Get yourself a copy of Don Lancaster's old CMOS Cookbook for a great introduction to this stuff.
 
Last edited:
A small CPU with an internal timer, a start timer interrupt, a stop timer interrupt, and a frequency generator. Start on zero cross, stop on interrupt (detection of PWM start edge). Use each 1/2 cycle PWM delay time to determine freq generator output frequency. You will need to know the time period from zero-cross to zero cross to auto-normalize.

I suggest that you might find a PIC chip that will provide the necessary on-board peripherals to do the job, and they will give you a c-compiler for free.

Enjoy,
Rich P
 
I had wondered if something like Arduino would work. I'll get one of those to experiment with.

In the mean time I found a passible workaround. Doesn't work below 20% duty cycle but that's below the typical range anyway.

Grabbed an old CPU muffin fan out of the junk box. This fan has a tach output. The PWM drives the fan speed, the tach output provides the variable frequency signal. I did have to change the scale factor on the feedback loop but that has a wide, easily programmable range.
 
Back
Top Bottom