4 ms·
Can you share any circuits or techniques (or reliable pointers) for getting the randomness from the noise shout accidentally biasing the results? I’m needing a
by K0balt 2y ago
Can you share any circuits or techniques (or reliable pointers) for getting the randomness from the noise shout accidentally biasing the results? I’m needing a good random source for a side- interest of mine.
- nonrandomstring 2y agoSure here's something very simple take [0]. This is for RF, and you probably need less bandwidth. Search on Robert Penfold hobby designs for noise generators for audio too. In practice you'll need to do a few things to get a good digital noise source with proper entropy. 1) Shield it! What you want is noise from the bandgap transition not from your local radio station or ambient "cosmic" noise. 2) Thermally stabilise it. 3) Convert to a digital stream. A Schmitt gate with properly set hysteresis to get clean edge transitions and a 1-bit sampling circuit. The whole design should cost you a few bucks and be buildable in hours. Maybe use a USB audio dongle (minus the DC block capacitors) as an easy-in for your digital side. [0] https://www.radiohobbyist.org/blog/?p=1884 https://www.radiohobbyist.org/blog/?p=1884 [1] https://www.geeksforgeeks.org/schmitt-trigger/ https://www.geeksforgeeks.org/schmitt-trigger/
- atoav 2y ago4) add a Von Neumann extractor (or similar/better) in the digital domain for good measure (pseudocode): function von_neumann_extractor(input_bits): output_bits = [] i = 0 while i + 1 < length(input_bits): bit1 = input_bits[i] bit2 = input_bits[i + 1] if bit1 != bit2: output_bits.append(bit1) # else: discard the pair i += 2 return output_bits See: https://en.m.wikipedia.org/wiki/Randomness_extractor https://en.m.wikipedia.org/wiki/Randomness_extractor
- K0balt 2y agoThanks! This will definitely be useful as I anticipate that setting the threshold for the Schmidt trigger will be imperfect.
- K0balt 2y agoThank you! This will be useful!
- Saigonautica 2y agoI usually settle on this design: https://hackaday.io/project/184643-schrdingers-trigger https://hackaday.io/project/184643-schrdingers-trigger The zener design works well, but I find the signal it produces is a little too fast to sample conveniently (it works a bit too well). The two-transistor design produces a similar but slower signal. 2N5551 works nicely. Then one hex inverter configured as a cheap two-stage inverting amplifier, and another that cleans up the signal into nice 5V with sharp transitions. An optoisolator is another option for the second stage, but adds another part to the design. Then I shove a Von Neumann extractor on an Attiny261A (high bandwidth parallel output) or Attiny10 (if just true/false output), I have a little assembly program for that. It takes the signal in, and outputs 8 bits out in parallel, plus one bit that toggles every time a new output is ready. It's not power efficient, I never use this design on a battery, so I never optimized for sleep modes and so on. Instead I optimized to push a little more bandwidth out and try to sample the signal in a balanced way. Finally, I just grab that with something like a Pi Pico or ESP32 and push it out MQTT. I get something like 100-300 bytes per second depending on the voltage I'm driving the transistors at (anything over 13V gets a little spicy for the first hex inverter, but add a heatsink to it, and it's fine). I have some KiCAD files for a finished board for all this, also has space for a boost converter (the transistors need 10-12V usually to generate a nice signal). I just finished it yesterday, if you leave me your contact I'm happy to let you know when I publish it. Otherwise, just check here in like 1-2 weeks and I'll probably have it up by then: https://github.com/seanboyce/ https://github.com/seanboyce/
- K0balt 2y agoPerfect! Thank you! I’ll check the GitHub in a while.
- Saigonautica 2y agoIt's a long weekend over here, so I managed to load up the code, BOM, KiCAD files, production files, and assembly instructions. Also some scope trace images of what the signal should look like at different stages: https://github.com/seanboyce/TRNG https://github.com/seanboyce/TRNG I didn't specifically design this for other people to easily replicate, but should not be too hard with some solder paste and a hot air rework station. The assembly code is extensively commented-- I realize AVR assembly is not most people's native dialect, haha. I hope you enjoy!