Electronic – arduino – Converting PWM to analog voltage

analogarduinoloading-effectpwm

I need to convert a PWM signal with varying duty cycle from the arduino to an analog voltage from 0-5V. I used a RC filter with a time period of 3.9ms. The PWM output has a period of 2ms. I experienced loading effect at the output and therefore I used an op-amp as a buffer. However, I am still experiencing the same problem. My output is ranging from 1.2-5V. I need the output to vary across the entire range of 0-5V. Can anyone suggest a solution for this?

schematic

simulate this circuit – Schematic created using CircuitLab

The op-amp is LM358N.

Best Answer

I used a RC filter with a time period of 3.9ms. The PWM output has a period of 2ms.

You need a longer time period for your filter I would suggest. I would also suggest that you simulate this to see what the output looks like and notice that some artefacts of the PWM signal are still present on the DC level: -

enter image description here

The above uses your numbers and yes, adding a load will alter the filter characteristics and give different results (more ripple voltage). If you have decent bipolar supplies you should be able to use an op-amp but remember, an op-amp can only usually supply loads of up to 20 mA. If you are looking for a more powerful current delivery system you need a power amplifier or the adddition of a transistor.

Related Topic