Hello,
I'm trying to use filtered PWM signal as a analog output in my power supply project. I want to use an external 4.096V reference voltage (MCP1501), so I've been using a simple single transistor-based inverter with a RC filter on the output. This approach, however, does not seem to produce good results. I played around with it using Atmega328p Timer1 PWM modes - Fast PWM at 15.6kHz and Phase-Corrected PWM at 7.8kHz, 10-bit resolution. In both cases I'm getting maximum recorded error of 15-20 LSB. I've included more detailed measurements below. Unfortunately I don't have a scope to take a look at the signals, and simulation wasn't all that helpful, showing performance far inferior to what I actually got (order of magnitude bigger errors). I initially thought that C-E voltage drop when transistor is driven into saturation will put the average a little higher, but simulation suggests that the "high" collector voltages may be significantly off - ~200mV lower than the expected 4.096V (@50% duty cycle 7.8kHz). My questions are - what is most likely to be the primary source of these errors and is it possible to achieve better performance of a PWM DAC with an external voltage reference, if so how?