How to control a WS2812 LED Strip with a Raspberry Pi in Python

preview_player
Показать описание
***** READ DESCRIPTION BEFORE WATCHING VIDEO *****

The code should still be the same as in this video.

Materials used in this video:

The wiring goes as follows:
5V pin on the Pi goes with the 5V pad on the LED strip
Gnd pin on the Pi goes with the GND pad on the LED strip
GPIO pin 18 goes with the DI pad on the LED strip

How to support the channel:

Social media links:

0:00 Wiring setup
0:38 Writing a Python script
6:50 Running the Python script

#raspberrypi #ledstrip
Рекомендации по теме
Комментарии
Автор

READ COMMENT BEFORE WATCHING VIDEO


The code should still be the same as in this video.

Flopperam
Автор

I've waited so long to figure this out. You are a saint good sir.

ikornn
Автор

Hard to heard hear so soft in the audio of your video, what's the package to install and were is it found? Thank you

nsvaluto
Автор

Hi could I please get some help. I’ve followed all the steps you have shown but I’m getting the wrong colours. There’s three distinctive problems. Firstly if I set rgb value to 255, 255, 255 - should give me white but it actually gives me blue. And when I run the whole loop of the stripes, it only displays like 8-9 LEDS when in fact I have looped for the whole 120 LEDS. And also the colours for each LED is different even though I followed exactly the same as ur code

Would this just be wiring issue? Pretty sure I’ve followed everything you displayed. Any direction would be very appreciated

Thank you

jamespark
Автор

this is probably a silly question, but I'm a complete novice at this. So can this all be ran through a raspberry pi pico instead?

malcbear
Автор

Yo I have a question. If I connect more than one strip should I daisy chain them together or can I use more than one pin and then setup the respected pins in the code.

camsmart
Автор

I keep getting "ModuleNotFoundError: No module named '_rpi_ws281x'". Any tips on how to fix this?

Th_RealDirtyDan
Автор

Hello @Flopperam, I have a problem, I'm using Raspberry PI3 and the code works only if I run it by the terminal with the command SUDO Python3 .... but if I try to run it from other code Editor it does not work...
RuntimeError: ws2822_init failed with code -5 (mmap() Failed).
I'm using "headmelted" as my Editor. Do you know how can I fix it?

olgaliciarubio
Автор

Hi I have a 5 pin led strip, where instead of the din pad on the led, it has 3 separate rgb pads. Would this still work if I sauder those rgb pads together and then connect them all into the 1 pin on the raspberry pi, just like the din cable?

bhunt
Автор

My led strip is rated 5 volts, 30 leds per meter, and 9 watts per meter, what external power supply should I get? I’m new to this sort of stuff.

chellochamber
Автор

Did you have to enable any interfaces? I assume yes.

andrewm
Автор

Is there any code on how to address each LED individually? say the first 5 one color, the next 5 another color?

clintla
Автор

If the led strip is 5 volts, is it still unsafe to use the 5V pin?

unknown-hinb
Автор

is there a way to use a 3B+ to wirelessly control the multiple lights though wifi

theonecommenter
Автор

Its saying 'can't open /dev/mem:Permission denied' when I try to run it in python. Also all of the leds aren't coming on or changing colour and only one led is on. I have tried changing the light strip but still no luck I am sure the wiring is all correct and running code in the terminal is correct. Pls help

ismaelmalik
Автор

Hey dude, I followed the video, but regardless of what I change the RGB values to, all of my LEDs just go bright white. Any idea on where i'm going wrong? My code is exactly the same as yours.

Jad_zor
Автор

Im getting error messages that say
Can't open /dev/mem: Permission denied
Traceback (most recent call last):
File "/home/pi/Desktop/Led Strip Control.py", line 14, in <module>
strip.begin()
File "/usr/local/lib/python3.7/dist-packages/rpi_ws281x/rpi_ws281x.py", line 131, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -5 (mmap() failed)
What am I doing wrong?

chellochamber
Автор

Hi i copied your code and changed led to 60. When i run the code they light up red white blue red white blue all the way through. I then amended your code and changed the brightness to 0 to turn off the leds the first 45 turn off and the last fifteen stay lit up. Does anyone know whats going on? thank you

trailsanddales
Автор

so how can you know what channel to use?

BiDude
Автор

Hi,
When I run script it show me error
That's script.show()
Is not a valid Syntex

Dzh
welcome to shbcf.ru