Forums

dac dithering

Started by John Larkin November 29, 2013
On 12/1/2013 1:39 PM, John Larkin wrote:
> > If anyone's interested, there's an LT Spice thing below. > > I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 > volt p-p range, which is 15 microvolt steps. > > This uses two summed sines as the dither. Two sines has a better > probability distribution than one, and more don't seem to help. I > tried writing an LT SPice thing to graph the probability distribution > of summed sines, but it was too slow to be useful. Maybe my intern can > Matlab it.
It's pretty simple--the probability density of the sum of two uncorrelated variables (e.g. sines of incommensurate frequency) is the convolution of the two individual densities. So the nasty peaks at the ends get smoothed off.
> > The dither sines get intermodulated by the quantizer, generates sums > and differences, and the IM products have to be kept away from the 1 > MHz passband. > > Finding the optimum sinewave dither amplitudes and frequencies would > take either a lot of theory or a lot of fiddling. The values I'm using > seem to work pretty well. I can make a decent 6 uV p-p sine wave. > > I'm thinking that, if the dither were bandlimited gaussian noise, > there would be an infinite number of IM products folding the noise > back into the 1 MHz passband. Maybe the discrete sines are better. > > I didn't include the dac clock yet. I guess a s/h clocked at 50 MHz > would be a pretty good model. > > Sorry if I'm boring you, miso.
He's just grouchy because he doesn't get any meat in his soup. ;) Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net
On Sun, 01 Dec 2013 15:04:30 -0500, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>On 12/1/2013 1:39 PM, John Larkin wrote: >> >> If anyone's interested, there's an LT Spice thing below. >> >> I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 >> volt p-p range, which is 15 microvolt steps. >> >> This uses two summed sines as the dither. Two sines has a better >> probability distribution than one, and more don't seem to help. I >> tried writing an LT SPice thing to graph the probability distribution >> of summed sines, but it was too slow to be useful. Maybe my intern can >> Matlab it. > >It's pretty simple--the probability density of the sum of two >uncorrelated variables (e.g. sines of incommensurate frequency) is the >convolution of the two individual densities. So the nasty peaks at the >ends get smoothed off. > >> >> The dither sines get intermodulated by the quantizer, generates sums >> and differences, and the IM products have to be kept away from the 1 >> MHz passband. >> >> Finding the optimum sinewave dither amplitudes and frequencies would >> take either a lot of theory or a lot of fiddling. The values I'm using >> seem to work pretty well. I can make a decent 6 uV p-p sine wave. >> >> I'm thinking that, if the dither were bandlimited gaussian noise, >> there would be an infinite number of IM products folding the noise >> back into the 1 MHz passband. Maybe the discrete sines are better. >> >> I didn't include the dac clock yet. I guess a s/h clocked at 50 MHz >> would be a pretty good model. >> >> Sorry if I'm boring you, miso. > >He's just grouchy because he doesn't get any meat in his soup. ;) > >Cheers > >Phil Hobbs
I added the s/h to fake the DAC clock and tried a triangle, under the assumption that my FPGA guy could make a triangle more easily than a pair of sines (which would probably just be a huge lookup table.) It was awful. Two sines with the s/h aren't bad. How do you get LT Spice to make bandlimited Gaussian noise? I could try that, too.
On 12/1/2013 6:05 PM, John Larkin wrote:
> On Sun, 01 Dec 2013 15:04:30 -0500, Phil Hobbs > <pcdhSpamMeSenseless@electrooptical.net> wrote: > >> On 12/1/2013 1:39 PM, John Larkin wrote: >>> >>> If anyone's interested, there's an LT Spice thing below. >>> >>> I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 >>> volt p-p range, which is 15 microvolt steps. >>> >>> This uses two summed sines as the dither. Two sines has a better >>> probability distribution than one, and more don't seem to help. I >>> tried writing an LT SPice thing to graph the probability distribution >>> of summed sines, but it was too slow to be useful. Maybe my intern can >>> Matlab it. >> >> It's pretty simple--the probability density of the sum of two >> uncorrelated variables (e.g. sines of incommensurate frequency) is the >> convolution of the two individual densities. So the nasty peaks at the >> ends get smoothed off. >> >>> >>> The dither sines get intermodulated by the quantizer, generates sums >>> and differences, and the IM products have to be kept away from the 1 >>> MHz passband. >>> >>> Finding the optimum sinewave dither amplitudes and frequencies would >>> take either a lot of theory or a lot of fiddling. The values I'm using >>> seem to work pretty well. I can make a decent 6 uV p-p sine wave. >>> >>> I'm thinking that, if the dither were bandlimited gaussian noise, >>> there would be an infinite number of IM products folding the noise >>> back into the 1 MHz passband. Maybe the discrete sines are better. >>> >>> I didn't include the dac clock yet. I guess a s/h clocked at 50 MHz >>> would be a pretty good model. >>> >>> Sorry if I'm boring you, miso. >> >> He's just grouchy because he doesn't get any meat in his soup. ;) >> >> Cheers >> >> Phil Hobbs > > > I added the s/h to fake the DAC clock and tried a triangle, under the > assumption that my FPGA guy could make a triangle more easily than a > pair of sines (which would probably just be a huge lookup table.) It > was awful. > > Two sines with the s/h aren't bad. > > How do you get LT Spice to make bandlimited Gaussian noise? I could > try that, too. > > >
A resistor, a BPF, and an ideal amplifier. Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net
On 12/1/2013 6:15 PM, Phil Hobbs wrote:
> On 12/1/2013 6:05 PM, John Larkin wrote: >> On Sun, 01 Dec 2013 15:04:30 -0500, Phil Hobbs >> <pcdhSpamMeSenseless@electrooptical.net> wrote: >> >>> On 12/1/2013 1:39 PM, John Larkin wrote: >>>> >>>> If anyone's interested, there's an LT Spice thing below. >>>> >>>> I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 >>>> volt p-p range, which is 15 microvolt steps. >>>> >>>> This uses two summed sines as the dither. Two sines has a better >>>> probability distribution than one, and more don't seem to help. I >>>> tried writing an LT SPice thing to graph the probability distribution >>>> of summed sines, but it was too slow to be useful. Maybe my intern can >>>> Matlab it. >>> >>> It's pretty simple--the probability density of the sum of two >>> uncorrelated variables (e.g. sines of incommensurate frequency) is the >>> convolution of the two individual densities. So the nasty peaks at the >>> ends get smoothed off. >>> >>>> >>>> The dither sines get intermodulated by the quantizer, generates sums >>>> and differences, and the IM products have to be kept away from the 1 >>>> MHz passband. >>>> >>>> Finding the optimum sinewave dither amplitudes and frequencies would >>>> take either a lot of theory or a lot of fiddling. The values I'm using >>>> seem to work pretty well. I can make a decent 6 uV p-p sine wave. >>>> >>>> I'm thinking that, if the dither were bandlimited gaussian noise, >>>> there would be an infinite number of IM products folding the noise >>>> back into the 1 MHz passband. Maybe the discrete sines are better. >>>> >>>> I didn't include the dac clock yet. I guess a s/h clocked at 50 MHz >>>> would be a pretty good model. >>>> >>>> Sorry if I'm boring you, miso. >>> >>> He's just grouchy because he doesn't get any meat in his soup. ;) >>> >>> Cheers >>> >>> Phil Hobbs >> >> >> I added the s/h to fake the DAC clock and tried a triangle, under the >> assumption that my FPGA guy could make a triangle more easily than a >> pair of sines (which would probably just be a huge lookup table.) It >> was awful. >> >> Two sines with the s/h aren't bad. >> >> How do you get LT Spice to make bandlimited Gaussian noise? I could >> try that, too. >> >> >> > > A resistor, a BPF, and an ideal amplifier.
Of course that doesn't work in transient simulations. I'd probably do a Box-Mueller noise generator followed by a BPF, but that would take some figuring out. Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net
On Sun, 01 Dec 2013 10:39:44 -0800, John Larkin wrote:

