## How to put noise in circuit? (for accurate adc)

12 posts / 0 new
Author
Message

Ive got a circuit that accurately reads low volts like in the millivolt range. I accumulate 256 readings and divide by 4 to get a 16 bit result. This works well when the gain stage is enabled because noise is amplified and the 256 readings gives a resolution thats not possible with just 10 bits. Switching off the gain stage loses the averaging effect of the 256 readings. Using the 2.56 reference, the result increments in large chunks. If I could add some noise to the circuit the reading could be improved.

Have any of you ever done this before or seen a project that did this?

Any kind of noise or oscillation might work, so long as it can be turned off for gain stage readings.

This is going to be an academy project for a tiny26 multimeter and a good reference for anyone needing precise adc readings.

Me ukrain freind Serge77 do this work by AVR appnote "ADC oversampling ..."

w very good results !

http://airbase.ru/users/serge77/...

nice pics: http://forums.airbase.ru/index.p...

http://atmel.com/dyn/products/ap...

see AVR121 doc8003.pdf

Since white noise can be hard to manufacture without getting sensitivity to RFI, another possible solution:
Program one of the timers to give you a squarewave, and lowpass filter it into a ramp:
You want to average over 256 samples, so program the timer to have a period of that, 256/15kHz = 17ms.
Then we want a 1lsb=2.5mV p-p triangle wave to add to the signal. To do this, we pass the squarewave through an RC filter with a tau 5x longer, say, 85 ms.
This will give us a peak-peak voltage of VCC/2/tau*Thalfperiod = 250 mV for 5V VCC. This triangle can be added at a 1/100 ratio to the input signal in various ways, depending on what's already there, and it will give you less noise in the reading than real noise..

The app note talks about adding noise and then the need take 4 samples to increase the resolution by 1 bit where you might think only 2 samples would be required per bit. This is beacuse the noise adds uncertaintly to the results. If you add a known signal to the ADC input of 0 and 1/2 bit on alternate samples you should get away with only 2 samples/bit. It would probably be practical to increase the resolution by 2 bits (maybe even 3 bits) using a simple R,2R resistors using 2 port bits. --Nick--

Since there are no >real< computer based random number generators, get a Geiger tube and a chunk of Uranium ore (the more radioactive the better) and rig up an ADC to take the counts. Set the Uranium at a distance (inverse squares law) to provide the range of counts you need. It will provide a truly random number generator and hours of fun in Guantanmo explaining what you were doing.

Smiley

Quote:
Since there are no >real< computer based random number generators...

Why couldn't you use a second, "Free Running" oscilator who's output frequency is some "Prime Factor" to the Uc oscilator. This would ensure randomnessl Use the "Free Running" oscilator to trigger INT0. Inside INT0 a counter would get incremented, providing a "Seed" for a truley random number. Well, at least to 1 part in Y^16 or Y^32.

Quote:
...get a Geiger tube and a chunk of Uranium...

Do I really need a Geiger tube? Can't I just check and see if my hair is falling out or my skin is turning Green?

Nothing comes free!!!

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

I remember something about a quite simple circuit, where a standard transistor was used to generate a little bit of noise (thermal noise, I'd guess), and an opamp amplified this noise. This was used to generate random numbers in a micro.
Unfortunately I don't have this schematic anymore (this was more than 20 years ago), but it should be quite easy to make such an arrangement again. Easier than messing around with a Geiger-Müller tube, at least :D

Quote:
Easier than messing around with a Geiger-Müller tube, at least

But Smilemicros only recommended the Geiger tube because he wants every one to be safe!

Oh shite, I think I'm turning Green and my hair seem to be falling out!!!

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

It seems to me that noise is actually NOT what is required. What IS required is a way
to add a "dither" signal which will ensure that averaging can be used to increase the
resolution rather than getting a getting large jumps because all the ADC values are equal.

If we use noise as the dither signal, the averaging has to remove the noise as well
as increase the resolution. The noise is reduced by a factor of the square root of
the number of samples, this is what is described in the App note.

Ideally the dither signal should be a sawtooth wave with p-p amplitude of 1 LSB,
synchronized with the conversions, so if we are averaging over 4 samples with sample
time t, the sawtooth period would be 4t.

Examples: Assume an 8 bit ADC with LSB is 10mV and a sawtooth of +/-5mV
Signal = 1.00V
0 0.00mV 1.00 100
1 2.5mV 1.0025 100
2 5.00mV 1.0050 100
3 7.50mV 1.0075 100
Sum 400

Signal 1.0025
0 0.00mV 1.0025 100
1 2.5mV 1.005 100
2 5.00mV 1.0075 100
3 7.50mV 1.01 101
Average 401

Signal 1.003
0 0.00mV 1.003 100
1 2.5mV 1.0055 100
2 5.00mV 1.008 100
3 7.50mV 1.0105 101
Average 401

Signal 1.005
0 0.00mV 1.005 100
1 2.5mV 1.0075 100
2 5.00mV 1.01 101
3 7.50mV 1.0125 101
Average 402

Signal 1.0075
0 0.00mV 1.0075 100
1 2.5mV 1.01 101
2 5.00mV 1.0125 101
3 7.50mV 1.015 101
Average 403

As I suggested in the first message, instead of using an external signal generator, simply
add the required offsets using a few output pins, essentially making an DAC to add the dither
signal.

If an insufficient number of pins are available, use a single pin and generate a
triangle wave (heavy RC filtering should give a good triangle wave) toggled every group of
conversions (2x the period of the sawtooth describer above). This will work well if the
ADC conversion at a constant frequency, either add an offset to the filtered triangle wave or
AC couple to the signal input. --Nick--

...

Quote:
a triangle wave (heavy RC filtering should give a good triangle wave)

Actually, the R/C will be exponential and hard to predict for both the charge and discharge portions being averaged into the the measurement.

Supplying the capacitor with a current source, whose output value is shifted by one LSB via port pin, will provide a very linear charge/discharge waveform.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston