Kelly Heaton Studio

View Original

Shift registers

I am in the process of building a control system for the insects in my latest Electrolier. As a starting point, I will use shift registers with (or possibly without) linear feedback. Adding linear feedback involves "tapping" two or more of the logical outputs, evaluating their state with boolean logic (usually an XOR gate), and feeding the result back into the start of the shifting sequence. In my video, you can see two 8-bit shift registers in the center (TI part number CD54/74AC164E). I put LEDs on the logic outputs Q0-Q7 to visualize what is happening. As you can see, the LEDs of the two shift registers are not synchronized, a property of an undefined starting state that I will exploit to get randomness for "free" -- at least that's what I'm thinking.

More about my breadboard: on the right is a 555 timer in astable mode which provides a clock pulse of about 1x per second. On the left is a 5 volt regulator - this part is irrelevant if you have the correct DC supply voltage, but mine is 12 VDC.

Good general overview to answer the question “what is a linear feedback shift register” (LFSR):
https://zipcpu.com/dsp/2017/11/11/lfsr-example.html

On choosing taps for a linear feedback shift register:
https://cs.stackexchange.com/questions/1121/choosing-taps-for-linear-feedback-shift-register

Mini project on how to implement a LFSR: https://www.slideshare.net/KishoreChandrahasVanam/lfsr

Another helpful paper on using an 8-bit LFSR (i.e. Texas Instruments chip CD54/74AC164):
https://pdfs.semanticscholar.org/320a/8b2e781ac6165b400eca96047489685fd1f7.pdf

One final note: because shift registers are comprised of flip flops, an option to add true randomness to this otherwise pseudorandom bit generator is to exploit the metastability characteristics of a flip-flop as described here by @crj11: https://electronics.stackexchange.com/questions/394557/old-school-pseudorandom-pulse-generator-requesting-assistance-with-hardware-des?noredirect=1#comment965703_394557