Follow The Bouncing Ball Of Entropy

When [::vtol::] wants to generate random numbers he doesn’t simply type rand() into his Arduino IDE, no, he builds a piece of art. It all starts with a knob, presumably connected to a potentiometer, which sets a frequency. An Arduino UNO takes the reading and generates a tone for an upward-facing speaker. A tiny ball bounces on that speaker where it occasionally collides with a piezoelectric element. The intervals between collisions become our sufficiently random number.

The generated number travels up the Rube Goldberg-esque machine to an LCD mounted at the top where a word, corresponding to our generated number, is displayed. As long as the button is held, a tone will continue to sound and words will be generated so poetry pours forth.

If this take on beat poetry doesn’t suit you, the construction of the Ball-O-Bol has an aesthetic quality that’s eye-catching, whereas projects like his Tape-Head Robot That Listens to the Floor and 8-Bit Digital Photo Gun showed the electronic guts front and center with their own appeal.

Continue reading “Follow The Bouncing Ball Of Entropy”

33C3: How Can You Trust Your Random Numbers?

One of the standout talks at the 33rd Chaos Communications Congress concerned pseudo-random-number generators (PRNGs). [Vladimir Klebanov] (right) and [Felix Dörre] (left) provided a framework for making sure that PRNGs are doing what they should. Along the way, they discovered a flaw in Libgcrypt/GNUPG, which they got fixed. Woot.

mpv-shot0012-zoomCryptographically secure random numbers actually matter, a lot. If you’re old enough to remember the Debian OpenSSL debacle of 2008, essentially every Internet service was backdoorable due to bad random numbers. So they matter. [Vladimir] makes the case that writing good random number generators is very, very hard. Consequently, it’s very important that their output be tested very, very well.

So how can we test them? [Vladimir] warns against our first instinct, running a statistical test suite like DIEHARD. He points out (correctly) that running any algorithm through a good enough hash function will pass statistical tests, but that doesn’t mean it’s good for cryptography.
Continue reading “33C3: How Can You Trust Your Random Numbers?”

Modular Drum Machine Creates Random Rhythms

Don’t worry, the rhythms themselves aren’t random! That would hardly make for a useful drum machine. [kbob]’s creation does have the ability to randomly generate functional rhythms, though, and it’s all done on a breadboard.

The core of this tiny drum machine is two Teensy dev boards. One is an FM synth tuned to sound like drums, and the other is a random rhythm generator with several controls. The algorithms are from Mutable Instruments’ open source Eurorack modules. The entire thing fits on a breadboard with JIGMOD modules for the user interface. The machine runs on lithium batteries in the form of USB cell phone chargers. The battery holders were designed in Fusion 360 and 3D printed.

The function of the drum machine is pretty interesting as well. There are a set of triggers tied to the buttons on the machine. When a button is pressed, the drum machine plays that sound at the appropriate time, ensuring there are no offbeat beats. The potentiometers are polled once every millisecond and the program updates the output as required. There’s also a “grid” of rhythms that are controlled with two other knobs (one to map the X coordinate and the other for the Y) and a “chaos” button which adds an element of randomness to this mapping.

The modular nature of this project would make this a great instrument to add to one’s musical repertoire.It’s easily customizable, and could fit in with any of a number of other synthesizer instruments.

Continue reading “Modular Drum Machine Creates Random Rhythms”

True Random Number Generator For A True Hacker

How can you generate random bits? Some people think it’s not easy, others will tell you that it’s pretty damn hard, and then there are those who wonder if it is possible at all. Of course, it is easy to create a very long pseudorandom sequence in software, but even the best PRNG (Pseudorandom Number Generator) needs a good random seed, as we don’t want to get the same sequence each time we switch on the unit, do we? That’s why we need a TRNG (True Random Number Generator), but that requires special hardware.

