What Is SPI? Pinouts, Wiring, and Common Errors (2026 Guide)

What Is SPI? Pinouts, Wiring, and Common Errors (2026 Guide)

SPI is a synchronous, full-duplex serial bus — data moves in both directions at once, timed by a clock the master generates. It's the fastest of the common hobby protocols, running in the megahertz range against I2C's 100–400 kHz, and every device on the bus gets its own dedicated select line instead of sharing an address.

Quick answer: SPI uses four wires — SCK (clock), MOSI (master to slave), MISO (slave to master), and one CS/SS line per device. On an Arduino Uno the hardware SPI pins are fixed: D13=SCK, D12=MISO, D11=MOSI, D10=SS. Unlike I2C, every SPI device needs its own CS pin, which is why SPI needs more wiring as you add devices.

Proof of work: the explanation and code below are Soldr's actual answer to "What is SPI and how do I use it?", asked through Compoden's AI build assistant on 11 August 2026. Published 11 August 2026 · Last updated 11 August 2026.

Soldr's answer explaining SPI: SCK, MOSI, MISO, and one CS line per device, with the Uno's fixed hardware SPI pins
Soldr's build log answering "What is SPI and how do I use it?" — the four-wire explanation and a MAX7219 LED matrix example on an Arduino Uno.

What are the four SPI wires for?

SCK is the clock, generated by the master and shared by every device on the bus. MOSI carries data from master to slave; MISO carries data the other way. CS (Chip Select, also called SS) is the one wire that's not shared — every SPI device gets its own CS line, and pulling it low tells that specific device "you're being talked to." That's how one master can drive several slaves over the same clock and data lines.

SPI at a glance
Property Value
Wires 4: SCK, MOSI, MISO, CS (one CS per device)
Speed Megahertz range — the fastest common hobby protocol
Device addressing None — each device is selected by its own CS line instead
Duplex Full-duplex — data moves both directions on every clock tick
Arduino Uno pins D13=SCK, D12=MISO, D11=MOSI, D10=SS (fixed, ATmega328P hardware SPI)

How do you wire a first SPI device to an Arduino Uno?

A MAX7219 LED matrix is a good first SPI device — it's SPI-native, inexpensive, and gives you an immediate visual result. You can drive SPI two ways: the low-level SPI library directly, or (for the MAX7219 specifically) the LedControl library from the Arduino Library Manager, which handles the chip's register protocol for you rather than making you bit-bang it yourself.

MAX7219 wiring on an Arduino Uno
MAX7219 Pin Uno Pin Role
DIN D11 (MOSI) data in
CLK D13 (SCK) clock
CS D10 (SS) chip select
VCC / GND 5V / GND power

This is the exact firmware from Soldr's session (LedControl-based, not raw SPI register calls):

#include <SPI.h>
#include <LedControl.h>

// DIN, CLK, CS, number of devices
LedControl lc(LED_BUILTIN, 11, 13, 10, 1);

void setup() {
  lc.shutdown(0, false); // wake the MAX7219 from power-down
  lc.setIntensity(0, 8); // brightness 0-15
  lc.clearDisplay(0);
}

Captured verbatim from the session's Firmware tab, not independently compile-checked for this post — if you're following along, verify it compiles for your exact board before relying on it.

Why does my SPI device stay dark or not respond?

The MAX7219 ships in power-down mode by default — lc.shutdown(0, false) has to run before anything else, which is why it's the first line in setup(). Beyond that, the two usual suspects are a CS line wired to the wrong pin (each device needs its own, and a shared or miswired CS means the device never gets addressed) and a logic-level mismatch: the MAX7219 runs at 5V logic, which pairs cleanly with an Uno. Moving to a 3.3V board like an ESP32 usually works fine driving a 5V-logic SPI device, but a 3.3V-only slave being driven by a 5V master does need a level shifter.

What do you need to try this yourself?

The two-part SPI playground from Soldr's session: an Uno R3 CH340G ATmega328P Board (Rs.230) and a MAX7219 8x8 Dot Matrix LED Display Module (Rs.98) — no extras needed to see SPI working end to end.

Frequently asked questions

SPI I2C se zyada fast kyun hai?

SPI clock megahertz range mein chalta hai, jabki I2C zyada se zyada 400 kHz tak simit hai - yeh dono protocols ke design ka basic fark hai. SPI simple hai (koi addressing overhead nahi) isliye zyada speed achieve kar leta hai, lekin zyada devices ke liye zyada wires bhi chahiye.

Can I connect multiple SPI devices to one Arduino?

Yes - SCK, MOSI, and MISO are shared by every device on the bus, and you give each device its own CS pin (any free digital pin works for CS, it doesn't have to be D10). Pull one CS line low at a time to talk to that specific device; all others should stay high.

What is the price of a MAX7219 LED matrix module in India?

The MAX7219 8x8 Dot Matrix LED Display Module costs Rs.98 at Compoden, with cash on delivery available across India. Paired with an Uno R3 CH340G board (Rs.230), the full SPI starter setup from this guide costs Rs.328. Prices checked 11 August 2026.

Do I need a level shifter for SPI between a 5V and 3.3V board?

It depends on direction. A 3.3V master (like an ESP32) can usually drive a 5V-logic SPI slave directly without a level shifter. The risky direction is the reverse: a 3.3V-only slave being driven by a 5V master needs a level shifter, or its inputs can be damaged over time.

Back to blog