Smoothing capacitor changing output voltage?

I'm using a smoothing capacitor on my circuit on the PWM output pin.... But I have noticed when trying various sized ones in the bread board that the output voltage changes by about 0.3v.
I always assumed a capacitor would not change the voltage.

Has this something to do with the PWM signal and multimeter reading a 'smoother' reading?

One of the jobs of a cap is to smooth the onput voltage. The higher the cap value, the more smoothin is required.

Look at the old linear power supplies. They used a transformer to drop line voltage (say 110Vac) to a lower AC votage (say 6.3V). The lower AC would go through a doode. The power would still have a large amount of "ripple". Large caps were then used to filter out the ripple (smooth the ripple).

Switch mode power supplies do not require thsose large caps, but fitering is still often required in other circuits.

Of course, the capacitor can change the output voltage.
If the capacitor did not change the voltage, how would it smooth it out?

I don't know what you're doing but don't put a capacitor directly across an output pin. You'll draw excess current when it switches.

You can use a resistor and capacitor to make a low-pass filter. The resistor should be at least 120 Ohms. DC is zero Hz, so DC (including slowly-changing DC) will pass-through a low-pass filter.

PWM is NOT DC or a regular AC sine wave. A multimeter can't measure it accurately unless you have a "true RMS" multimeter.

Ok basically i have a pwm output id like to make more like an analog signal. See c1 and Jumper pin 2 output in the schematic.

Any suggestions on how to pick which components for a filter?
Its been 10 years since ive even played with this stuff as a hobby. Im testing on an anrduino nano, but want to use an attiny85.

That 47uF cap right across PB1 isn't going to do that output pin any favours. I'd say at least a 4.7K resistor between the pin and the cap.

The depends on how you are measuring the output voltage. If you are using a multimeter, it averages over time, and misses the ripple peaks. If you use an oscilloscope, you will see a more realistic picture of the output voltage. Not pretty, even with a capacitor.

As mentioned above, a resistor is required between the output pin and C1 to form an RC low pass filter, otherwise you can damage the output pin. I suggest 1K to 10K.

ok great thanks!
That makes sense, to isolate the voltage from the cap from the output pin.
Ive added the resistor in and will see how I go :slight_smile:

Yep, thats working as expected now! Thanks for the help! Attached updated schematic.

Not to "isolate voltage", but to limit the current