PWM to analog voltage

Read this to brush up your concepts of PWM.

This is diagram from Arduino site.

pwm

Using this technique you can get the desired “average” voltage between 0 to Vcc, the frequency of the PWM generate in arduino is always 500Hz, regardless of the duty cycle, well not always you can increase the PWM frequency using this. So to convert it into a nice DC voltage you will need two components, a resistor and a capacitor that will form a low pass filter and smooth out the PWM wave.

250px-1st_Order_Lowpass_Filter_RC.svg

So how to decide the values? see this calculator

I used 10K and 0.1 uF

See it in action

https://www.youtube.com/watch?v=_2gSFcrtt3A

Comments:

CNC Laser cutter - Black Electronics - Sep 5, 2014

\[…\]

The laser power is set by 0 to 5V input in the laser power supply, I used the pwm output for spindle control and added a low pass filter to convert pwm to analog voltage.

\[…\]