# Duty cycle to frequency

Discussion in 'General Electronics Chat' started by Tobias, Jul 20, 2011.

1. ### Tobias Thread Starter Active Member

May 19, 2008
158
0
I need to measure an incoming PWM and convert it to a specific frequency.
460hz/1% duty cycle.

I am going the PIC route now. I am learning about how to config the timers to get a frequency. I am getting there but curious if there are other options to this project.

2. ### tom66 Senior Member

May 9, 2009
2,613
214
You could divide the frequency by two. This would give you 230 Hz at 50% duty which is much easier to measure using a small microcontroller.

3. ### Tobias Thread Starter Active Member

May 19, 2008
158
0
I should clarify the incoming PWM is operating at a fixed 1000hz too.

Mar 24, 2008
20,772
2,540
5. ### tom66 Senior Member

May 9, 2009
2,613
214
So you want to convert the 1kHz to 460 Hz?

6. ### strantor AAC Fanatic!

Oct 3, 2010
4,302
1,989
If I understand OP correctly, the idea is to take a PWM input signal of 0-100% and convert it to a variable frequency AC signal of 0-460Hz

7. ### tom66 Senior Member

May 9, 2009
2,613
214
Voltage to frequency converter?

(With voltage being the result of the PWM being filtered.)

Problem is, I know no V-F converters that go down to 0 Hz... most are 10 or 1 Hz.

8. ### Tobias Thread Starter Active Member

May 19, 2008
158
0
Incoming PWM is 1000hz.
I want to equate the duty cycle of the PWM into a frequency.
For every 1% duty cycle is 460 hz.
So 1% is 460 hz
50% is 23000
100% is 46000

I am not stuck with the mentioned calibration.

9. ### Tobias Thread Starter Active Member

May 19, 2008
158
0
I was thinking the V-F route, yet the amplitude of the PWM might vary with battery level.

10. ### strantor AAC Fanatic!

Oct 3, 2010
4,302
1,989
wait, so you are trying to accomplish this with a PIC? IE have the pwm signal go into the pic, pic reads the duty cycle, then pic outputs the frequency?
so are you looking for code?

11. ### Tobias Thread Starter Active Member

May 19, 2008
158
0
I am getting closer and closer with a PIC, I am just wondering if I am missing some other option.

12. ### tom66 Senior Member

May 9, 2009
2,613
214
If you use a comparator or a logic buffer (two logic inverters in series) then the amplitude will stay constant no matter what the battery voltage is.