# WS2812B RGB LED Strips Raspberry Pi Python Issues

**URL:** <https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458>\
**Category:** Raspberry Pi\
**Created:** [15 July 2024 21:23 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458 "2024-07-15T21:23:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuryaNarayan275152](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@SuryaNarayan275152](https://forum.core-electronics.com.au/u/SuryaNarayan275152)\
**Post date:** [15 July 2024 21:23 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/1 "2024-07-15T21:23:19Z")

</div>

Hi,  
I’m trying to simply turn on my LED strip as per this [tutorial](https://core-electronics.com.au/guides/raspberry-pi/fully-addressable-rgb-raspberry-pi/)

This is my basic code for it:

```auto
import time
import board
import neopixel

pixels1 = neopixel.NeoPixel(board.D18, 55, brightness=1)

pixels1.fill((0, 220, 0))

```

but I get an error saying:

```auto
  File "/home/pi/ledtest.py", line 8, in <module>
    pixels1 = neopixel.NeoPixel(board.D18, 55, brightness=1)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/neopixel.py", line 141, in __init__
    self.pin = digitalio.DigitalInOut(pin)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/digitalio.py", line 193, in __init__
    self.direction = Direction.INPUT
    ^^^^^^^^^^^^^^
  File "/home/pi/env/lib/python3.11/site-packages/digitalio.py", line 223, in direction
    self._pin.init(mode=Pin.IN)
  File "/home/pi/env/lib/python3.11/site-packages/adafruit_blinka/microcontroller/bcm283x/pin.py", line 40, in init
    GPIO.setup(self.id, GPIO.IN)
RuntimeError: Cannot determine SOC peripheral base address

```

I’m using Raspberry Pi 5, Bookworm OS Desktop. I wired everything as per the tutorial.

Please help

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [16 July 2024 00:03 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/2 "2024-07-16T00:03:59Z")

</div>

Probably the code will work with a Bullseye OS, Bookworm needs a virtual environment setup.  
I started to test this and it complained about `rpi_ws281x` being an externally managed environment.  
I will set that up and post here results, but a quick fix might be loading Bullseye OS.

Cheers  
Jim

PS or someone else might have a solution for you.

EDIT: As posted by someone else the --break-system-packages flag might allow it to work.  
ie. **sudo pip3 install rpi\_ws281x --break-system-packages**  
But didnt install the packages correctly when I tested it.

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [16 July 2024 06:17 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/3 "2024-07-16T06:17:48Z")

</div>

Suggest reading the page below. Note the two warning messages.  
The date on this web page is 15 Jul 2024.

_Sound must be disabled to use GPIO18. This can be done in /boot/config.txt by changing “dtparam=audio=on” to “dtparam=audio=off” and rebooting. Failing to do so can result in a segmentation fault._

_If you have the Pi 5, Neopixels are not currently working due to a change in the GPIO controls._

> **[NeoPixels on Raspberry Pi](https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage)**
>
> Learn how to install and use a Python library that lets you control NeoPixel/WS281x LEDs connected directly to a Raspberry Pi. No microcontroller needed!

The original Core electronics guide is a little old now me thinks.  
Regards  
Jim

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [16 July 2024 06:32 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/4 "2024-07-16T06:32:14Z")

</div>

> [@James46717](#):
>
> The original Core electronics guide is a little old now me thinks.

It certainly is! we’ll capture this improvement for the team to update. Thanks @James46717

---

<div class="post-metadata">

**Author:** ![SuryaNarayan275152](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@SuryaNarayan275152](https://forum.core-electronics.com.au/u/SuryaNarayan275152)\
**Post date:** [16 July 2024 16:06 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/5 "2024-07-16T16:06:17Z")

</div>

Alright, hopefully there is a fix for this because I am using the Raspberry Pi 5 running Bookworm, but I guess it won’t work for now. Thanks everyone!

---

<div class="post-metadata">

**Author:** ![lia262073](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@lia262073](https://forum.core-electronics.com.au/u/lia262073)\
**Post date:** [16 July 2024 18:31 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/6 "2024-07-16T18:31:44Z")

</div>

> [@SuryaNarayan275152](#):
>
> `RuntimeError: Cannot determine SOC peripheral base address`

The issue has been discussed here: [https://forums.raspberrypi.com/viewtopic.php?t=361218](https://forums.raspberrypi.com/viewtopic.php?t=361218) You can take a look.

---

<div class="post-metadata">

**Author:** ![SuryaNarayan275152](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@SuryaNarayan275152](https://forum.core-electronics.com.au/u/SuryaNarayan275152)\
**Post date:** [18 July 2024 18:12 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/7 "2024-07-18T18:12:47Z")

</div>

Yeah I know it’s because of the GPIO for RPi 5, but it’s the neopixel module which has to be updated. They are just talking about accessing GPIO on the high-level, but I need it to interface with the WS28112B

---

<div class="post-metadata">

**Author:** ![Jack](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/jack/32/9287_2.png) [@Jack](https://forum.core-electronics.com.au/u/Jack)\
**Post date:** [19 July 2024 02:18 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/8 "2024-07-19T02:18:55Z")

</div>

Adafruit has suggested using SPI ([Page 8 of this guide](https://cdn-learn.adafruit.com/downloads/pdf/neopixels-on-raspberry-pi.pdf)) to use Neopixels on the Pi 5. They have also put together [another guide to walk](https://learn.adafruit.com/circuitpython-neopixels-using-spi) you through it. Hopefully this can get your project back on the road.

---

<div class="post-metadata">

**Author:** ![SuryaNarayan275152](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@SuryaNarayan275152](https://forum.core-electronics.com.au/u/SuryaNarayan275152)\
**Post date:** [19 July 2024 14:28 UTC](https://forum.core-electronics.com.au/t/ws2812b-rgb-led-strips-raspberry-pi-python-issues/20458/9 "2024-07-19T14:28:48Z")

</div>

Yeah, I used SPI and it works! Thanks everyone
