PWM to Analog Voltage

Discussion in 'General Electronics Chat' started by Miramax, Apr 15, 2009.

  1. Miramax

    Thread Starter Member

    Nov 12, 2006
    22
    0
    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:
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    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
     
  3. Miramax

    Thread Starter Member

    Nov 12, 2006
    22
    0
    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 ;)
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    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.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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: Apr 15, 2009
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    My apologies, I forgot the application. I was thinking "output"/low impedance.

    Sarge is up about 3 on me now. :(
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  8. Miramax

    Thread Starter Member

    Nov 12, 2006
    22
    0
  9. italo

    New Member

    Nov 20, 2005
    205
    1
    if you bother to go to MAXIM.com they have all kinds of chips to drive LED. I just got two free samples to try it.
     
  10. Miramax

    Thread Starter Member

    Nov 12, 2006
    22
    0
    Well basically I am trying to make a duty cycle meter using 10 LED's ;)
     
Loading...