> If anyone's interested, there's an LT Spice thing below. > > I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 > volt p-p range, which is 15 microvolt steps. > > This uses two summed sines as the dither. Two sines has a better > probability distribution than one, and more don't seem to help. I tried > writing an LT SPice thing to graph the probability distribution of > summed sines, but it was too slow to be useful. Maybe my intern can > Matlab it. > > The dither sines get intermodulated by the quantizer, generates sums and > differences, and the IM products have to be kept away from the 1 MHz > passband. > > Finding the optimum sinewave dither amplitudes and frequencies would > take either a lot of theory or a lot of fiddling. The values I'm using > seem to work pretty well. I can make a decent 6 uV p-p sine wave. > > I'm thinking that, if the dither were bandlimited gaussian noise, there > would be an infinite number of IM products folding the noise back into > the 1 MHz passband. Maybe the discrete sines are better.
This is why the sigma-delta approach works well: you put the quantization inside the loop, and you use feedback to make the whole thing high-pass. Of course, your quantization model has to be a pretty good match for the actual DAC nonlinearity, which makes things challenging. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Sun, 01 Dec 2013 17:19:59 -0600, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Sun, 01 Dec 2013 10:39:44 -0800, John Larkin wrote: > >> If anyone's interested, there's an LT Spice thing below. >> >> I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 >> volt p-p range, which is 15 microvolt steps. >> >> This uses two summed sines as the dither. Two sines has a better >> probability distribution than one, and more don't seem to help. I tried >> writing an LT SPice thing to graph the probability distribution of >> summed sines, but it was too slow to be useful. Maybe my intern can >> Matlab it. >> >> The dither sines get intermodulated by the quantizer, generates sums and >> differences, and the IM products have to be kept away from the 1 MHz >> passband. >> >> Finding the optimum sinewave dither amplitudes and frequencies would >> take either a lot of theory or a lot of fiddling. The values I'm using >> seem to work pretty well. I can make a decent 6 uV p-p sine wave. >> >> I'm thinking that, if the dither were bandlimited gaussian noise, there >> would be an infinite number of IM products folding the noise back into >> the 1 MHz passband. Maybe the discrete sines are better. > >This is why the sigma-delta approach works well: you put the quantization >inside the loop, and you use feedback to make the whole thing high-pass. > >Of course, your quantization model has to be a pretty good match for the >actual DAC nonlinearity, which makes things challenging.
Yeah, I'd have to trust that the DAC lsb step I happen to be using is 1/65536 of full scale. Not 4x as much, not negative! The forced noise thing can span a lot of bits, so gain will be more predictable. This is a bear to model! I have some number of fairly-good solutions, so one of them will have to do.
On Sun, 01 Dec 2013 15:04:30 -0500, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>On 12/1/2013 1:39 PM, John Larkin wrote: >> >> If anyone's interested, there's an LT Spice thing below. >> >> I'm trying to get microvolt waveforms out of a 16 bit DAC that has 1 >> volt p-p range, which is 15 microvolt steps. >> >> This uses two summed sines as the dither. Two sines has a better >> probability distribution than one, and more don't seem to help. I >> tried writing an LT SPice thing to graph the probability distribution >> of summed sines, but it was too slow to be useful. Maybe my intern can >> Matlab it. > >It's pretty simple--the probability density of the sum of two >uncorrelated variables (e.g. sines of incommensurate frequency) is the >convolution of the two individual densities. So the nasty peaks at the >ends get smoothed off. >
OK, that makes sense. Central Limit Theorem says the signal is becoming Gaussian, so the spikies must get scruffed down.
On Sun, 01 Dec 2013 13:04:30 -0700, Phil Hobbs  
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>> ...snip... > It's pretty simple--the probability density of the sum of two > uncorrelated variables (e.g. sines of incommensurate frequency) is the > convolution of the two individual densities. So the nasty peaks at the > ends get smoothed off. > > ..snip...
Isn't the distribution sometype of hyperbolic function? Looks like spires on a suspension bridge. HP used to make a histogram instrument, replicated the probably function of a sine wave pretty well. Once I can get the function, I'll pop it through octave and see just how 'flat' the probability distribution goes.
On Mon, 02 Dec 2013 07:46:54 -0700, RobertMacy
<robert.a.macy@gmail.com> wrote:

