0%
0%

# QRNG

A true Quantum Random Number Generator

Similar projects worth following
2.7k views
The aim of this project is to create a true Quantum Random Number Generator, i.e. a device that produces random numbers from quantum effects. It will use an ionisation chamber from a smoke detector as the source of randomness.

# Introduction

Quantum mechanics is a fascinating subject, among other things because it introduces truly random processes. In classical mechanics, all movements are deterministic. So while we cannot predict the outcome of a coin toss or throw of some dice in practice, in principle it is possible to know exactly what will happen if all the forces acting on the coin or dice are known. The outcome of a single quantum mechanical measurements on the other hand is (for all we know) actually truly unknowable in advance. Only probabilities can be predicted.

The aim of this project is to harness this property and create a true Quantum Random Number Generator. As a source of quantum randomness, I have chosen the radioactive decay of Americium-241. It is readily available as the ionisation source for ionisation chamber smoke detectors. In fact, the ionisation chambers can be used directly.

# Principle of operation

The idea is simple:

1. Apply a voltage to the ionisation chamber and amplify the current.
2. Measure the variations in the current caused by random fluctuations of the radioactive decay.
3. Turn the current variations into a bit stream.

The devil, as always, is in the details. And it took me quite a bit of experimenting to get this working.

# The ionisation chamber

The ionisation chamber with the Am-241 was easy to come by for a few bucks on eBay. It consists of a metal body (1), a central electrod (2), and an electrode that holds the Americium (3):

Americium-241 is an alpha radiation source. The alpha particles (shown in green) ionise the air inside the chamber and make it weakly conductive. When applying a voltage between the electrodes and/or the body, a tiny current flows. The amount of current depends on the amount if ions in the air, which in turn depend on the number of Am-241 decays per second. The radioactive decay is a truly random process and thus the current should fluctuate accordingly.

# The preamplifier

The current through the ion chamber is tiny. To get it to a measurable level, I put together a preamplifier using bipolar transistors:

The transistors Q1 and Q2 are configured as a Darlington pair for a large current gain. Q3 adds an additional amplification stage and together with R4 turns the current signal into a voltage against ground. R2 limits the maximum current through Q1, Q2, and Q3, since even small currents could make the Darlington pair become fully conductive.

This circuit is very sensitive. Without shielding it picks up the 50 Hz noise of all the appliances around it:

And with proper shielding it produces a signal with a mean value of about 1.5 V and variation in the order of 100 mV:

# The low-pass filter

To get rid of any noise that makes it past the shielding, and to turn the high-impedance output of the preamp into a low-impedance signal, the next step in the signal path is an active low-pass filter. I used this very handy online calculator to design it. It has a cut-off frequency of 33 Hz.

# The comparator

The analogue output of the low pass needs to be turned into a digital signal somehow if we want to use it as random bit stream. For this I am using an OpAmp as comparator.

The output goes high if the input signal (coming in from the left) is above the reference voltage (coming in from the bottom left) and goes low when it is below. The switch SW1 is there to jump start the reference voltage generation when powering up the circuit. Jumper JP2 as well as R10, R11, and R12 are used when fine tuning the reference voltage generator. This will be explained in more detail later.

• ### Case coming along

Lukas Koch aka Ast07/02/2021 at 19:56 0 comments

While checking the breadboard circuit and sussing out the last bugs, I am also working on the final housing of this project. It's a bit tight, but everything fits.

Lukas Koch aka Ast06/20/2021 at 21:33 0 comments

The setup on the breadboard works. LEDs are blinking randomly and I have an open-drain digital output of random bits. The current measurement is very sensitive to so shielding of the ion chamber and preamplifier is very important. Without it the output is just 50 Hz noise.

Channel 2 shows the current measurement output minus the DC offset. Since the signal is quite slow, I had to use the oscilloscope in DC mode and add my own RC high pass for reliable measurements. Channel 1 shows the digital output of the circuit. It is generated by comparing the analogue output with a reference voltage using a Schmitt trigger.

Now I need to document the working circuit and move it to a more permanent perfboard.

Share

## Discussions

Jan Steinman wrote 06/25/2021 at 03:24 point

Many years ago, I did something similar with a zener diode. At very low currents (microamps), a zener diode can be induced into avalanche breakdown, at about the same voltage. The avalanche current is highly random. I used a coupling capacitor and a CMOS hex inverter with feedback to make a linear amplifier, and I could get a highly random voltage between Vcc and Vdd, which was then digitized.

I don't recall doing a lot of testing, other than a simple plot that showed it was much better than the Linear-Congruential random number generators of the day.

Are you sure? yes | no

J Spencer wrote 06/25/2021 at 03:44 point

Did you write about this somewhere? Years ago I built what sounds like the very same thing and I’m wondering if I learned about it from you.

