# WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide

**URL:** <https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531>\
**Category:** Guides\
**Created:** [5 September 2017 05:06 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531 "2017-09-05T05:06:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_R](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael_r/32/435_2.png) [@Michael\_R](https://forum.core-electronics.com.au/u/Michael_R)\
**Post date:** [5 September 2017 05:06 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/1 "2017-09-05T05:06:51Z")

</div>

Michael just shared a new tutorial: [**"WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide"**](http://core-electronics.com.au/tutorials/ws2812-addressable-leds-raspberry-pi-quickstart-guide.html)  
  
 ![](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/1X/4b9bb991c5cddfaf92298811e2981013126176b6.png)  
  
This tutorial is aimed at getting some instant gratification from your WS2812B LEDs (trade name: neopixels). I’ll briefly cover a bare-bones setup for Raspberry Pi.  
If you’ve never used a Raspberry Pi before, we’ve got you covered with our free, onl…  
  
[**Read more**](http://core-electronics.com.au/tutorials/ws2812-addressable-leds-raspberry-pi-quickstart-guide.html)

---

<div class="post-metadata">

**Author:** ![paul3283](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@paul3283](https://forum.core-electronics.com.au/u/paul3283)\
**Post date:** [19 January 2018 02:22 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/2 "2018-01-19T02:22:29Z")

</div>

Hey  
Thanks for the tutorial

Why is it that I cannot run the example - Strantest (or any other file from that folder) from the python3 idle shell. I can only run it from the command line.

---

<div class="post-metadata">

**Author:** ![Sam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/sam/32/99_2.png) [@Sam](https://forum.core-electronics.com.au/u/Sam)\
**Post date:** [19 January 2018 02:50 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/3 "2018-01-19T02:50:25Z")

</div>

Hi Paul,

When you say that you can’t run it, could you give me some more info as to what’s going on? Do you receive an error? Do the lights just not work?

---

<div class="post-metadata">

**Author:** ![paul3283](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@paul3283](https://forum.core-electronics.com.au/u/paul3283)\
**Post date:** [19 January 2018 02:58 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/4 "2018-01-19T02:58:48Z")

</div>

hey

so if it is opened in P3 IDLE the error is - inconsistent indentation.

in the command line if I run python3 stra… is comes up with this error as well, if I run python2 stra… it runs.  
However if I open it up in P2 IDEL and run it, the indentation error returns.  
fun

---

<div class="post-metadata">

**Author:** ![Sam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/sam/32/99_2.png) [@Sam](https://forum.core-electronics.com.au/u/Sam)\
**Post date:** [19 January 2018 03:01 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/5 "2018-01-19T03:01:29Z")

</div>

Yep, so that is most likely because the indentation requirements are different for the IDLE vs. the command line. There isn’t really any need to run Python scripts from the IDLE as it’s more of a development tool. But if you do want to, then you’ll need to redo the indentaiton and ensure that it’s correct.

---

<div class="post-metadata">

**Author:** ![paul3283](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@paul3283](https://forum.core-electronics.com.au/u/paul3283)\
**Post date:** [19 January 2018 03:03 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/6 "2018-01-19T03:03:27Z")

</div>

yeah.  
I want to use is as part of another project, and am trying to clear up the code in the IDLE, but right now to no success.  
I thought it may be a P2 P3 incapability thing

---

<div class="post-metadata">

**Author:** ![Sam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/sam/32/99_2.png) [@Sam](https://forum.core-electronics.com.au/u/Sam)\
**Post date:** [19 January 2018 03:03 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/7 "2018-01-19T03:03:54Z")

</div>

It could also be that. I’d recommend just editing it using the nano text editor through the command line

---

<div class="post-metadata">

**Author:** ![paul3283](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@paul3283](https://forum.core-electronics.com.au/u/paul3283)\
**Post date:** [19 January 2018 03:06 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/8 "2018-01-19T03:06:25Z")

</div>

thank you  
I will try…

---

<div class="post-metadata">

**Author:** ![Sam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/sam/32/99_2.png) [@Sam](https://forum.core-electronics.com.au/u/Sam)\
**Post date:** [19 January 2018 03:06 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/9 "2018-01-19T03:06:55Z")

</div>

Not a problem Paul, be sure to let me know if you get stuck with anything else.

---

<div class="post-metadata">

**Author:** ![pascalbianca56734](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@pascalbianca56734](https://forum.core-electronics.com.au/u/pascalbianca56734)\
**Post date:** [4 February 2018 09:54 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/10 "2018-02-04T09:54:05Z")

</div>

Hello ,  
Its a super tutorial for neopixel leds to work on the rpi.  
But in your tutorial say if the neo pixel leds don’t nicely work you, must enable the sound for hdmi that means you disable it for your audio jack  
But if you search the internet you find that all pwm pins (also the one you use) are linked to the jack for sound.  
So if use a WS2812 on pwm pin and you don’t disable it in your way to the hdmi or for the jack you got a hell sound and strange behave of your leds.

It is a pity that you cannot use and the sound by jack and pwm for neo together.

---

<div class="post-metadata">

**Author:** ![Sam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/sam/32/99_2.png) [@Sam](https://forum.core-electronics.com.au/u/Sam)\
**Post date:** [5 February 2018 00:38 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/11 "2018-02-05T00:38:15Z")

</div>

Hi Pascal,

Indeed, but unfortunately, that’s the nature of microprocessors where pins and peripherals and being shared accross the board.

---

<div class="post-metadata">

**Author:** ![Tim64156](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@Tim64156](https://forum.core-electronics.com.au/u/Tim64156)\
**Post date:** [2 June 2018 21:32 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/12 "2018-06-02T21:32:02Z")

</div>

Thanks so much for the tutorial. It worked perfectly.

I’m a noob. For those who may be having the same issues I had; I couldn’t get this (and other install/build methods) to work until I started again with a fresh pristine install of raspbian stretch. I was getting bad zip file errors during installation perhaps it was because I was using jessie with tweaks for other specific applications. I learnt heaps in the process though!

WS2812 is a game changer…

---

<div class="post-metadata">

**Author:** ![Aidan](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/aidan/32/1243_2.png) [@Aidan](https://forum.core-electronics.com.au/u/Aidan)\
**Post date:** [4 June 2018 04:30 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/13 "2018-06-04T04:30:09Z")

</div>

Great to hear Tim. All the best with your project!

---

<div class="post-metadata">

**Author:** ![otto64398](https://avatars.discourse-cdn.com/v4/letter/o/ec9cab/32.png) [@otto64398](https://forum.core-electronics.com.au/u/otto64398)\
**Post date:** [6 June 2018 15:14 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/14 "2018-06-06T15:14:51Z")

</div>

Hey,  
thanks for the tutorial. I have a 12V adressable LED strip at home. The strip has 2 GND, 1 BI and 1 12V inputs, how do i have to change the setup that is shown in the picture.  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![Graham](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/graham/32/54_2.png) [@Graham](https://forum.core-electronics.com.au/u/Graham)\
**Post date:** [7 June 2018 02:20 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/15 "2018-06-07T02:20:53Z")

</div>

Hi Otto,

This tutorial provides a quick start guide which can be built upon. If you are building upon (going outside what’s discussed), then go ahead and start a new topic (don’t use this topic).

---

<div class="post-metadata">

**Author:** ![Sarath73487](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sarath73487](https://forum.core-electronics.com.au/u/Sarath73487)\
**Post date:** [4 November 2018 22:25 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/16 "2018-11-04T22:25:11Z")

</div>

Hi All,  
I am trying to hook my Pi 3 B+ with the LED strip (NeoPixel 5m 150 leds/m).  
I did everything that was mentioned (hooked up the circuit with a logic converter and powered it up with 5v 9Amp supply).  
But when I run the strandtest.py I see only first 6-7 leds loght up (and that too erratically). I added the lines to route audio via HDMI in /boot/config.txt and that didn’t help too.

Any help is greatly appreciated.

Thanks,  
Sarath.D

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/stephen/32/1599_2.png) [@Stephen](https://forum.core-electronics.com.au/u/Stephen)\
**Post date:** [7 November 2018 05:43 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/17 "2018-11-07T05:43:45Z")

</div>

Hi Sarath,

It sounds like you have a bad power or ground. Can you include a photo of your wiring and a wiring diagram/schematic to show me how you wired it up?

---

<div class="post-metadata">

**Author:** ![Mohamed74451](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Mohamed74451](https://forum.core-electronics.com.au/u/Mohamed74451)\
**Post date:** [20 November 2018 06:31 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/18 "2018-11-20T06:31:29Z")

</div>

Hi, do I need a level shifter to use this with raspberry pi or can I connect it directly?

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/stephen/32/1599_2.png) [@Stephen](https://forum.core-electronics.com.au/u/Stephen)\
**Post date:** [20 November 2018 21:47 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/19 "2018-11-20T21:47:58Z")

</div>

Hi Mohamed,

Sometimes NeoPixels will run just fine with 3V data. You may be alright without one, but its always a good idea to have one on hand just in case.

Good luck with your project!

---

<div class="post-metadata">

**Author:** ![Mohamed74451](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Mohamed74451](https://forum.core-electronics.com.au/u/Mohamed74451)\
**Post date:** [20 November 2018 23:15 UTC](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531/20 "2018-11-20T23:15:33Z")

</div>

Thank you and also my pixels aren’t seeming to work for some reason I had them cut into different length strips and like the strip I’m using only two pixels light up

[Next page](https://forum.core-electronics.com.au/t/ws2812-addressable-leds-raspberry-pi-quickstart-guide/1531.md?page=2)
