WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide

Hi Brent,

The Pi is powered separately in these tutorials, and the diagram is electrically the same in the video and the tutorial. A common ground is required always. 3.3v is being supplied BY the Raspberry Pi, not the other way around.

The diagram was changed in the written tutorial to give an example of how to wire both the strip and the level converter on the board. You could always connect two wires to each terminal in the power connector itself though!

Hi Stephen. Thank you so much.

Hi Stephen, I am currently working on a project that will have the LED strip react to the temperature of the weather throughout the day, would you be able to give me some pointers to help me start in editing the files I need to, thanks

Hi Zach,

Once you have the Lights working you should be able to adjust the brightness by scaling the light by the temperature. You could get the temperature in one of two ways you could add a sensor or you could grab the forecast information from the internet.

How would I go about adjusting the colour of each individual LED?

Hi Zach,

Start out by taking a look at the example code included in this tutorial. It includes parts that will control each LED individually.

Hi, I have been attempting to follow this guide, but whenever I try to install the Python support packages I get the following error: ?curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it…" Can you help me figure this out? I am very new to the Raspberry Pi, so non-technical explanations of what is happening will be appreciated! Thanks in advance -BM

Hmm. That’s not normal.

First, make sure you are using Raspbian Stretch or Buster.

Then, check the date/time/timezone are correct on your RPi.

If still not working, update the RPi.

sudo apt-get update
sudo apt-get dist-upgrade

It might also be worth doing this:

sudo apt-get purge ca-certificates
sudo apt-get install ca-certificates

And if none of the above work, then it would simply be easier to download the latest verion of Raspbian and write to your uSD card using Etcher.

Sounds like the security certificate for the remote domain has expired, so curl is refusing to use https to retrieve the file. Try using plain http, not https.

1 Like

The guide does show the http method, though Cloudflare (which is used in front of coreelec.io) will upgrade all requests to https nowadays. I did a quick test with http and https and it worked fine (RPI 4 w/ Raspbian Buster).

Gave it a quick whirl in windows as well, without the pipe into bash (curl wored fine with both http and https, no ssl errors/warnings)

Hi!

Thank you for your email. Your suggestion about the time did the trick! Unfortunately, I have an additional problem: the LEDs don’t activate when we run the program. I’ve attached some images of our setup and the Terminal output if you are able to take a look.
I am somewhat concerned that the pins may have been damaged, because initially my friend and I attached the logic converter

1 Like

Hi. I am currently trying to get this to work with a Raspberry Pi 2b, but only the first few leds light up white and don’t change. Any help would be much appreaciated.

Hi, Wondering if i can just hook the Pi up to 5V power instead of 3.3V (as im having trouble with the logic level converter and solder connections). If i HAVE to use the converter - are there any pre soldered ones to buy? etc.
Thanks

The Pi is powered by 5V already, though no amount of tinkering will make the digital IO anything other than 3.3V logic on the chip itself.

Not likely, as most people prefer the choice to solder the pins (or not),

Hey all! I ran the curl script, with no errors. When I try to do the strandtest I get this error:

pi@neopixel:~/rpi_ws281x/python/examples $ sudo python3 strandtest.py
Traceback (most recent call last):
  File "strandtest.py", line 89, in <module>
    strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
NameError: name 'Adafruit_NeoPixel' is not defined

Any ideas?

EDIT: I’m an idiot, and realized that this one isn’t python3… I ran it without the 3 and it was fine.

Hi everyone, do you think it would be possible to use a standard usb charger to power the leds? I think it should be but for long strips the current (usually less than 2A) may not be enough.

image

Voltage decay would also be a problem over long strips so I was thinking, what if I use multiple ports of the same usb charger (each port rated for 2A) to power, let’s say, each port 1 meter of leds. Would it work? How would the wiring be?

The tutorial helped me getting started and so far my 8-bit NeoPixel (WS2812B) circle is running fine over PWM/GPIO18.

However I’m running into issues when trying to run these over SPI. The LED’s do light up, start running the strandtest sequence, but the 4th LED stays mostly green and the rest is mostly white and flickering. I’m suspecting there is something wrong the SPI timing or the Operationg System configuration.

Did anyone have a similar issue, or idea’s how to sort this out?

Steps of troubleshooting

  1. Switch wire from GPIO18 (PWM) to GPIO10 (SPI/MOSI), to switch from PWM to SPI operation.
  2. Edit LED_PIN from 18 to 10 in strandtest.py
  3. Enable SPI in Raspbian (Raspbian Buster with desktop)
  4. Set core_freq=250 and core_freq_min=250 as the SPI rate is derrived from the Raspberry Pi’s core frequency, which can fluctuate.
  5. Verified SPI enabled: devices are available in /etc/devices
  6. Verified SPI working: https://github.com/rm-hull/spidev-test and input is same as output, so OK.
  7. Using an Raspberry Pi 3B+, same results with a Raspberry Pi 2B. Did not test with Pi 4B 4GB yet.
  8. Event tried running the pixels using .NET Core to rule out issues related to python and it’s library (can set collor once, can’t update after that and LED’s turn white).

Wireinig and schematic


Video
PWM: Working as intended

SPI: Fliickering is hard to see on video, see 00:39+ to see the bottom LED light green.:

1 Like

Hey Michele,

Yes that seems like it would be appropriate. I’d first check that the USB charger is actually designed to power three devices all near the maximum capacity simultaneously and constantly. If that is the case be sure to isolate each section of LED strip so that the current is isolated to three separated sections. All the best with your projects!

Bryce
Core Electronics | Customer Support

Hey Tim,

It sounds like the issue is definitely related to the SPI communication between the Pi and the board, if you’ve got any other projects dependent on SPI I’d recommend using the same Pi with the same OS and settings on the same pins and see whether similar issues occur. If they do then we’ll have to devise a system to detect and repair the SPI issues. If issues do not occur with the SPI then the grendals are probably hidden somewhere else. All the best with your project and Merry Christmas!

Bryce
Core Electronics | Support

Hi, I have wired everything up as shown. However, as soon as I connect the power supply with the Pi still in turned off state, the control lights on the Pi turn on and I cannot start the device!
I’ve tested it only once since I don’t want to destroy anything, but is it supposed to be like this? What I did was boot up Raspbian and then plug in the power supply. running strandtest.py worked, but the device not turning on with the LED Power supply connected had me worried