Anyone who has experience with programming will have probably used random numbers in their code. These random numbers aren't actually random though. They are actually generated using an algorithm that produces numbers that appear to be random, but the numbers actually follow a sequence. While these "pseudo-random" numbers are fine for some purposes, they just won't do for others. Cryptography is a case where the predictability of pseudo-random would allow someone to break codes with ease.
True random numbers on the other hand rely on quantum phenomena, or chaotic systems. Quantum systems include things like radioactive decay, and shot noise in electronic circuits, and are fundamentally random processes. Chaotic systems are things like atmospheric noise, which is so chaotic, that it can effectively be used as a source of randomness.
I wanted to build a true random number generator just for fun, and to see how well it would work considering that it is fairly cheap and easy to set up.
Step 1: Materials
MightyOhm geiger counter - $100 without case, $115 with acrylic case (or any geiger counter with a pulse out)
22 gauge solid core copper wire - $4 (for a whole roll. You can probably even use some multi-strand wire)
3 pin female header - found for free
salt substitute (optional) - $4
Step 2: Assemble the Geiger Counter
I bought my geiger counter from mighty ohm (www.mightyohm.com). It comes as a kit, so you need to solder it up yourself. It didn't take me long to put it together and it worked perfectly on the first try. Full assembly instructions can be found on their website. Although the geiger counter doesn't come with a display, it does have an LED indicator and a peizo speaker that beeps whenever it detects a particle. The board also has a pulse out pin that we'll use to hook it up to the arduino.
Step 3: Connecting to the Arduino
These instructions are specific to the mighty ohm geiger counter, but should be similar to connecting any other geiger counter with a pulse out.
If you want to run the geiger counter without batteries
1. Locate the 3 pin connector labeled PULSE
2. Connect the first pin (marked with an arrow on the board) to the 3.3v output on the arduino.
3. Connect the middle pin (pulse out) to digital pin 8 on the arduino.
4. Connect the last remaining pin to a ground pin on the arduino.
If you want to run the geiger counter with batteries, only do steps 3 and 4, leaving the first pin unconnected
Step 4: Connect the Arduino to a Computer
First download the arduino sketch (make sure you have the newest version of the arduino software) and burn it to your arduino.
Then, download one of the processing sketches.
A couple of notes about the software:
The arduino sketch constantly reads pin 8, checking for a pulse from the geiger counter. When it detects a pulse, it checks the time in milliseconds that the arduino has been running for. It does this four times and then finds the length of time between the first and second pulses and the third and fourth pulses. If the first length of time is greater than the second length of time, then the bit will be a 0. If the second length of time is greater than the first length of time, then the bit will be a 1. Once the bit is generated, it is sent to the computer. This is based of the algorithm used by http://www.fourmilab.ch/hotbits/
There are two different versions of the processing sketch, one with biased bits, and the other with unbiased bits. The difference is that the biased one may be biased slightly due to the hardware, but produces a bit every four counts of radiation. The unbiased sketch preforms an XOR operation on two incoming bits to remove hardware bias, but produces a bit every 8 counts, doubling the time it takes for bits to be produced.
Regardless of the version you chose, the processing sketch will run until it makes 1000000 bits (or you turn it off). Every 500 bits, it saves the bits to a text file that you specify when the sketch starts up.
Step 5: Detect Radiation
Step 6: Using the Bits
At this point you should be able to generate random numbers for whatever you want. If you do something cool with it, post an instructable about it!
Note: I have not subjected the bits to any statistical test to verify how random they are, beyond testing 1000 bits to see if the number of 0s occured as often as 1s (very close to 50/50) Also, I cannot assure that the bits will be random enough for real world serious applications where random numbers are needed, but they should be good enough for whatever a hobbyist would have in mind.