WS2812 Addressable LEDs: Raspberry Pi Quickstart Guide

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