empowering creative people

WS2812 / NeoPixel Addressable LEDs: Raspberry Pi Quickstart Guide

This tutorial is aimed at getting some instant gratification from your WS2812 LEDs (also known as NeoPixels). We'll briefly cover a bare-bones setup for Raspberry Pi. This tutorial will work with ANY model Raspberry Pi, the Zero WH, 3B+ or 3A+ (as well as older models)!

If you've never used a Raspberry Pi before, we've got you covered with our free, online Raspberry Pi for Beginners Workshop. If you've covered at least Chapter 1 then you're ready to follow these instructions!

Parts Required for this Project

Connecting the LEDs

The Raspberry Pi uses 3.3V Logic, So we will need to use a Logic Level Converter to convert it to the 5V logic that WS2812/Neopixels require. 

You will need to use an external power source, as NeoPixels take a LOT of power. Each pixel will draw about 20mA on average, and 60mA at white - max brightness. 30 Pixels will draw 600mA on average, and up to 1.8A. Ensure your power supply is large enough to drive your strip!

Here's the wiring used in the video (click for hi-res):


The Code

First, install the Python support for WS2812B LEDs: 

curl -L http://coreelec.io/33 | bash

Navigate to the examples directory

cd rpi_ws281x/python/examples/

Execute the strandtest script (must use sudo)

sudo python strandtest.py

That should be all there is to it! Your LEDs should be running the same pattern you see in the video.

Troubleshooting: If your LEDs only flicker erratically instead of performing a nice demo we need to make some edits to /boot/config.txt, execute:

sudo nano /boot/config.txt

and either uncomment or add the following lines:


save, reboot, and reattempt to run strandtest.py as above.

As always, if you have any troubles then reach out to us in the comments section below. We're full-time makers and we're here to help!


The one-line install command is just a simple script that automates the commands listed in Adafruit's NeoPixel tutorial. Follow the link if you want to see what's happening behind the scenes. To see the contents of the script before you run it, save it to a file with:

curl -L http://coreelec.io/33 >> ws2812-installer 

Adafruit Neopixel Uberguide

Jeremy Garff's Github Repository - Issue #103

Going Further

Are you looking to add WS2812/NeoPixel LEDs to your other project but you aren't using a Raspberry Pi? Check out our other guides to get you started on other hardware types:

Need to take one step back and figure out what these fandangled NeoPixels even are? Check out our What Are NeoPixel LEDs Guide!

This tutorial is aimed at getting some instant gratification from your WS2812 LEDs (also known as NeoPixels). We'll briefly c...

Have a question? Ask the Author of this guide today!