Using SPI to control an LED matrix

In Chapter 10, Sensing and Displaying Real-World Data, we connected to devices using a bus protocol called I2C. Raspberry Pi also supports another chip-to-chip protocol called Serial Peripheral Interface (SPI). The SPI bus differs from I2C because it uses two single direction data lines (where I2C uses one bidirectional data line).

Although SPI requires more wires (I2C uses two bus signals, SDA and SCL), it supports the simultaneous sending and receiving of data and much higher clock speeds than I2C:

General connections of SPI devices with Raspberry Pi

The SPI bus consists of the following four signals:

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.