Hardware Random Number Generators(HRNGs) are used in cryptography to generate cryptographic keys as well as in other security applications.
The hardware is a simple circuit using a IR photodetector with an Ardunio microcontroller.
The IR photodetector was chosen to taken advantage of random infrared signals present in the environment.
This process was interesting, utilizing the ECE Instructional lab I got the Ardunio and some advice on how to proceed.
Then I went to the Hive MakerSpace for components.
To start out I first used a photoresistor to generate the numbers but there was very was very little variation in the values given.
So I switched to using a photodetector as they are more sensitive to small changes in values of light.
/// Define the analog pin where the photresistor is connected
const int sensorPin = A5;
void setup() {
// Set the serial communication baud rate
Serial.begin(9600);
}
void loop() {
// Read the value from the photresistor
double sensorValue = analogRead(sensorPin);
//Need code for running average for variations.
// need code for finding lowest and highest values
// Convert the average value to a bit
//int bitValue = averageValue > 0.5 ? 1 : 0;
// Print the bit value
//Serial.print(bitValue);
// Serial.print(averageValue);
Serial.print(sensorValue);
// delay
delay(2000);
}
The code defines which pin I use first. Then starts reading from it.
What needs to be implemented is something that converts the analog signal into a zero or one.
From there we can have a bit stream which can be utilized further.
This task was a little daunting as I was unfamiliar with C++ coding. But using online resources and guides I was able to create something to control the sensor and record the data.
I recently noticed I could directly connect the controller to Matlab so I will be looking into that to process the data with some programs I have already written.
Using Matlab the data was plotted to generate the plots on the left.
From viewing the data I can see that the signal is almost random.
The histogram resembles a Gaussian distribution but further analysis needs to be done.
I believe the HRNG could be improved. Using a UV sensor, microcontroller with better precision, and a dark box with scintillator should give more random events.