Core Electronics Forum

WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide

Michael just shared a new tutorial: "WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide"



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

1 Like

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.

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?

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

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.

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

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

thank you
I will try…

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

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.

Hi Pascal,

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

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…

1 Like

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

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

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).

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

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?

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

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!

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