pwm dac - Page 1
Forum section: electronics / projects

author: Boschi
author_rank: Regular Contributor
timestamp: December 04, 2018, 10:57:21 pm
content: 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 74HC14how 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).

author: Buriedcode
author_rank: Super Contributor
timestamp: December 05, 2018, 01:27:47 am
content: 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.

author: intabits
author_rank: Frequent Contributor
timestamp: December 05, 2018, 06:53:26 am
content: Quote from: Buriedcode on December 05, 2018, 01:27:47 amThis 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.

author: Boschi
author_rank: Regular Contributor
timestamp: December 05, 2018, 08:23:39 pm
content: Quote from: Buriedcode on December 05, 2018, 01:27:47 ami 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 amhow? 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.

author: Kleinstein
author_rank: Super Contributor
timestamp: December 05, 2018, 09:10:58 pm
content: 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.

author: intabits
author_rank: Frequent Contributor
timestamp: December 06, 2018, 10:31:20 am
content: Quote from: Boschi on December 05, 2018, 08:23:39 pmHere's the relevant part of the circuit in a post of mine. (lower schematic)https://www.eevblog.com/forum/repair/seeking-help-in-troubleshooting-a-systron-donner-m107-precision-dc-voltage-sourc/msg1363041/#msg1363041The pulse transformers and transistor flip flops are just used for isolation, you don't need that.The four FETs and U8 is what I was referring to. Full service manual for the M107, (including theory of operation) is in the same post.

author: Ian.M
author_rank: Super Contributor
timestamp: December 06, 2018, 10:38:35 am
content: For lower precision circuits, to switch Vref to the output controlled by the PWM, you could simply use a level translating digital buffer with two power domains, e.g. 74LVC1T45.

author: tooki
author_rank: Super Contributor
timestamp: December 06, 2018, 12:54:31 pm
content: Quote from: intabits on December 05, 2018, 06:53:26 amHow funny, I was just reading about this the other day!I recently-ish got a reasonably high-end Sony CD player (CDP-XB930), which like the matching MiniDisc deck I have (the MDS-JB930), has “Current Pulse D/A Converter” plastered on the front panel. I’d never bothered looking into it, so I did, and it turns out that it’s exactly what you describe. Instead of a simple serial output from the decoder, it uses (redundant, duplicated!) balanced data pairs to the DAC, which then outputs the PWM (or is it pulse density on these? i forget.) pulse stream onto (non-duplicated) balanced pairs, which then feed into the “current pulse” chip which takes the pulsed voltage and uses it to control a constant-current source, which then ultimately gets output and smoothed. (The whole balanced pairs thing is apparently to reduce noise on the PSU rails, by ensuring that the current draw is always the same, whether a 0 or 1 is being transmitted...)Does it actually matter for audio? I kinda doubt it. (I mean, the DACs in these things sound awesome, but so do most decent audio DACs.) But the wannabe-engineer in me does appreciate the attention to detail. (The SonyxB9xxline of products, from about 1998-2003, are really nicely made, and I like their simple aesthetics.) In the end, both CD and MD are connected to my receiver by TOSlink, so their DACs aren’t really getting used at all...Here’s a discussion of it:https://www.diyaudio.com/forums/digital-source/21744-sony-current-pulse-dacs.htmlAnd somebody actually found the relevant patent, which explains it in detail:https://patents.google.com/patent/US5343197A/en