input noise into ADC

Discussion in 'General Electronics Chat' started by Macnerd, May 27, 2014.

  1. Macnerd

    Thread Starter Member

    May 22, 2014
    37
    1
    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.
     
  2. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    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
     
  3. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    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.
     
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,523
    1,247
    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
     
  5. Macnerd

    Thread Starter Member

    May 22, 2014
    37
    1
    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.
     
  6. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    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.
     
  7. alfacliff

    Well-Known Member

    Dec 13, 2013
    2,449
    428
    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?
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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.
     
  9. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,128
    266
    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)
     
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
  11. Veracohr

    Well-Known Member

    Jan 3, 2011
    550
    75
    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.
     
  12. djsfantasi

    AAC Fanatic!

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

    I've used it in programming.
     
  13. Lestraveled

    Well-Known Member

    May 19, 2014
    1,957
    1,215
    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.
     
  14. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
    :)
     
  15. Lestraveled

    Well-Known Member

    May 19, 2014
    1,957
    1,215
    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.
     
  16. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
  17. MrChips

    Moderator

    Oct 2, 2009
    12,432
    3,360
  18. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,165
    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: May 31, 2014
  19. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    Perhaps a bit late, but the attached PDF might interest you.

    Bertus
     
  20. Macnerd

    Thread Starter Member

    May 22, 2014
    37
    1
    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?
     
Loading...