Book Image

Raspberry Pi LED Blueprints

By : Agus Kurniawan
Book Image

Raspberry Pi LED Blueprints

By: Agus Kurniawan

Overview of this book

Table of Contents (14 chapters)
Raspberry Pi LED Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Expanding Raspberry Pi GPIO


Let's consider that you want to build a five-road intersection model. This means that you need at least 15 pins on Raspberry Pi GPIO. As you know, Raspberry Pi GPIO has limited pins, so we need to expand Raspberry Pi GPIO.

There are many approaches to expand Raspberry Pi 2. In Chapter 2, Make Your Own Countdown Timer, and Chapter 3, Make Your Own Digital Clock Display, we already learned how to expand Raspberry Pi GPIO via the shift register method. Now, you will see how to expand Raspberry Pi GPIO using another approach. Let's introduce the IC MCP23017. It's a 16-bit input/output (I/O) port expander with interrupt output and able to be cascaded for up to eight devices on one bus. The MCP23017 uses I2C for communication. Comparing with SPI, I2C uses a bus system with bidirectional data on the SDA line. Otherwise, SPI is a point-to-point connection with data in and data out on separate lines, MOSI and MISO. To communicate devices through I2C, you need to specify...