The Serial Peripheral Interface (SPI) bus relies on four core wires to move data between a microcontroller and a peripheral. If you are wiring a new sensor, display, or memory chip, the default 4-wire SPI pinout consists of SCK (Clock), MOSI/COPI (Master Out), MISO/CIPO (Master In), and CS/SS (Chip Select). However, legacy naming conventions, vendor-specific GPIO defaults, and 5V-to-3.3V logic mismatches cause 90% of bench failures.
Below is the definitive reference for SPI pinouts, signal naming updates, and exact default GPIO mappings for the most common maker boards in 2026.
The Complete SPI Pinout & Naming Reference Table
The industry has recently shifted away from Master/Slave terminology toward Controller/Peripheral or Source/In terminology. Depending on the datasheet you are reading (e.g., older Arduino libraries vs. modern Espressif or ONSemi docs), the silkscreen on your breakout board will use different acronyms for the exact same signals.
| Signal Function | Legacy Name (Arduino/AVR) | Modern / Inclusive Name | Vendor Specific (RPi / ESP32) | Typical Hobby Wire Color |
|---|---|---|---|---|
| Clock Generated by controller to sync data |
SCK / SCLK | SCK | SCK / SCLK | Yellow |
| Data Out (from Controller) Data sent from MCU to sensor |
MOSI | COPI / SDO | MOSI / SDO | Blue |
| Data In (to Controller) Data received from sensor |
MISO | CIPO / SDI | MISO / SDI | Orange |
| Chip Select Active-LOW enable for specific device |
SS | CS | CE0, CE1 / CS | Green |
Rows People Get Wrong (And How to Fix Them)
Even with the table above, three specific scenarios routinely brick projects or result in silent communication failures.
1. MicroSD Card Modules (The DO/DI Trap)
MicroSD breakout boards rarely use standard SPI silkscreen. They use SDIO naming conventions: DI (Data In) and DO (Data Out).
The Mistake: Wiring the MCU's MOSI to the SD card's DO, assuming 'Out' matches 'Out'.
The Fix: SD card 'DI' means data going into the card. Therefore, MCU MOSI connects to SD DI, and MCU MISO connects to SD DO. Always cross the TX/RX or DI/DO lines between two devices.
2. ESP32 VSPI vs. HSPI Defaults
The ESP32 has multiple hardware SPI buses. The Arduino IDE defaults to VSPI, but many copy-paste tutorials accidentally initialize HSPI. If you wire your physical breadboard to the VSPI pins but your code calls SPI.begin(14, 12, 13, 15) (which are HSPI pins), your display will remain blank. Always verify your bus initialization matches your physical wiring.
3. Raspberry Pi CE0 vs. CE1
The Raspberry Pi 40-pin header exposes SPI0 with two hardware Chip Select lines: CE0 (BCM 8) and CE1 (BCM 7). If you are using the default spidev0.0 in Python, you must wire your sensor's CS pin to physical pin 24 (CE0). Wiring it to CE1 while calling spidev0.0 will result in the Pi driving the bus while the sensor ignores it.
Board-Specific Default SPI GPIO Mappings
When you call SPI.begin() without arguments, the microcontroller routes the SPI peripheral to specific default GPIO pins. Here are the exact hardware mappings for the three most common development boards.
| Board Variant | SCK (Clock) | MISO / CIPO (MCU In) | MOSI / COPI (MCU Out) | Default CS / SS |
|---|---|---|---|---|
| Arduino Uno R3 / Nano (ATmega328P) | D13 | D12 | D11 | D10 |
| ESP32 DevKit V1 (VSPI Default) | GPIO 18 | GPIO 19 | GPIO 23 | GPIO 5 |
| ESP32 DevKit V1 (HSPI Alternate) | GPIO 14 | GPIO 12 | GPIO 13 | GPIO 15 |
| Raspberry Pi 4 / 5 (SPI0) | BCM 11 (Pin 23) | BCM 9 (Pin 21) | BCM 10 (Pin 19) | BCM 8 (Pin 24) |
Safe Interpretation: Identifying Unmarked SPI Pins
cheap breakout boards from overseas marketplaces often arrive with rubbed-off silkscreen, or the manufacturer simply omitted pin labels to save a fraction of a cent on PCB manufacturing. Do not guess. Use your multimeter to map the unmarked 6-pin header safely.
- Find GND: Set your multimeter to continuity mode. Probe the large ground pour or the metal shielding of the sensor IC. The pin on the header that beeps is GND.
- Find VCC: Look for a voltage regulator (like an AMS1117-3.3) or a decoupling capacitor near the power input. The pin connected to the input side of the regulator (or the positive leg of the bulk capacitor) is VCC.
- Find SCK (Clock): Power the board with its rated voltage. Set your multimeter to AC Voltage or Frequency mode. Probe the remaining unknown pins while the MCU is actively polling the sensor. The SCK line will show a fluctuating AC voltage or a readable frequency (often between 1MHz and 10MHz). Data lines (MISO/MOSI) will read as erratic DC voltages, and CS will sit at a steady 3.3V (HIGH) until a transaction begins.
- Differentiate MISO and MOSI: If you have an oscilloscope, MOSI will show continuous bursts of traffic from the MCU, while MISO will only show responses from the sensor. With only a multimeter, wire them one way; if the MCU reads all zeros or 0xFF, swap the two data lines.
Decision Tree: Wiring and Level Shifting Strategy
Use this decision path to determine your exact wiring and hardware requirements. Do not skip the voltage check.
| MCU Logic Level | Sensor Logic Level | Wiring Strategy | Required Hardware |
|---|---|---|---|
| 5V (Arduino Uno/Mega) | 5V (e.g., ADXL345 5V variant) | Direct Dupont connection. Wire SCK-SCK, MOSI-MOSI, MISO-MISO. | None. |
| 3.3V (ESP32 / RPi) | 3.3V (e.g., BME280, W25Q128) | Direct Dupont connection. Ensure sensor VCC is fed 3.3V, not 5V. | None. |
| 5V (Arduino Uno) | 3.3V (e.g., nRF24L01+, modern SD cards) | Shift MCU MOSI/SCK/CS down to 3.3V. Shift Sensor MISO up to 5V. | Concrete Pick: Adafruit 4-Channel Bi-directional Logic Level Converter (Product ID: 757) using BSS138 MOSFETs. Avoid cheap resistor-divider modules for SPI; they ruin signal edges above 1MHz. |
| 3.3V (ESP32 / RPi) | 5V (Legacy industrial sensor) | Shift Sensor MISO down to 3.3V to protect the MCU. MCU outputs (3.3V) are usually enough to trigger 5V CMOS inputs, but verify datasheet V_IH. | Concrete Pick: Texas Instruments TXB0104 bidirectional translator breakout, or the same BSS138 module wired specifically for the MISO return line. |
By standardizing on the Adafruit BSS138 breakout (ID: 757) for all mixed-voltage SPI projects, you eliminate signal degradation issues inherent in resistor-based dividers, ensuring clean square waves up to 20MHz. Keep a half-dozen in your bench stock to avoid project stalls.
References: For official ESP32 GPIO routing constraints, consult the Espressif SPI Master API Documentation. For Raspberry Pi hardware SPI pinouts and device tree overlays, refer to the Raspberry Pi Pinout XYZ hardware matrix.






