| Electronics > Projects, Designs, and Technical Stuff |
| pwm dac |
| (1/2) > >> |
| Boschi:
i want to use a pwm output of an AVR in order to generate the Vref of a psu. as now im just researching how i can do it, im not going to breadboard any circuit for now. i was asking myself if this its doable: https://www.edn.com/design/analog/4459116/Cancel-PWM-DAC-ripple-with-analog-subtractionhttps://www.edn.com/design/analog/4459116/Cancel-PWM-DAC-ripple-with-analog-subtraction. if i did my math correctly i should have about 0.0002V of ripple on a 5v signal with a settling time of about 100ms (4khz 12bit pwm, 10k and 1uf for the filter). if i follow that stage with a lpf i can get down to a few uV teoretically. just a note, in case ill buffer the output of the AVR pins with a 74HC14 how much different is the reality? a single count of the dac should be about 1.2mV, so im not too concerned about noise. ps: why using a PWM channel when a 12bit dac from china is just 1 dollar? i dont know. i just like this kind of solution, that are a bit uncommon and not too complicate. besides, if it works its a andy tool to have, even with just a few bits of resolutions (like 6-8). |
| Buriedcode:
There are various ways to either decrease settling time, or decrease ripple (by increasing the PWM frequency, using multiple PWM signals etc..) but please bear in mind that PWM DACs generally have poor absolute accuracy. That is to say the DNL tends to be very good - relative accuracy is great, but INL - absolute accuracy (if you are trying to create a precise voltage) isn't. This is because it relies on the IO's VoH voltage being accurate and stable. You can probably calibrate out a lot of the error, but it why PWM DAC's are often used for audio, or "trim" voltage where there is some feedback - situations where the absolute voltage doesn't matter because it is adjusted on the fly. I have no doubt you'll achieve reasonable results with the app-note in that link, but as you pointed out, it gest to the point where the number of parts and cost increases well beyond the cost of a single DAC chip and a decent voltage reference. |
| intabits:
--- Quote from: Buriedcode on December 05, 2018, 01:27:47 am ---... - absolute accuracy (if you are trying to create a precise voltage) isn't. This is because it relies on the IO's VoH voltage being accurate and stable. --- End quote --- This can be improved by having the PWM signal switch a voltage reference to the output. The Systron Donner M107 voltage standard does this. Doubled up in fact, with one PWM signal derived from the 3 most significant control digits, and the other from the 3 least significant control digits, the two PWM signals drive FET switches from an LM399 voltage reference to produce two analog DC signals that are summed together with the LS signal contributing 1/1000th of the other. So, theoretically, 6 digits of precision from PWM. |
| Boschi:
--- Quote from: Buriedcode on December 05, 2018, 01:27:47 am ---There are various ways to either decrease settling time, or decrease ripple (by increasing the PWM frequency, using multiple PWM signals etc..) but please bear in mind that PWM DACs generally have poor absolute accuracy. That is to say the DNL tends to be very good - relative accuracy is great, but INL - absolute accuracy (if you are trying to create a precise voltage) isn't. This is because it relies on the IO's VoH voltage being accurate and stable. ... I have no doubt you'll achieve reasonable results with the app-note in that link, but as you pointed out, it gest to the point where the number of parts and cost increases well beyond the cost of a single DAC chip and a decent voltage reference. --- End quote --- i see, i was thinking about using a inverter ic powered up from a separated and calibrated voltage regulator (or trimmed in software) in order to improve the accuracy. about the cost, its a try and a one off, im manly intrested in those case when i have just a uc, a few pwm pin to spare and the need of a semi-precise analog output voltage. --- Quote from: intabits on December 05, 2018, 06:53:26 am ---This can be improved by having the PWM signal switch a voltage reference to the output. --- End quote --- how? i think you need an analog switch, but its possible to use just two mosfet back to back driven by a higher voltage? (es. pwm pkpk 5v, mosfet gate driving 8-10v pkpk) ps: do you have any simuation software to propose? if possible already with a well-stocked library. |
| Kleinstein:
For the filter function one could use something like LTspice or Tina. However the details of charge injection may not be simulated that good. Using analog switch chips (down to HC4053) is an option, so is using discrete FETs switches. For good settling and low ripple it usually takes an higher order filter. To keep the PWM frequency high one can use a kind of additional sigma delta modulation: instead of a direct 16 Bit PWM one could use something like 8 or 10 Bit PWM and than additional modulation of these lower resolution values between 2 settings. The overall period will stay the same, but there is much less amplitude at the lowest frequency. |
| Navigation |
| Message Index |
| Next page |