Some high-end microprocessors are equipped with an internal hardware TRNG, but it is, unfortunately, not true for most low-cost microcontrollers. There are a couple of tricks hackers use to compensate. They usually start the internal free running counter and fetch its contents when some external event occurs (user presses a button, or so). This works, but not without disadvantages. First, there is the danger of “locking” those two events, as a timer period may be some derivative of input scan routine timing. Second, the free running time (between switching on and the moment the unit requests a random number) is often too short, resulting in the seed being too close to the sequence start, and thus predictable. In some cases even, there is no external input before the unit needs a random seed!

Despite what has already been discussed, microcontrollers do have a source of true randomness inside them. While it might not be good enough for crypto applications, it still generates high enough entropy for amusement games, simulations, art gadgets, etc.

Continue reading “True Random Number Generator For A True Hacker”

Double Pendulum

Powered Double Pendulum Is A Chaotic Display

If you’ve never seen a double pendulum before, it’s basically just a pendulum with another pendulum attached to the end. You might not think that’s anything special, but these devices can exhibit extremely chaotic behavior if enough energy is put into the system. The result is often a display that draws attention. [David] wanted to build his own double pendulum display, but he wanted to make it drive itself. The result is a powered double pendulum.

There aren’t many build details here, but the device is simple enough that we can deduce how it works from the demonstration video. It’s broken into two main pieces; the frame and the pendulum. The frame appears to be made mostly from wood. The front plate is made of three layers sandwiched together. A slot is cut out of the middle to allow a rail to slide up and down linearly. The rail is designed in such a way that it fits between the outer layers of the front plate like a track.

The pendulum is attached to the linear rail. The rail moves up and down and puts energy into the pendulum. This causes the pendulum to actually move and generate the chaotic behavior. The rail slides up and down thanks to an electric motor mounted to the base. The mechanics work similar to a piston on a crankshaft. The motor looks as though it is mounted to a wooden bracket that was cut with precision on a laser cutter. The final product works well, though it is a bit noisy. We also wonder if the system would be even more fun to watch if the rotation of the motor had an element of randomness added to it. Or he could always attach a paint sprayer to the end. Continue reading “Powered Double Pendulum Is A Chaotic Display”

The Most Random Electronic Dice Yet

di

If you’ve written a great library to generate random numbers with a microcontroller, what’s the first thing you would do? Build an electronic pair of dice, of course.

[Walter] created the entropy library for AVRs for a reliable source of true random numbers. It works by using the watchdog timer’s natural jitter; not fast by any means but most sources of entropy aren’t that fast anyway. By sampling a whole lot of AVR chips and doing a few statistical tests, it turns out this library is actually a pretty good source of randomness, at least as good as a pair of dice.

The circuit itself uses two 8×8 LED matrices from Adafruit, an Arduino, and a pair of buttons. The supported modes are 2d6, 2d4, 2d8, 2d10, 1d12, 1d20, a deck of cards, a single hex number, a single 8-bit binary number, or an eight character alphanumeric password. It’s more than enough for D&D or when you really need an unguessable password. Video demo below.

Continue reading “The Most Random Electronic Dice Yet”

The Two Component Random Number Generator

attiny10

[Karl] was in need of a hardware random number generator, but is needs had a few caveats: it needed to be cheap, and sufficiently random. Random number generation can get quite crazy with Geiger tubes, lava lamps, and radioactive decay, but a much smaller solution was found in an 8 pin AVR microcontroller.

The solution uses AVRentropy, a library that uses the watchdog timer’s jitter in AVR microcontrollers to provide cryptographically secure random numbers. Setting up the circuit was easy – an ATtiny45 microcontroller was connected to a cheap chinese USB to serial converter. Three wires, and the circuit is complete. The code was simple as well; it’s just a call to initialize the entropy and write the bits to the serial port.

There are a few drawbacks to this build. Because the entropy library must wait until enough entropy is gathered, it can only produce about two 32-bit numbers per second. That’s all [Karl] needed for his application, though, and with an enclosure made from a wine cork and marble, he has the prettiest and smallest random number generator around.