PWM to DC Voltage

Hey Guys,

So I have a small project where what I’m trying to do is essentially increase the output voltage from 0.5->2.8V. However, I want this voltage to come out as a steady DC Voltage. I think the PWM frequency is 500 Hz so does anyone have any idea on what resistor and capacitor values to use for a low pass filter?

I tried a 3.3k resistor and a 0.1uF capacitor in parallel and according to my math that should be working but Im still getting an oscillating signal according to an oscilloscope.

Thanks

Have you considered this? https://docs.particle.io/reference/firmware/photon/#analog-output-dac-

1 Like

Yup, there are two DAC pins (A6/DAC & A3) capable of 12bit DAC - but if you insist in converting 8bit PWM, you might alao consider bumping up the PWM frequency (up to 65535 Hz)
https://docs.particle.io/reference/firmware/photon/#analogwrite-pwm-

Oh ok. I see that there are two DAC Pins on the Electron. So if I can just clarify, I can get a steady 1.65V (2048/4096) coming out of the Electron?

@sodha.ss, when you say “steady” do you mean as in “voltage reference” steady? What will you be using this voltage for?

@peekay123 When I mean steady, I meant will there be any ripple voltage in the signal? I have not purchased the Electron yet which is why I just want to clarify. So if I connect an oscilloscope to the output pin and I zoom in, will i see a straight line or a line that is oscillating slightly?

@peekay123 Sorry. Forgot to answer your question. I’m just supplying a voltage to a circuit. I originally had a PWM output going into the circuit but that would make the output oscillate high and low and I just discovered DAC yesterday!

@sodha.ss, though the output of the Electron DAC is DC, the Electron’s onboard supply uses a switching regulator. As such, there will always be a small ripple voltage, though I stress SMALL. Adding a 0.01uF cap to the output will filter a lot of that ripple. If you are expecting a solid DC reference voltage, you may need to consider another source. If you had been using a PWM, then the DAC will most likely fit your needs.

@peekay123 OK gotcha. Im incrementing the output voltage of the microcontroller in 0.1V intervals over the course of 10 seconds. So as long as it doesn’t fluctuate more than that, it should still work.

1 Like