Introduction
Here is a comparison in an image between a TRNG and the PHP rand() function.
(Image from https://www.random.org/analysis/)
We can see a pattern… that is not true randomness.
Let’s see an example:
A temperature sensor gets this data:
21.19 ºC
21.35 ºC
21.41 ºC
21.17 ºC
21.82 ºC
Now we need only the noise in order to use the nature’s randomness:
19
35
41
17
82
Then we can, for example, generate a random bit by taking the last noise digit, n:
If (n <= 5), bit = 0;
Else if (n > 5), bit = 1
1
0
0
1
0
Also, we can generate, for example, SHA-1 hashes:
b3f0c7f6bb763af1be91d9e74eabfeb199dc1f1f
972a67c48192728a34979d9a35164c1295401b71
761f22b2c1593d0bb87e0b606f990ba4974706de
0716d9708d321ffb6a00818614779e779925365c
76546f9a641ede2beab506b96df1688d889e629a
Please follow this project and learn how to generate your own True Random Numbers with this open source development board, TRNG Zero.
ELF-VLF noise source:
The electromagnetic spectrum includes both natural and human generated waves at different frequencies. Fortunately, many of the human RF transmissions at very low frequencies has been stopped. We can hear natural noise between 0 to 2400Hz, which includes: Schumann resonances, Sferics, Tweeks and Whistlers (More info). Thereby, we can spect to get a good randomness quality, but there is a problem, our electrical grid produces a very high unnatural noise at 60Hz/50Hz. So, we have to filter out that noise and keep the remaining 0 to 2400Hz signals. This can be done with high quality filters: 1 low-pass and 1 notch. I have successfully calculated and simulated (LTspice) a good filter circuit:
* For 50Hz, change R1=R4=318.309kohm and R2=R3=6.366Megohm.
Now I have to add an antenna (loop) and amplify the clean noise... Coming up.
Accelerometer / magnetometer
I realized that accelerometers and magnetometers are good noise sources, even those with digital interfaces like TWI. My choice was the Bosch BMC150 sensor, which includes accelerometer and magnetometer in one chip.
I made an experiment like the image above, in order to check the randomness quality. This technique is not sophisticated, but it's a good start: I took the LSB of every sensor reading during 10,000 readings, then I made a 100 x 100 px bitmap representing whether a '0' with a white dot or whether a '1' with a black dot. I made sure to read the sensors not so fast, avoiding to read unchanged values. Here are the results:
can you generate your own numbers on random result generator which is a website online?