>On Sun, 01 Dec 2013 13:04:30 -0700, Phil Hobbs ><pcdhSpamMeSenseless@electrooptical.net> wrote: > >>> ...snip... >> It's pretty simple--the probability density of the sum of two >> uncorrelated variables (e.g. sines of incommensurate frequency) is the >> convolution of the two individual densities. So the nasty peaks at the >> ends get smoothed off. >> >> ..snip... > >Isn't the distribution sometype of hyperbolic function? Looks like spires >on a suspension bridge. > >HP used to make a histogram instrument, replicated the probably function >of a sine wave pretty well. > >Once I can get the function, I'll pop it through octave and see just how >'flat' the probability distribution goes.
I'd love to see that. I haven't got around to learning how to drive Matlab or its clones. Maybe try more than two uncorrelated sines? I tried adding a histogram block (swept window comparator and lowpass filter) but it ran really slow, and I put that aside for now. That would be a cool intrinsic for LT Spice. Or I guess I could export a waveform and sic a PowerBasic program on it. The other thing I'd like to have is a time-domain Gaussian noise generator. Anybody want to write one? $100? Lunch at Zuni?
Den mandag den 2. december 2013 18.46.01 UTC+1 skrev John Larkin:
> On Mon, 02 Dec 2013 07:46:54 -0700, RobertMacy > > <robert.a.macy@gmail.com> wrote: > > > > >On Sun, 01 Dec 2013 13:04:30 -0700, Phil Hobbs > > ><pcdhSpamMeSenseless@electrooptical.net> wrote: > > > > > >>> ...snip... > > >> It's pretty simple--the probability density of the sum of two > > >> uncorrelated variables (e.g. sines of incommensurate frequency) is the > > >> convolution of the two individual densities. So the nasty peaks at the > > >> ends get smoothed off. > > >> > > >> ..snip... > > > > > >Isn't the distribution sometype of hyperbolic function? Looks like spires > > >on a suspension bridge. > > > > > >HP used to make a histogram instrument, replicated the probably function > > >of a sine wave pretty well. > > > > > >Once I can get the function, I'll pop it through octave and see just how > > >'flat' the probability distribution goes. > > > > I'd love to see that. I haven't got around to learning how to drive > > Matlab or its clones. Maybe try more than two uncorrelated sines? > > > > I tried adding a histogram block (swept window comparator and lowpass > > filter) but it ran really slow, and I put that aside for now. That > > would be a cool intrinsic for LT Spice. Or I guess I could export a > > waveform and sic a PowerBasic program on it. The other thing I'd like > > to have is a time-domain Gaussian noise generator. Anybody want to > > write one? $100? Lunch at Zuni?
in ltspice export the waveform, run something like this in scilab: signal = csvRead('filename.txt',ascii(9), '.', 'double'); histplot(100,signal(:,2)) no guarantees but will this work? Version 4 SHEET 1 3688 680 WIRE 224 96 80 96 WIRE 224 112 224 96 WIRE 80 128 80 96 WIRE 224 208 224 192 FLAG 80 208 0 FLAG 224 208 0 SYMBOL res 208 96 R0 SYMATTR InstName R1 SYMATTR Value 1 SYMBOL bv 80 112 R0 WINDOW 3 -33 155 Left 2 SYMATTR InstName B1 SYMATTR Value V=sqrt(-2 * log10(random(time*100e6)+1e-20)) * cos(2pi * random(time*100e6+100e6))-sqrt(-2 * log10(random(time*100e6+200e6)+1e-20)) * cos(2pi * random(time*100e6+300e6)) TEXT 48 232 Left 2 !.tran 0 1m 0 10n -Lasse