Go Down

Topic: Low pass filter connected to PWM not outputting correct value (Read 302 times)previous topic - next topic

0070

Hello,

I have attached a low pass filter consisting 1MOhm resistor and 100nF capacitor to pin D13 on my Arduino Mega. Using Matlab I told Arduino to output 2.5V to pin D13( writePWMVoltage(a,'D13',2.5) ). So I thought measuring the voltage across the capacitor will give me smooth 2.5V however both my DMM and Analog read of Arduino are reading me ~2.1V. Why is that?

This might be a dumb question but I could not search answer for my situation
so I gave a go

Grumpy_Mike

Quote
I told Arduino to output 2.5V to pin D13( writePWMVoltage(a,'D13',2.5) )
And will that work? What actual value are you sending to D13?

Also 1M is a bit high, approaching the value of the input impedance of your meter. Plus check the 5V rail of your computer, what is it?

wolframore

#2
Nov 13, 2018, 08:01 pmLast Edit: Nov 13, 2018, 08:03 pm by wolframore
The filter is off.  Your cutoff is about 1.6 Hz. You need higher cutoff freq for PWM. Try again but set cutoff about 1 kHz.

I think I understand what you're trying to do. Filter the PWM to output a steady DC. Interesting.  Play with the filter.
Bad boys rate our young girls but Violet goes willingly
- this is a mnemonic from BEC

Grumpy_Mike

#3
Nov 13, 2018, 08:03 pmLast Edit: Nov 13, 2018, 08:04 pm by Grumpy_Mike
The filter is off.  Your cutoff is about 1.6 Hz. You need higher cutoff freq for PWM. Try again but set cutoff about 1 kHz.
This is totally incorrect. It is a low pass filter the break frequency only affects the speed that the voltage can be changed, not the DC value.

Wawa

Corner frequency must be low to remove ripple.
But as Mike said, a (10Megohm?) DMM or other circuit connected to a filter loads it, and you end up with a lower voltage.
Especially if you have choosen a very high resistor for your filter.

Try 10k/47uF, and/or buffer the output with an opamp.
Leo..

wolframore

This is totally incorrect. It is a low pass filter the break frequency only affects the speed that the voltage can be changed, not the DC value.
Hey Mike you're right... I didn't get what he was trying to do until after I posted... He's doing 50% PWM to try to output 2.5v after filter.  Looks like the filter is dropping voltage.
Bad boys rate our young girls but Violet goes willingly
- this is a mnemonic from BEC

0070

I checked my 50% duty cycle output (2.5V) and 100% duty cycle output with my (5V) oscilloscope and it is giving me value of 2.48V and 4.96V so Arduino looks fine,

I also tried 100k resistor instead of 1M, and now I am getting ~2.28V at 50% duty cycle

0070

Seems like impedance of the filter was the problem, Now I'm getting 2.48V with 10KOhm 100nF filter. Thanks everyone!

Wawa

Not sure what you're trying to do, but 10k/100nF is not enough to remove the PWM component.
Try a 10-100uF capacitor.
Leo..

TomGeorge

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html.

What will you be using the analog level for?

You may need to add a unity gain buffer to prevent the filter from being loaded down.

Tom...
Everything runs on smoke, let the smoke out, it stops running....

Go Up