Are you sure? yes | no

Jan Steinman wrote 06/25/2021 at 04:03 point

I think I may have put something on Usenet at the time, but it's been lost in the dustbin of many employer/computer changes over the years.

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/25/2021 at 10:02 point

That sounds pretty cool. I guess you can adjust the average break down rate by adjusting the current? Would probably make for a more practical RNG that what I am planning. XD

Are you sure? yes | no

robin.mcburnie wrote 08/07/2021 at 15:54 point

I've tried something similar, but with a tunnel diode. The plan was to bias it to a steady state, about mid-way into the <negative resistance> region, then just amplify the noise. Doing this needs similar care to the current project as very high gain is required.

Couldn't tell you if the result was any more random than using a zener, which as you point out is much easier!

Are you sure? yes | no

Don Froula wrote 06/25/2021 at 00:42 point

The time between independent individual detected pairs of Americium decay events is completely random. All that can be said is that during the half-life of a mass of radioactive material, any individual atom will have a 50% chance of decaying. The ionization current is an average of millions of decay events. Variations in current are likely caused by convection in the chamber or thermal effects. Quantum effects suggest the current variations are NOT random. Detection of individual events  by a GM tube and comparing the time interval between pairs of detected counts is a far better way of generating random numbers from radioactive decay.

https://www.fourmilab.ch/hotbits/

I have an operational Americium system and random number server at :

https://projectmf.org/hotbits/

Random verification is run continuously on a 10% sample of all random numbers generated. Generated bit rate is only 66-68 bytes/second though.

Are you sure? yes | no

Ahron Wayne wrote 06/25/2021 at 03:48 point

Okay, so there are at least two americium random number generator hobbyists. Anyone you know who is even more into it?

Are you sure? yes | no

Don Froula wrote 06/25/2021 at 11:57 point

John Walker at https://www.fourmilab.ch/hotbits/how3.html has been running his Cesium-137 random number generator since 1986, so I would count him as a serious enthusiast. He figured out a scheme to use simple time intervals between pairs of Geiger tube counts to eliminate statistical bias and produce an excellent source of random numbers while eliminating variables such as radiation flux density, tube to source geometries, etc. as factors. I think this ionization chamber approach has promise as well.  It seems the number generation rate would be slower than detecting individual events, though.  Still, a very cool idea!

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/25/2021 at 09:57 point

Originally I tried to resolve single ionisation events with the ion chamber, but was not able to. So I settled for the average current variations. It is true that I would get more randomness if I looked at the single decays, but it is not true that the average current is not random according to quantum physics. The number of decays in a given time is Poisson distributed. Since the conductivity should be proportional to the number of ions in the chamber, the conductivity should also vary similar to a Poisson distribution on the right time scales (i.e. time scales longer than the time it takes for ions to drift to the electrode).

You are right, that the relative variation goes down as the average number of decays increases, but I am not dealing with millions of events here. The activity of my Americium sample is less than 30 kBq (according to the print on the chamber), and only half of that should be emitted into the ion chamber. Also I am looking at this at time scales of ~0.1 s, so overall I am dealing with an average of at most ~1000 events. This would mean a current variation of ~3%. Less than what I see, but not a huge deal off.

That is not to say that I am certain right now, that I actually am collecting the true quantum randomness of the decays. It could be partially or even mostly something else. I will try to investigate this a bit more in detail at some point.

As for the bit rate, in some tests I was able to get in the order of 1-10 bits/second. This is not going to be a fast RNG. XD

Are you sure? yes | no

Don Froula wrote 06/25/2021 at 11:49 point

Thank you for the explanation. I do agree that, provided the measurement window is small and the count rate not too high, the Poisson distribution should give sufficient variability to detect.

Smoke detectors have a dual-chamber design. One chamber is exposed to the atmosphere but unvented to prevent smoke from entering. It is used as a reference chamber to eliminate variability due to humidity and atmospheric pressure changes. Another chamber is vented to outside air to allow smoke variation.

The Darlington current amplifier seems connected only to one of the two chambers. Smoke detector chips use a differential op amp in conjunction with the reference chamber to eliminate spurious current fluctuations. It appears that you are using only one of the two chambers and not compensating for pressure or humidity. It seems this might introduce a significant non-random variation into the system.

Interesting idea!!!!

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/25/2021 at 17:19 point

I have in fact experimented a bit with the different possible combinations of which contacts of the ion chamber to connect to 9V or the preamp input. It does not make that much of a difference actually. But the setup I have at the moment has the body and the central ring connected to 9V and the Am-electrode to the preamp. Another configuration that works similarly well is having the central ring as the preamp input and the body and lower electrode on 9V. In any case the aim is to use as much of the ionised volume as possible. I might go back to the "central cathode" configuration since at least in theory it should reduce the drift time of the ions due to larger fields and shorter drift distances. And shorter drift times mean less current averaging over time.

