| Electronics > Beginners |
| Using external reference voltage with a PWM DAC |
| (1/2) > >> |
| mduchalski:
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? |
| JS:
Use a CMOS buffer, any CMOS aimple logic will help. Inverter, buffer, schmid trigger... Try our and see which is better, I recon all of them will be much better than your approach. Power them from the voltage reference, and they will stat low right at ground ans high right at the reference. Test that, just to be sure, how much error you are having from your circuit? Meaning 0 output and FS output errors. In your circuit it will widely change with load, in the CMOS not so much but still, the higher impedance the load has the better. JS |
| mduchalski:
Thanks for the quick reply and suggestions. I have some 4000-series logic laying around, so I will definitely test that. The main reason I tried to do it with a discrete transistor was to avoid the need for another IC on the board. I was hoping that there is some trick you can use here I'm not aware of/obvious mistake I'm making. But if such an elementary circuit is not able to deliver decent performance and I will need to put an additional IC on there anyway, I might as well make it some cheap dedicated DAC. Thanks again. |
| JS:
You could do it with discrete fets, but a bjt is not the device for the job. And you need push pull config or it will still have high error. The obvious error is BJT has a saturation voltage of quite a few mV instead of a low Rds on, so with low Rds on you will get quite close to the rails while you won't be able to get close to the rails with a BJT. Then, when the BJT is off you hace a high resistance, so the load will have a huge impact on the high voltage you get. Not getting right to the rails is the problem here, with a CMOS buffet you will get much closer to the rails. The other problem is the slew rate of rising and falling edges being different, making the switching time less precise. If you have the same ahape going up and down and your edges are much faster than the PWM signal you will have much greater accuaracy. JS |
| David Hess:
--- Quote from: mduchalski on September 12, 2018, 09:42:57 pm ---I was hoping that there is some trick you can use here I'm not aware of/obvious mistake I'm making. --- End quote --- There is a not so obvious trick; reverse the collector and emitter connections to run the bipolar transistor backwards for lower saturation voltage. The base drive needs to be increased to make up for the lower gain. Also use a low valued speed up capacitor in parallel with the base series resistor to improve switching times and especially reduce storage time. But the real way now is to use a CMOS inverter or buffer powered by the reference voltage or even better, an analog switch. In the past switching might have been done with currents and diodes. |
| Navigation |
| Message Index |
| Next page |