1

Background

I'm trying to control a single WS2812b LED strip from a Raspberry Pi. I've followed this tutorial from raspberrypi.com (with the exception of Prep & Installation step 4, because I couldn't find snd-blacklist.conf).

That didn't work, so I also tried this tutorial (which involved adding a Logic Level converter), and when that didn't improve things, a few other tutorials/videos, all to no avail.

Code & Output

The first tutorial got the closest. It had me use this github library, where I eventually ran strandtest.py. It appeared to partially work, but not entirely. I wasn't sure (and I'm still not) if this is a hardware or software issue, so I reduced the code to the minimum possible where it still turns on at least one LED.

import time
from rpi_ws281x import *

LED_COUNT = 14 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!). LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) LED_DMA = 10 # DMA channel to use for generating signal (try 10) LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest LED_INVERT = False # True to invert the signal (when using NPN transistor level shift) LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53

strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) strip.begin()

while True: print ('Running display') for j in range(100): for i in range(strip.numPixels()): strip.setPixelColor(i, Color(50, 50, 50)) strip.show() time.sleep(.05)

Yes, those nested loops are necessary. Simplifying to something like this without loops doesn't turn on any LEDs at all:

strip.setPixelColor(0, Color(100, 100, 100))
strip.show()
time.sleep(10)

Demo Video

When I run that code (the first block), this is what happens: https://youtu.be/nzMCeyBNY50

Every time I run the code, I wait a few seconds, and eventually some LEDs turn on. It's different every time: sometimes a couple turn on, sometimes all of them, sometimes they turn off again for a little bit as it keeps running, etc. This was true even before I switched to using the Logic Level converter from the second tutorial, and happens the same way even if I run the original strandtest.py.

Parts

I've followed this schematic from the second tutorial linked above. Note that I'm powering 14 LEDs currently (but would like to do the full strip in the future). Also, this schematic shows the power for the LEDs running through the breadboard, but I've soldered the red power+ directly instead.

schematic from core-electronics.com

Here's a list of the parts I used:

kviLL
  • 131
  • 3

2 Answers2

1

Welcome! I am sorry to say you are light on the 50 watt (5 * 10 = 50) power supply, here is why: (Ohm's law states volts * amps = watts). Your Pi needs about 3 amps or 15 watts. You now have 7 amps or 35 Watts remaining. Next you have 5 meters of leds at 18 watts per meter (per your link) so that is (18 * 5) 75 watts. You had 35 watts left after the Pi so you are at a negative 40 watts or -8 amps. Best solution get another power supply and if you use both be sure to connect the grounds of each together and to the Pi ground.

Gil
  • 1,288
  • 6
  • 5
1

I had exactly this same problem.

If /etc/modprobe.d/snd-blacklist.conf does not exist, you need to create it and add the following line

blacklist snd_bcm2835

You may also need to add/uncomment the following from /boot/config.txt

hdmi_force_hotplug=1
hdmi_force_edid_audio=1

Don't forget to reboot and all should work nicely.

AGB
  • 11
  • 1