Quantcast
Viewing all articles
Browse latest Browse all 5299

Troubleshooting • Turning on LED Strip is Not Working - Raspberry Pi 5

Hello,

I am trying to turn on a addressable WS2812B RGB LED Strip with my Raspberry Pi 5 but it is not working and i think it is because the rpi_ws281x package is outdated for Raspberry Pi 5's but not sure.

I have used jumper cables from the LED strip like so:
Green cable from LED strip --> Pin 12 (GPIO 18)
White cable from LED strip --> Pin 6 (GND)
I am charging the LED strip externally with a 5V charger.

This is my simple program where i am only trying to turn the LED Strip red:

Code:

from rpi_ws281x import *# LED strip configuration:LED_COUNT = 30        # 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 brightestLED_INVERT = False    # True to invert the signal (when using NPN transistor level shift)# Create NeoPixel object with appropriate configuration.strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS)strip.begin()# Define function to set all pixels to a given colordef colorWipe(strip, color, wait_ms=50):    for i in range(strip.numPixels()):        strip.setPixelColor(i, color)        strip.show()        time.sleep(wait_ms/1000.0)# Main program logic:if __name__ == '__main__':    print('Turning on the LED strip...')    colorWipe(strip, Color(255, 0, 0))  # Red color
When i run the above code i get this error:
File "/usr/local/lib/python3.11/dist-packages/rpi_ws281x/rpi_ws281x.py", line 143, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -3 (Hardware revision is not supported)
Segmentation fault

I could really use some help fast as i have a deadline with developing this. The minimum requirements i need the LED strip to do is to turn green and red. Please tell me if more information is needed to resolve this issue. Thanks!

Statistics: Posted by miki2670 — Tue Mar 26, 2024 7:35 pm



Viewing all articles
Browse latest Browse all 5299

Trending Articles