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
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..
Grumpy_Mike:
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.
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