Improved Hourglass Entropy


[Wardy] built himself a high quality entropy source with parts he had lying around. It’s based on the hourglass entropy project we saw in a links post earlier this month. Just like that project, he is bouncing a laser off of the falling sand and reading the result. But he brings a few innovations to the party, and has test results to back up his work.

The first change is an obvious one; motorize the hourglass so that you don’t need to flip it by hand. We thought this might mess with the laser alignment but the clip after the break proved us wrong. He changed up the sensor, using an LED connected to the base of an NPN transistor. The next change was to mount the light sensor at an angle to the laser rather than straight on. This picks up reflections of the laser and not the direct beam itself, resulting in a wider range of readings.

He used an Ethernet shield to get the system on the network. It’s pushing 420k random numbers per second and was tested with the DieHarder suite. It didn’t get a very high score, but it did pass the test.

[via Dangerous Prototypes]

16 thoughts on “Improved Hourglass Entropy

  1. nice. Would it be possible to use a blower and just cycle sand from the bottom to the top in a never ending loop?

    Just to eliminate the need to turn the hourglass. Very nice looking build still.

  2. Wikipedia’s page on hardware random number generation refers to the Silicon Graphics folks using a lava lamp to generate entropy. They setup a webcam to watch the lamp, then process (hash) the image to produce a binary string. In this way, it’s continuous — no flipping of an hourglass required. Of course they patented it. :(

  3. I would like to hear whether/how your the changes in your version differ from the previous instantiation. Between your higher sampling rate, use of a photodiode instead of a photoresistor, and using reflectance instead of transmittance, it’d be nice to know if there are differences beyond just “more bits of randomness per second”

    1. It’s a blue LED being used as a sensor to be specific, otherwise there isn’t really any difference to the original hack I based this on. Apart from the fact that it’s fully hands free.

    1. That 2009 hack was mine, and had almost escaped my conscious memory. The old website has expired, but I just reloaded it here. Keep us posted on the new work. I was thinking about putting a Drinking Lucky Bird 10 feet underground in a ductile iron pipe with a Raspberry Pi and a webcam on the bird, all powered POE. That would be some high-grade entropy.

    1. Yeah, that’s fair comment up to now. However I’m going to add some extra robustness to the build by the following means…

      1 – build a light-tight enclosure so that ambient room light cannot influence the readings (it would increase the average reading somewhat.)
      2 – Stop using an ADC! A to D conversion is really slow and I’m only using the least significant bit of each reading anyway, which was a bit daft of me. I’ll rectify that mistake by just reading a digital bit directly off the IO pin. This should increase the bit generation rate to several megahertz!
      3 – Tune the laser / egg timer / servo positions and add some non-reflective paint here and there in order to try to increase the granularity (excuse the pun) of the readings. Reading the pin directly instead of using the ADC is effectively going to use the MSB instead of the LSB as I was previously doing, so that will need rectifying in order to prevent long streams of 111111111 or 00000000000 flooding the data.

      But I’m happy that even without any tuning or optimisation it still passes the diehard tests. I’ll try to get the test scores as high as I can before I do a complete build log and provide source code :)

  4. Wow a lot of bulky, breakable stuff with sand in it just to seed a RNG… how about one of the many diode or diode connected trasistor white noise circuits out there? I use one running through a 4049 inverter get a proper postive going stream of random bits to feed my PICs when I need true randomness. You can use a simple boost supply if the higher voltage requirements of of the WNG is bothersom to you. I guess there are 101 ways to skin a cat, but this is a BIT overkill (no pun intended). It’s like using a 10 pound sledgehammer to drive a finish nail. You can do it that way, but why on earth would you? Here are some other ideas I just thought of off the top of my head, but staying away from the obvious and expensive radioactive decay stuff while giving maximum overkill potential.

    microphone capturing wind noise.

    piezo disk glued to a tin pan, placed out in the rain.

    photo interruptor capturing rain drops.

    video capture of blowing trees or shadows of blowing trees.

    piezo disk glued to a tree to capture the creaking of it swaying in the breeze.

    piezo disk glued to a road surface.

    piezo disk with a high gain amplifier glued to a cold water pipe.

    of if expensive overkill is more your cup of tea:

    CCD or CMOS video sensor with high gain, picking up hot pixels, raw.

    photo multiplier tube out of some cheap, russian or chinese nightvision googles coupled to a CCD or CMOS video sensor looking for hot pixels.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.