Main Content

What do you do when your microcontroller does not have enough pins? In this tutorial we will learn how to use shift registers to control LEDs and to read out pushbuttons, all with just three wires! In six steps, we will learn all about the CD4094 output-type shift register, the CD4021 input-type shift register, and how to use them with a PIC microcontroller. And in the end we will pit it all to use with an SNES game controller, which—you guessed it—also uses shift registers on the inside.

As usual, you can find a detailed list in the components box. The main for today’s tutorial are:

- The CD4094 output-type shift register. We will use this shift register to control simple 5mm LEDs.
- The CD4021 input-type shift register, which we will use to read out the status of pushbuttons.
- A PIC16F1455 microcontroller. We could use any other PIC microcontroller, too, and the relevant code to interact with the shift registers works exactly the same on any microcontroller.
- Other than that, we just need some LEDs, resistors, capacitors, pushbuttons, breadboards, and wires :)
So let’s get started with our main idea for today!”

Link to article