Arduino True Random Number Generator

 by coolsciencetech
Featured

Step 4: Connect the Arduino to a Computer

To interface the arduino with the computer, connect it using a USB port. I chose to program the software in a language called processing, which has built in libraries for communication with an arduino. Its also cross platform, so you should be able to use all the software for this project without a problem.

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.
 
Remove these adsRemove these ads by Signing Up
corpuscallosum says: Apr 15, 2012. 7:00 AM
How is there a hardware bias?
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!