Are you sure? yes | no

WallyWare wrote 06/24/2021 at 10:39 point

1) What is the cutoff frequency of your RC filter?

2) How do you separate the 1/f flicker noise generated by the darlington transistors from your quantum noise?

3) Using a schmitt trigger adds hysteresis to the comparator which might introduce bias to the randomness.

4) Have you tried recording your number stream and performing some basic randomness testing?

5) Any idea what the probability density function is for an alpha emitter?

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/24/2021 at 19:05 point

1) The one for the oscilloscope measurement? C=47 uF, R=1 MOhm, so tau=47 seconds. I also have a low-pass filter in there after the preamp. It has a cut-off frequency of 33 Hz.

2) So far, I don't. Without the ion source, the signal is 0, so that's something. At the end I at least want to check whether it is plausible that the randomness I see is actually caused by variations in the conductivity. But I don't think I will be able to prove that it is just that and not some other source of noise.

3) Yeah, I have a reference voltage generator circuit that should automatically adjust to get a long-term duty cycle of 50/50. But a small bias will remain.

4) I have. The raw output is not actually that good (because of the remaining bias towards either 0 or 1), but there are ways to turn a slightly biased bi stream into an unbiased one, e.g. http://www.eecs.harvard.edu/~michaelm/coinflipext.pdf

After a bit of processing, I got a bit stream that passed most of the NIST tests: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf

I will re-visit this when I actually have the hardware finished.

5) The number of decays in a given time interval should be Poisson distributed. Starting from there I will probably try to deduce a distribution of ionisation charge, i.e. current integrated over fixed time windows. Might be enough to check whether it is at least plausible that the variations I see come from the radioactive decay itself.

Are you sure? yes | no

WallyWare wrote 06/25/2021 at 15:05 point

The 33Hz high pass filter is likely blocking any 1/f flicker noise from the electronics.

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/25/2021 at 17:07 point

It's a _low_-pass filter. It is intended to get rid of any remaining 50 Hz noise while letting the slower current variations through.

Are you sure? yes | no

kaily wrote 06/23/2021 at 17:59 point

Wouldn't a sealed chamber be less vulnerable to tampering? If yes i am wondering if it's possible for the typical consumer to buy such part?

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/23/2021 at 23:59 point

You mean a sealed ion chamber? In the end it will all be container in a metal case, so I don't think it will matter much. And of course you are free to put as much EM shielding around the ion chamber in whatever place you like. Unless I misunderstand which kind of tampering you refer to.

Are you sure? yes | no

kaily wrote 06/24/2021 at 00:00 point

I was thinking about introducing highly ionized air :)

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/24/2021 at 00:13 point

Introducing ionised air would mess with things just like blowing smoke into it (see other comments below), just in the opposite direction. I have not really thought about malicious attacks like this. The best protection against this kinda thing is probably putting this somewhere where black hats cannot reach it. XD

Are you sure? yes | no

Joe Coutcher wrote 06/23/2021 at 16:15 point

Does introducing smoke affect the entropy?

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/24/2021 at 00:07 point

Smoke should reduce the overall conductivity of the ion chamber. That's how these smoke detectors work. Depending on how much the conductivity drops, the signal might become too low for my circuit to use it. But even before that, if the conductivity suddenly drops, the output signal will drop below the reference voltage and thus the output will be pulled to a constant value for a while. The reference voltage will adjust automatically to get back to a 50/50 ratio of 1s and 0s at the output, but that process is deliberately slow to allow for long runs of the same value. So yeah, blowing smoke into this will mess with the randomness of the output.

The randomness of the radioactive decay (and thus the randomness of the conductivity variation itself) should not be affected.

Are you sure? yes | no

Don Froula wrote 06/25/2021 at 20:55 point

There a very simple Windows command line program here:

https://www.fourmilab.ch/random/

...to test the random quality of a data set. Fast and easy way to test the generated data.

Are you sure? yes | no

Lukas Koch aka Ast wrote 06/26/2021 at 15:30 point

Ent is great, but it by no means guarantees that your random sequence is actually random. I am using a test suite published by NIST to check for the quality of the final bitstream (after some processing to get rid of biases in the raw bitstream): https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf

Are you sure? yes | no

## Similar Projects

Project Owner Contributor

### Pulse to Tone Converter

Christoph Tack

Project Owner Contributor

### ArduGen

Evangelos Petrongonas

Project Owner Contributor

### Nixie Tube 170 V flyback DC-DC power converter

James Wilson

Project Owner Contributor

sx107

# Does this project spark your interest?

Become a member to follow this project and never miss any updates