Reading inputs from shift registers using just one single pin

Here’s an interesting article about reading data from shift registers using less than three pins. 74HC165 shift registers are a popular choice for adding inputs to a microcontroller. They have a parallel input register which can be read using the latch, then shifted into a microcontroller via the data and clock pins. For those counting, that’s the three pins normally associated with driving these devices.

This hack first does away with the latch pin. The addition of a carefully trimmed RC circuit (capacitor is charged by the clock pin, then the resistor lets that cap slowly discharge) means that the device will not latch until after the clock stops toggling. This technique drops the control down to just two pins (data and clock). You can still use hardware SPI to read the data using this method. It’s the same as using SPI to drive 595 shift registers except the microcontroller reads data instead of writing it.

But wait, there’s more! The diagram above actually shows a way of reading this shift register with just one pin. Notice that the clock and data pins are now connected to just one of the microcontroller pins. The data pin has an added resistor, which keeps the current low enough that it will not compete with the clock signal coming from the microcontroller. In between clock pulses, the microcontroller switches from output to input to read the data pin on each cycle. Give it a try, it’s a fun experiment!

Chipophone plays video game classics

This thrift shop organ gets a new life as an 8-bit music maker. Called the Chipophone, it relies on an ATmega88 to produce sounds that you might associate with classic video gaming. [Linus Akesson] takes us through all of the different sound settings in the video after the break, including performances of your theme music favorites.

The original organ uses transistor logic making it rather easy to patch into the hardware. Thanks to the build log we know that [Linus] used 74HC165 input latches to monitor each of the switches for the 120 inputs. Fifteen of these latches work like a backwards shift register 74HC595, cascading all of the parallel inputs into one serial signal. From there the microcontroller takes over, monitoring the keys, pedals, switches, and potentiometers and outputting the appropriate sounds.

[Thanks 7e]

Follow

Get every new post delivered to your Inbox.

Join 94,598 other followers