PWM to Analog Voltage

Thread Starter

Miramax

Joined Nov 12, 2006
22
I am looking to convert a PWM signal to to analog voltage to drive a LED 10 segment bar graph.
I found this handy number here http://www.ontrak.net/pwm.htm and it looks pretty easy, its a low-pass RC filter made with a resistor and cap.
I want to drive a LM3914 and 10 led bar graph with the analog voltage to indicate what the duty cycle is. 0 leds lit = 0% duty ~ 10 leds lit = 100% duty.
If the PWM is at 1KHz, what size resistor and cap is needed?
Sorry for the noobishness, I've been learning tons from you guys so far :D
Thanks again :cool:
 

bertus

Joined Apr 5, 2008
22,277
Hello,

You could make a lowpass filter that has a 10 - 20 times lower frequency as the PWM signal.
So a filter between 50 Hz and 100 Hz will work for the 1KHz PWM.

Greetings,
Bertus
 

Thread Starter

Miramax

Joined Nov 12, 2006
22
How would one go about doing this? Same circuit just different values for the cap and resistor right?
I need to do some more studding ;)
 

thatoneguy

Joined Feb 19, 2009
6,359
The standard Value of 22uF, replacing the 1uF, and a 47 Ohm resistor in place of the 4.7k would give around a 150Hz Lowpass Cutoff in the circuit posted above. 100 Ohm would move it down to around 100Hz.
 

SgtWookie

Joined Jul 17, 2007
22,230
The standard Value of 22uF, replacing the 1uF, and a 47 Ohm resistor in place of the 4.7k would give around a 150Hz Lowpass Cutoff in the circuit posted above. 100 Ohm would move it down to around 100Hz.
Not so good; that'll result in high current in the resistor to charge/discharge the capacitor, and high current in the output of the device.

Go fish. :p

Change the cap back to 1uF (or smaller) and increase the resistance.
[eta]
The existing circuit has a low-pass of around 30Hz. If you just decreased the 4.7k resistor to somewhere between 1.5k and 2k, you'll be in the ballpark of where you want to be.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
My apologies, I forgot the application. I was thinking "output"/low impedance.

Sarge is up about 3 on me now. :(
I've pulled more than my share of doozies on here. :rolleyes: ;)

Yes, if our OP was looking to drive a speaker or something, then they'd need a low impedance output. But when driven by a microcontroller, keeping the uC's I/O limits in mind has to be a pretty high priority.

a 1.5k resistor will give a max source/sink current of around 3.33mA; easy for it to handle even with many other I/O loads.
 
Top