1
\$\begingroup\$

I am just learning Pulse with modulation technique. Is There any way to create a pseudo analog voltage using PWM from the digital output of ATmega16? How can it be done?

\$\endgroup\$
4
  • \$\begingroup\$ Just vary the pulse width and filter the output with an RC filter with R x C approximately equal to the pulse time. Maybe start off by generating a sawtooth: increment the pulse width and when it reaches max reset it to zero. \$\endgroup\$
    – Transistor
    Commented Jan 30, 2016 at 20:09
  • \$\begingroup\$ can you please explain a little bit using any image? @transistor \$\endgroup\$ Commented Jan 30, 2016 at 20:17
  • \$\begingroup\$ Busy at the moment. Look at How is PWM involved in sound generation. \$\endgroup\$
    – Transistor
    Commented Jan 30, 2016 at 20:42
  • \$\begingroup\$ There are lots of articles and application notes available on the internet which cover this in detail. Do a search for "PWM low pass filter design". As a starting point I found this which seems to give a thorough explanation: ti.com/lit/an/spraa88a/spraa88a.pdf \$\endgroup\$
    – Steve G
    Commented Jan 30, 2016 at 21:59

1 Answer 1

2
\$\begingroup\$

If you know the PWM frequency you can start to set an upper bound for your filter.If you know the expected response time of your signal you can set a lower bound for your filter .99% of the time the PWM is high like 50KHz and the expected response time doesnt have to be fast .This means that your filter will be easy .This is why you often see a simple RC filter of 1 or 2 sections .For you to start why not do a 2 section LP RC filter using 10K ohm resisters and 1 microfarad film caps .Check this out on the scope or the simulater and you will see the pwm square wave turning into a low ripple DC wave on the first section and it will be almost clean after the second RC section. The cost effectiveness of SMD resistor arrays containing 4 equal resistors and SMD cap arrays with 4 equal caps improve ripple further . This concept means that you can get an analog output from a PWM output easily.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.