Reader small image

You're reading from  Raspberry Pi LED Blueprints

Product typeBook
Published inSep 2015
Publisher
ISBN-139781782175759
Edition1st Edition
Right arrow
Author (1)
Agus Kurniawan
Agus Kurniawan
author image
Agus Kurniawan

Agus Kurniawan is an independent technology consultant, author, and lecturer. He has over 18 years' experience working on various software development projects, including delivering training courses and workshops, and delivering technical writing. He has done a few research activities related to wireless networking, software, and security in multiple universities. Currently, he is pursuing a Ph.D. program in Computer Science in Germany. He has previously written five books for Packt.
Read more about Agus Kurniawan

Right arrow

Introducing a shift register


If our project needs to control 32 LEDs, we would normally require 32 pins of a microcontroller (MCU). The problem is that every MCU has a limited number of pins for GPIO. To address this issue, we can extend our MCU GPIO pins.

One of the solutions to extend GPIO pins is to use a shift register. We can use 74HC595 to extend the GPIO output pins. If you want to extend the GPIO input pins, you can use 74HC165. The schema of 74HC595 can be seen in the following figure:

The Q0 to Q7 pins are the parallel output from the chip. The DS pin is the serial data. STCP is the latch pin, and SHCP is the clock pin.

In this section, you will see how to implement a shift register to extend Raspberry Pi GPIO output pins using IC 74HC595 (Sparkfun, https://www.sparkfun.com/products/733). We need eight LEDs for the demonstration. The program will turn on only one LED at a time. It starts from LED 1 to 8. The hardware wiring is shown in the following figure:

When the output enable...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Raspberry Pi LED Blueprints
Published in: Sep 2015Publisher: ISBN-13: 9781782175759

Author (1)

author image
Agus Kurniawan

Agus Kurniawan is an independent technology consultant, author, and lecturer. He has over 18 years' experience working on various software development projects, including delivering training courses and workshops, and delivering technical writing. He has done a few research activities related to wireless networking, software, and security in multiple universities. Currently, he is pursuing a Ph.D. program in Computer Science in Germany. He has previously written five books for Packt.
Read more about Agus Kurniawan