Raspberry Pi Pico Tutorial : NeoPixels / WS2812B LED's
Vložit
- čas přidán 4. 09. 2024
- Welcome to the - Learn how to use the Raspberry Pi Pico Tutorial Series:
This video looks at the NeoPixels / WS2812B addressable LED's using the Raspberry Pi Pico.
In the first example we look at how to control the LED's individually and setting the color.
The second example we make a simple Larson Scanner / Knight Rider LED's.
We finish the video by looking at a prototype for an upcoming project on creating an Edge Lit acrylic clock also known as the cheap "nixie clock"
Check out my channel for other videos on the Raspberry Pi Pico, as I will regularly upload tutorials and projects related to the Raspberry Pi Pico.
If you found this tutorial helpful, subscribe to the channel and leave a comment and welcome to the NerdCave.
Code:
github.com/Gui...
Library:
github.com/bla...
Getting started video:
• Raspberry Pi Pico Tuto...
This was a fantastic video!
Thank you
Thanks very much for this. Fast and too the point. But not so fast a newbie like me cannot follow it. Much appreciated!
Glad it was helpful!
Great video!!!! Fun project for my Audi and will drive around until I get fined by the police and cry. Instructions and links were super helpful. Thanks for the coding. I’m learning Python on the fly and this is a fun way to do it.
Glad it was helpful!, you should share the video
2:24 you say verbally GP pin 21 but the diagram & code actually use GP pin 28
really enjoying your style of explaining things - very relaxing but at the same time you manage to impart plenty of information
Thank you for your feedback, noticed that when I uploaded was using GP21 and then changed to 28 later to keep wiring more neat.
@@NerdCaveYT not a problem , just wanted you to know that I actually pay attention to your videos !
@@Keeping_IT_Simple Thank you, I am happy to receive feedback, my comment section is real quiet.
Thanks for the video. I was able to light a strip of 90 LEDs with my pico. I did have one problem. I get green instead of red on example 2. I didn't look to see what caused the problem. I just made red = (0, 255, 0) and made the adjustment for other colors.
I checked the library I made a change got the same but didn't update the original library what you can do is change this line to strip = Neopixel(numpix, 0, 15, "GRB")
@@NerdCaveYT Thanks for the reply. I made the change. I also have increased the numbver of pixels I'm using on my project to 180 with one 5V input from the pico.
You say "upload it to the pi" does this mean 'RUN' or do I have to save the code to the Pico itself? When I hat RUN nothing lights up, I only get "MPY: soft reboot" in the console
So there might be a few things going on, since it is just showing soft reboot means the code is running, but like you said no output can you send a image to my discord of your circuit?
amazing vid, just wanted to know how to light up only one pixel.
will just change the code to one pixel, and thank you
Thank You!
No problem, I probably need to do an update on those videos for example how to initialize multiple strips etc.
@@NerdCaveYT I just adapted your tutorial to work with an old LED ring that I had lying around, pretty simple stuff once you understand. Thanks
@@NerdCaveYT would you have any idea of how to make the neo pixels work so that they change colour based on the temperature coming from the pi picos internal temperature sensor? I have tried but can’t get it to work
Let me have a look at it this weekend, the best way will probably be a function that based on temperature change the RGB value so that when it gets warm it changes as temperature rise gradually and not instantly, the simple method is just if statements changing the color for every degree@@Jai.zTechDomain
@@NerdCaveYT alright cool, thanks man
Great tutorials ❤❤
Glad you like them!
awesome video, damn im such a noob
nah it is quick to learn since so many awesome already write most libraries it just finding them and using them. I am planning to start a total beginner series for the pico
Is it possible to control the brightness of individual pixels separately ?
yes using the RGB value for example (0,0,0) is blank none where as (255,0,0) will be full RED but (128,0,0) would be half the brightness of RED
@@NerdCaveYT Thanks !
Hello, thank you for this, it runs perfectly and I was quickly able to modify the code for more uses.
Quick question, I used this neomatrix before on a raspberry pi 4 and it required a micro-controller which converted the gpio output to 5V, is this not required here? Clearly it is not required but it is safe to run it this way? I remember before that the adafruit documentation said that the DIN inputs need to be 5V, else it may damage the neomatrix.
The pico has a Vbus and Vsys which takes in 5V step it down to 3.3V. The Din pin connected to the pico is just where the data is sent to each pixel to control which one is on or off so it is an output not a input so the pin will not receive anything or be damaged and will be limited to sending out 3.3V dc
Changes to recent builds makes the modules RP2 and machine non existent. I keep getting errors. I can't find anything about how to get around this other than using DigitalIO which means a lot of rewriting code. :/
is this what the error message gives you in Thonny? It would be easier if you send me pictures in discord so I can see what is happening, and of the circuit. This might be a dumb question but on the LED pin are you using Vin I know some manufactures put the input cable at wrong end of strip
Hello nice video, for me it doesnt work becaue of the libraries, could you tell me how i can install the libraries like utime, pin, array...?
Are you running micropython on your pico and did you import all the libraries in the beginning.
hey NerdCave, I am getting this error and I was hoping maybe you can help me here :
Traceback (most recent call last):
File "", line 1, in
ImportError: can't import name Neopixel
and great video btw .
Hello did you upload this library to your pico? github.com/Guitarman9119/Raspberry-Pi-Pico-/tree/main/Neopixel the neopixel.py "from neopixel import Neopixel" is the library on your pico the same as the line of code here from "neopixel"
I get this after running the script a few times:
Traceback (most recent call last):
File "", line 11, in
File "neopixel.py", line 97, in __init__
OSError: [Errno 12] ENOMEM
Unplugging and then plugging back in seems to resolve the issue. Any idea what is going on here?
Not sure what will cause this, according to line 97 it is when it get initialized are the LEDs being power seperately or from the Pico
I am using the "SEZO WS2812B RGB 5050SMD 8x32" LED Matrix from amazon and cannot for the life of me even get one pixel to go to a colour other than white at full brightness. I have tried both this library you have suggested and also the adafruit library with CircuitPython. Both give the same result. By selecting num of pixels just turns that many fully white, with the occasional green pixel at the end. Cannot modify the brightness or anything. Any suggestions?
Figured it out, my GP28 pin was the issue, changed it to GP0 and it fixed everything.
I wonder why I know GP28 is the ADC2 but it should still be a GPIO pin with the added adc capability.
if your using your own power 5v do you only need to add the signal wire to the pi pico?
I powered the Pico from the 5V as well, but to answer your question just have to check if common ground is needed or not will get back to you on this one
Hi, just wondering how you're getting on with the led clock project, could not find any video on it.
Hello, so I have made one with the 8*32 RGB matrix. Just have not recorded it yet, but some good news is it will be up next week, getting back into CZcams making videos. I have taken a long break and ready to be back
@NerdCaveYT - this is my first time watching and I enjoyed this video. I was also interested in the led clock project. Did that ever get posted?
Hi I have had difficulty running the program I only change number pixel to 25 I get an error line 3 no name random or no name neopixel. ? Any help please anyone. What do I need to update or install. Thanks
Did you copy over the neopixel.py to your Pico, also are you running micropython and finally is the interpreter set to micropython, which is in the right corner of Thonny.
hey, using WS2812B with Pico, getting no errors on code but LEDs not working (29 LEDs without ext power supply) also using (pin40) power, (pin38) ground and (pin34) gp28, hoping you can point me in the right direction :) thanks
Hi, okay if you are getting no errors in code, then first suggestion will be to check the connections, that the GND is connected to any ground on the Pico, for the +5V can you connect it to VSYS(pin39) this will be the voltage after the regulator stage from you Pico. The Din pin just double check that it is Din and not Dout, lets try a different pin like Pin1 which should be GPIO0 so the line of code will be:
numpix = 29
strip = Neopixel(numpix, 0, 0, "RGB")
If that still does not work, you can reach me on discord then we can take a look at the circuit. discord.gg/xY77FWRb
@@NerdCaveYT thanks for the help today, it was the Din/Dout that was reversed, thanks again
when i did night rider from the example it was green to get red i had to set red 0 255 0
I simple fix in the code where it says RGB change it to GRB
@@NerdCaveYT but what's caused it? I cut and pasted the code from the links
@@peter7329 I think it is in the library, because I made some changes it could be that I uploaded the wrong code by accident
@@NerdCaveYT I see thanks I've found the section micropython fir pico book
Is there a limit to how many LED's you can run with the pico, could you run a 32x8 panel with a completely random ? I have just discovered the pico and how affordable they are with the shortage of the RP boards.
Technically, VBUS on the Pico (pin 40) is capable of supplying 0.5A (USB 2.0) or 1.0A (USB 3.0), thus if you try to supply 32x8 if you have current limit and low brightness it would be possible but will be pushing the limit, a cheap external 5V dc charger will work just fine if you are planning to make a display with the 32x8 panel. I am planning to use the 32x8 panel to write text to screen via in Bluetooth in future videos.
@@NerdCaveYT I would run power direct to the panel and only use the pick for the signal/program, so no issue with power, that sounds great then the pick should handle it well.
I want to have a 32x8 with just a random on off using maybe 20% on at any one time, not 100 percent on the 20% but I want to put it behind a server cabinet tinted glass door so it has a super computer random flash appearance, bit silly but would look pretty cool.
I have two servers so maybe one for each server so with the power on its running then it’s an instant very flash power indicator.
I also have a table top jukebox that was a cassette player radio that looks like the Werlitzer bubbler 1015 jukebox, I am putting a 5” screen in it and a pi 3b running fruitbox, so I might use a pico to run some lighting on that as well, normally it’s just lights constantly on, so adding animated light sequencers will top it off.
Thanks for your video and I look forward to more.
That sounds cool, yes the Pico is depending on where you buy it between 2-5 dollar and really so great for beginners since you can use MicroPython / CircuitPython. The arduino boards also recently got more expensive due to the silicon shortage. I have not played around with audio visualizers but using that with the jukebox the react with the music would be cool, please do share the projects when your are finished, would like to see it, and thank you for your feedback.
@@NerdCaveYT I wasn't going to have the lights activating from the sound but I did come up with a plan, the outside has an arched light from the base up and over to the other side, this is where i will run a smooth soft slow colour change or maybe a series of patterns but always smooth and slow, in the middle of the jukebox is a u shaped light and I would like to work out how to have a VU style light effect starting from the centre bottom of the U shape and going out each side and upward, that one going to the music might be cool. I think because the jukebox is small being a table top the pico will be perfect, I guess it might take two one for each lighting effect and my pi3b to run fruitbox and the 5" display.
I really do hope I can find your videos again when it is finished so I can share the end result, actually I will put a shortcut to this video in the jukebox folder, problem solved.
I have a terrible memory so I lose so much info.
This is a link to a picture of the model I have so you can picture the U shaped lights better
i.ebayimg.com/00/s/MTAyNFg1NzY=/z/PoYAAOSwhuxaynBz/$_86.JPG
Is it save to drive 25 neopixels without any external powersupply? I intend to use it as rgb perkey for keyboard
according to the datasheet, neopixels use 60mA (pure white, max brightness), it supposed to draw arround 1.5A total. I used 0.1uF decoupling cap for every neopixels.
Do I need some level shifter? Because as far as I know, Raspberry Pi Pico are not 5V tolerant and only use 3.3V logic
So in the video I used the 5V supply from the pico. The pico has a buck-booost converter so it can supply 5V but like you said limited current. If it is 25 leds which will not be full brightness I think it will be okay but it is probably better just to use an external supply to power the pico and LEDs on Vsys
Hi add code to thony pi pico and run it but got an error line 3. Random no name neopix?
Hello, have you uploaded the from Neopixel library:
Line 3: from neopixel import Neopixel
it is included in the github repository
can we do this with WS2812B 8 leds?
Hi which part are you referring to in the video? You can change the number of pixels to be 8 and use it as needed in your code. It will start from pixel 0 and last one will be 7. Each pixel "LED" is programmable.
@@NerdCaveYT We are doing a project using Pi Pico and HC-05 Bluetooth module. We also use app inverter. We are using the ws2812b-8 led, there are 8 of them, but we could not light it. If the Pi is a 3.3 volt led, could it be because it gives 5 volts? Do we need to use any converter? Can we do it without using a converter? The delivery date is tomorrow and we're still having this issue, we've taken care of everything else.
@@cerensoysal2927 The V+ of the LED strip is connected to the Vsys of the Pico which will give it the 5V power then the Din pin can be any GPIO pin on the Pico, did you double check that you connect to the LED strip to pin In Din and not Dout that is often a problem I see people have
How can i use it on Rpi 4 using c++ ?
There should be a library for it, but using the Rpi why not use python or is your program written in C++
@@NerdCaveYT
Yes my code is written in C++ :(