Skip to content

Raspberry Pi Wiring

Lars edited this page Aug 23, 2020 · 2 revisions

Table of contents

Introduction

This guide covers the wiring of PWM (3-pin like WS2812) and SPI (4-pin like WS2801) LED strips to an Raspberry Pi or similar single board computer.
The guide is demonstrated using an Raspberry Pi 3B+, WS2812B strip and Apa102 strip. But any other Raspberry Pi or single board computer and any other addressable RGB LED strip can be used.

PWM strips - single data pin

LED strips that are controlled by PWM usually have only one data pin. But there are also viriants with a backup data line, like the WS2813 and WS2815 (comparison).
It is also important to note the supply voltage of the LEDs. There are quite a few LED strips that work with 5V, but also some that work with 12V (WS2815). So be sure to check the voltage the strip needs.

Wiring

A GPIO pinout diagram can be found here or on raspberrypi.org

The data pin connects to pin 12 (GPIO 18) on the Raspberry Pi. The +5V (or +12V) pin connects to the (+) of your power supply and the Grnd connects to the (-) of your power supply. Additionally, the Grnd should also be connected to a ground pin on the Raspberry Pi.

Raspberry Pi strip power supply
GND (Pin 6) Grnd (-)
Pin 12 (GPIO 18) Data
+5V/12V (+)

SPI strips - 2 data pins

LED strips which are controlled by SPI have a data and clock pin. The separate clock pin allows a higher data frequency and therefore smoother animations - even with over 300 LEDs. As mentioned above you also have to pay attention to the correct operating voltage (5V or 12V).

Wiring

A GPIO pinout diagram can be found here or on raspberrypi.org

The data pin (Si / DI) connects to pin 19 (GPIO 10) on the Raspberry Pi, and the clock pin (CK / CLK) to pin 23 (GPIO 11). The +5V (or +12V) pin connects to the (+) of your power supply and the Grnd connects to the (-) of your power supply. Additionally, the Grnd should also be connected to a ground pin on the Raspberry Pi.

Raspberry Pi strip power supply
GND (Pin 6) Grnd (-)
Pin 19 (GPIO 10) Data (SI/DI)
Pin 23 (GPIO 11) Clock (CK/CLK)
+5V/12V (+)

➥ Next guide: Power Supply