Linear Feedback Shift Registers For FPGAs

If you want to start an argument at a Hackaday meeting, you have only to ask something like “How much does this weigh?” or “What time is it?” But if you really want to start a street brawl, you can always say, “Are these numbers random?” Making random numbers that are actually random is actually a tough nut to crack. Most of what we do is, technically, pseudo-random (but we’ll say random number and assume you know what we mean). One way to generate seemingly random sequences is to use a linear feedback shift register or LFSR. You can use LFSRs in software, but they are also very useful in hardware design and [Adam Taylor] takes us through his use of them on FPGAs in a recent post. Continue reading “Linear Feedback Shift Registers For FPGAs”

Random Number Generator Is A Blast From The Past

Hackers love random numbers, or more accurately, the pursuit of them. It turns out that computers are so good at following our exacting instructions that they are largely incapable of doing anything that would fit the strict definition of randomness — which has lead to some elaborate methods of generating the unexpected.

Admittedly, the SB42 Random Number Generator built by [Simon Boak] isn’t exactly something you’d be using for cryptography. The method used to generate the digits, a pair of 555 timers sending pulses through linear-feedback shift registers, would at best be considered pseudo-random. Plus the only way of getting the digits out of the machine is by extracting them from the Nixie tubes with your Mark I Eyeballs. But it absolutely excels at the secondary reason many hackers like to build their own randomness rigs — it looks awesome.

Externally, it absolutely nails the look of a piece of vintage DIY year. Down to the classic white-on-black label tape. But open up the hood, and you’re treated to a real rarity these days: wirewrap construction. In an era where you can get PCBs made and shipped to your door for literally pennies, [Simon] is out there keeping the old ways alive. It doesn’t just look the part either. Unlike most modern projects we see, there isn’t a multi-core microcontroller behind the scenes doing all the work, it’s logic gates all the way down.

This isn’t the first random-ish number generator that we’ve seen use shift registers. But if you’re looking for something that might actually pass some randomness checks, and don’t mind working with something a bit spicy, you could check out some of the previous devices we’ve covered that used radioactive decay as an entropy source.

Continue reading “Random Number Generator Is A Blast From The Past”

A Relay-Based Pseudorandom Number Generator

There are a great variety of ways to build a random number generator, and similarly many ways to generate numbers that appear random, but in a pure mathematical sense generally aren’t. [Daniel Valuch] built a Christmas decoration that does the latter, displaying the results on an attractive flashing ornament.

The build relies on a 16-bit linear feedback shift register, or LFSR. The LFSR generates a stream of numbers, with each number dependent on the previous state of the register. Thus, the numbers generated are pseudorandom, not truly random, and depend on the initial seed value of the system. [Daniel] built the shift register using relays, which create a lovely clacking sound as the register operates, and LEDs, which glow depending on the values in the register.

The result is a cute Christmas ornament that blinks in a deterministic fashion, and has a great old-school look due to the exposed copper of the PCB and the retro LED colors used. The project also serves as a great way to learn about shift registers and basic relay logic, though the latter is rarely used these days for serious purposes. We’ve covered the topic before, too. Video after the break.

Continue reading “A Relay-Based Pseudorandom Number Generator”

Shift Register Powered Realistic Candle Flicker

[Kevin Darrah] recently went out to dinner at a restaurant that was using some cheap LED candles (yuck) instead of the real thing. And in the true spirit of a hacker, he started to notice the patterns programmed into the fake flame repeat over and over again. And like any hacker might, his mind started to devise a better way.

Now’s the time where some of us lazy hackers might grab a microcontroller, and copy and paste in some pseudo-random number generating code you found on the Internet, but not [Kevin]. The basics of his hack uses two shift registers tied together that are fed a single clock signal, and also a latch signal that is slightly delayed version of the same signal made by a RC-time circuit.

The randomness of the output is created is by feeding back the outputs of the shift registers to an XOR gate. If you want to learn more about this, the technique it’s called a “linear feedback shift register“. It’s commonly used as a poor-man’s random number generator, although it’s not technically truly random, statistically it does a very good job. You can see the results in the video after the break where [Kevin] describes the circuit.  He wraps up the hack with a battery and solar charging circuit as well to make a completed project.

Continue reading “Shift Register Powered Realistic Candle Flicker”