input noise into ADC

Thread Starter

Macnerd

Joined May 22, 2014
67
I'm wondering what would happen if white noise or any other color noise is input into an analog to digital converter. I'm wondering how hardware could produce random binary digits.

Sure, I can use software to produce random numbers, but I'm wondering how to produce random binary numbers using hardware.

I haven't had any luck finding the answer on YouTube or Google.
 

djsfantasi

Joined Apr 11, 2010
5,841
As a matter of fact, reading a value from an UNCONNECTED analog pin on a microcontroller is used to provide a starting seed for software pseudo-random number generation.

I don't know how random it would be in practice connected to a noise generator.

However, The_RB has an article on his site describing a hardware RNG. Take a look at this link to his site.
http://www.romanblack.com/HardRNG/HardRNG1.htm
 

crutschow

Joined Mar 14, 2008
23,797
White noise into an A/D should produce random numbers. How truly random they are could be affected by the amplitude and frequency of the noise with respect to the A/Ds dynamic range and sampling frequency.
 

AnalogKid

Joined Aug 1, 2013
8,227
In one of Tom Clancy's books, a CD full of truly random numbers used for coded messaging is produced by A/D conversion of sunspot noise. Don't know if spooks really do this, but the theory is fine.

ak
 

Thread Starter

Macnerd

Joined May 22, 2014
67
As a matter of fact, reading a value from an UNCONNECTED analog pin on a microcontroller is used to provide a starting seed for software pseudo-random number generation.
How does one read a value from an UNCONNECTED pin?

White noise into an A/D should produce random numbers. How truly random they are could be affected by the amplitude and frequency of the noise with respect to the A/Ds dynamic range and sampling frequency.
I don't completely understand the difference between the different color noises, but isn't white noise basically "constant" amplitude? Based on my very limited understanding of the different color noises, I would think that one would have to use a color other than white noise that is biased towards the low or high frequencies.
 

djsfantasi

Joined Apr 11, 2010
5,841
Unconnected as in not connected to any external circuitry. It is left floating, hence it's value is undefined. This provides a value good enough to be used as a seed in a software PRNG.
 

alfacliff

Joined Dec 13, 2013
2,458
how about the artifacts leftover by the a to d conversion? how much "smoothing" would be done by the a/d chip? how would the clock rate of the chip affect the random numbers produced?
 

ErnieM

Joined Apr 24, 2011
8,010
Unconnected as in not connected to any external circuitry. It is left floating, hence it's value is undefined. This provides a value good enough to be used as a seed in a software PRNG.
If I was going to attempt this I would indeed connect the pin to a very very long trace (not connected to anything else) to insure lots and lots of floating around.

If I had an AC source anywhere connecting it to there (perhaps to the input of a linear regulator) would insure something random, in the lower order bits anyway.

Proper scaling and level shifting could produce a decent random number, though not truly random as the numbers bunch together at the peaks.
 

Sensacell

Joined Jun 19, 2012
2,519
I'll bet an unconnected input would spend most of it's time stuck at the rails, unless some form of bias was established. (compromising the randomness)
 

THE_RB

Joined Feb 11, 2008
5,438
They commonly use noise from a voltage noise source like a reversed diode junction, often the B-E junction of a transistor.

One of the problems with that is the noise is very low power and can easily be swamped by repetitive noise of a higher power level like nearby radiated fields etc.

My system here;
http://www.romanblack.com/HardRNG/HardRNG1.htm (thanks djsfantasi) gets around the low-power swamping by using a very low source impedance for the noise AND using TIME based source data and TIME based measuement, not amplitude based. It's good, but it's slow.
 

Veracohr

Joined Jan 3, 2011
694
Unless it were a 1-bit ADC, you would get a binary value of a random voltage level, not random individual bits. The bits in each sample would not be random, only the samples from one to the next would be random levels. I suppose you could then have the software pick a single bit out of each sample to use for a string of random bits.
 

djsfantasi

Joined Apr 11, 2010
5,841
I mentioned this because it is a recommended method to seed the random() function on the Arduino site.

I've used it in programming.
 

Lestraveled

Joined May 19, 2014
1,946
Digitally generated random number generators are not random. Patterns begin to emerge when you process large samples from them. There is a technique called coherent integration where you can see signals that are below the noise floor, but the noise must be Gaussian (totally random).

My favorite low frequency random noise source is a reversed biased diode. A zener near its breakdown voltage works well also.
 

THE_RB

Joined Feb 11, 2008
5,438
Digitally generated random number generators are not random. Patterns begin to emerge when you process large samples from them. ...
That's a generalisation, that is only true for digital random number generators that produce low quality data. Things like linear sequential PRNGs which are fast but produce pretty ordinary "randomness".

It's quite possible to digitally (algorithmically) produce data which is indistinguishable from true random data by all the best tests. Generally it's done by scrambling processes and/or xoring the output of multiple different processes where one or more is a scrambling process.

My "Black RNG" here;
http://www.romanblack.com/black_rng.htm
actually scrambles its own engine over time, as it scrambles the data. So as time progresses different processes are done on the data. It also scrambles only a fraction of the data, so the bits in the cache (at any one point in time) have been scrambled by different processes at different times.
:)
 

Lestraveled

Joined May 19, 2014
1,946
Let me say it in different words. If you are building a game and want a character appear random then any random number generator will do fine. But if you are using random numbers (noise) in statistical analysis then the quality of your randomness becomes very important. This is why in crypto they digitize the noise from stars and other natural sources for their number sequences.
 

THE_RB

Joined Feb 11, 2008
5,438
You don't need to say it in different words. :)

My point remains that it is quite possible, (even easy there days with high power computing) to generate random data that is AS GOOD as any natural noise source. And no test can tell the difference.
 

nsaspook

Joined Aug 27, 2009
6,610
You don't need to say it in different words. :)

My point remains that it is quite possible, (even easy there days with high power computing) to generate random data that is AS GOOD as any natural noise source. And no test can tell the difference.
Your generator is good but it's still just an approximation of true random data. It can be AS GOOD for almost any application as a quantum indeterminism based generator using *observation* not computation but the difference can be detected.
https://www.cs.auckland.ac.nz/~cristian/talks/selected/qrandMathBeamer.pdf
http://arxiv.org/pdf/1004.1521v2.pdf
 
Last edited:

Thread Starter

Macnerd

Joined May 22, 2014
67
You guys are going over my head. I'm an electronics newbie. I've read about using hardware like reverse-biased diode or disconnected transistor. You're talking about noise floors & scrambling processes(?) & coherent integration & stuck at the rails. I'm a firm believer in the KISS principle & I don't mean the rock band! I have a book that refers to a pseudo-random sequence using shift registers & feeding back some of the outputs to the inputs. It's random numbers that repeat. By properly connecting outputs to inputs one can get a sequence that is one less than the equivalent binary sequence. The random numbers repeat, but the more stages there are the longer it takes to repeat. That's what I'm looking for. But I'm wondering about inputting noise into a A/D converter & outputting random numbers. I've read the Wikipedia article about noise color & I don't completely understand it. Apparently, white noise is "equal" amplitude & the other colors either increase in intensity or decrease in intensity as the frequency increases. So, back to my original question. Which of the colors should be input to the A/D converter?
 
Top