Тёмный

How to Use WS2812B RGB LEDs with Raspberry Pi Pico (using MicroPython) 

Core Electronics
Подписаться 119 тыс.
Просмотров 60 тыс.
50% 1

In this tutorial, we'll get some WS2812B LEDs (also known as GlowBits™ and NeoPixels) working with a Raspberry Pi Pico. If you haven't already set up Thonny for programming your Pico, follow our guide on that first here core-electronics.com.au/tutor...
Here is the full guide for this video core-electronics.com.au/tutor...
To follow along you'll need:
• A Raspberry Pi Pico
• WS2812B LEDs (we recommend GlowBit™ rainbow because the version 5 LEDs work reliably with the Pico's 3.3V logic level).
• A way to connect your Pico to your LEDs. I'm using some test clips
If you have any questions about this content or want to share a project you're working on head over to our maker forum coreelec.io/forum
Core Electronics is located in the heart of Newcastle, Australia. We're powered by makers, for makers. Drop by if you are looking for:
• Raspberry Pi Pico core-electronics.com.au/catal...
• GlowBit™ rainbow core-electronics.com.au/catal...
• WS2818 RG LED Strip core-electronics.com.au/compo...

Опубликовано:

 

5 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 111   
@pskouson
@pskouson Месяц назад
Thank you! Three years later and this still works!
@Core-Electronics
@Core-Electronics Месяц назад
Glad we could help!
@BABALOOEY46
@BABALOOEY46 3 года назад
Good, always enjoy watching your short tutorials on a mini break... 👍🏻
@MichaelRuppe
@MichaelRuppe 3 года назад
Thanks Steve 😃
@larrystone654
@larrystone654 3 года назад
Exactly what I needed to get started. Thank you!
@Core-Electronics
@Core-Electronics 3 года назад
You're welcome, happy to help.
@juliofmendes
@juliofmendes 2 года назад
Tanks! Great job with simple steps
@buildfrom
@buildfrom 3 года назад
Well authored tutorial.
@Core-Electronics
@Core-Electronics 3 года назад
Thanks :)
@victorldunn9638
@victorldunn9638 3 года назад
Thank you - Another clearly presented tutorial, that stays on-topic :-)
@victorldunn9638
@victorldunn9638 3 года назад
... It would be interesting to see an in-depth tutorial using the Pimoroni pico-unicorn 7x16 RGB display
@patrickmattele2013
@patrickmattele2013 2 года назад
Great video works good thkx a lot
@ParsMaker
@ParsMaker 3 года назад
nice work
@AndersJackson
@AndersJackson 3 года назад
A bit short, but on the spot and and on target. Like you way of connecting the Pi nano. I will use that for prototyping, thanks.
@davewalmsley8883
@davewalmsley8883 3 года назад
Just to say I made it, thanks!
@shortymcsteve
@shortymcsteve 3 года назад
I really want to purchase a glowbit rainbow but shipping to the UK just for one just doesn’t make sense. Do you guys have a partnership with other companies in Europe where I can purchase one? Seems like an amazing little board to play with.
@warandv6614
@warandv6614 3 года назад
is there a way to change colors using a potentiometer or touchscreen display ?
@trandon3991
@trandon3991 2 года назад
Thank you
@StitchesLovesRats
@StitchesLovesRats 4 месяца назад
can you have button input to cycle between a few diff programmed settings so you could just hit a button and get white to see or colour patterns for aesthetics? I want to just be able to power on and cycle and not have to srat up my pi. wanna encase my pi in a lightbox
@toddknudsen9192
@toddknudsen9192 3 года назад
Thanks for the tutorial! How can I order a couple GlowBit Rainbows but I live in the US. How can you ship to me? I sent a support email and received no response. Can you help me?
@dans-designs
@dans-designs 2 года назад
Thanks for the great video, I have a RP2040-Zero from Waveshare that has a built-in WS2812 RGB LED on GP16 but I cannot for the life of me get it working! (using micropython) Any help would be greatly appreciated!
@KristienHarris
@KristienHarris Год назад
Thanks! Loved this but where’d you get them handy clips for through hole croc biting?
@Core-Electronics
@Core-Electronics Год назад
Right here: core-electronics.com.au/hook-test-clip-10-pack.html
@electronic7979
@electronic7979 3 года назад
Nice
@alheeley
@alheeley 3 года назад
Nice video. Are there any other tutorials to show code for sweeping through colours, hue and brightness using analog inputs, for example?
@DanMcCreary
@DanMcCreary Год назад
There are about 20 tutorials here: dmccreary.github.io/moving-rainbow/lessons/ Let me know if you need more.
@daveflatters4981
@daveflatters4981 3 года назад
Are these Glowbit Rainbows available in the UK ?
@TheBinarydeity
@TheBinarydeity 3 года назад
is there a five volt version?
@richardmore2032
@richardmore2032 3 года назад
Nice video. Would like to see a video with the Pico only supplying the WS2812B data line and an external power supply to power the leds.
@davewalmsley8883
@davewalmsley8883 3 года назад
Richard, basically you just plug the red lead of the WS2812 into your external power supply (3V) and add another black lead from 0V of the WS2812 to the 0V of your supply
@KaradevNetLtd
@KaradevNetLtd 2 года назад
nice work, but can you give a some working code in C/C++ for using with or without arduino ide for RPI PICO ??? i have no understand how to translate this from python to c and set pio and ws2812b. some help about it ???
@TECHNDJ
@TECHNDJ 3 года назад
Rpi foundation sent me one, but that got stuck at customs and delayed AF.. Can't wait to get my hands on it😍
@TECHNDJ
@TECHNDJ 3 года назад
@@yangallison505 i will contact u for sure sir.. Thx
@vaughnmonkey
@vaughnmonkey Год назад
Are these significantly different than the WS2811?
@rodrigoramirez9559
@rodrigoramirez9559 2 года назад
My ws2812b LED strip is only showing red color and very low brightness. I'm using 15 LEDs only. Any help?
@crckdns
@crckdns 3 года назад
Cool, thanks for showing how simple it is with python! Can you do the same in C?
@Core-Electronics
@Core-Electronics 3 года назад
Thanks! We'll likely stick with MicroPython for a long while - that's where our heart is
@alrichmond4341
@alrichmond4341 3 года назад
I have 2x96 month-old believed-humanoids that I need to get into programming, and this is a great place to start. Thanks.
@jackyli6716
@jackyli6716 3 года назад
why dose not run when i copy the main.py to /pyboard/ location via rshell tool, and i can see the main.py file in the location /pyboard and it is just blink example? Could you please show me how to put my python code file into pico and run it ?
@initialb123
@initialb123 3 года назад
Hey man - thanks for taking the time and effort to upload these videos, i can follow what your doing clearly. In all your videos, the start of your code often reads import something, something . OR from machine import Pin , for example... where can i find a list of all the libs that i could import , should i want to?
@tannewt
@tannewt 3 года назад
In the REPL you can do `help("modules")` to see the full list of native modules. The documentation is here: docs.micropython.org/en/latest/
@Core-Electronics
@Core-Electronics 3 года назад
Scott always has the best MicroPython advice =)
@initialb123
@initialb123 3 года назад
@@tannewt most awesome , thanks :)
@initialb123
@initialb123 3 года назад
​@@Core-Electronics So here's where i'm just up against it... I've written out some simple code to get a rounded/average sensor reading. but the output just says line 3, in import machine.Pin ModuleNotFoundError: No module named 'machine' >>> help("modules") After checking with the help("modules") in the serial/ REPL box, it does not list any module called "machine" ( This is in RU Editor) Here's my terrible code if you fancy a look pastebin.com/V1XVVE7w Tried again in Tonny different error, but also super related. Traceback (most recent call last): File "onewire.py", line 23, in reset OneWireError: >>> I'm just having no luck in using some basic libraries , is there a better IDE i can use ? I'm spending more time look at include library bugs that just writing out bad code ! Any feedback would be great .
@davewalmsley8883
@davewalmsley8883 3 года назад
@@initialb123 I think you have a typing error. The line should be 'from machine import Pin', which means from the module 'machine' import only the function 'Pin'
@nobbeperez9517
@nobbeperez9517 3 года назад
Hi, I copied the code and i'm getting: >>> %Run -c $EDITOR_CONTENT Traceback (most recent call last): File "", line 1, in ImportError: no module named 'array' What's wrong? :'(
@pratiklondhe5167
@pratiklondhe5167 3 года назад
Where I can buy those cute clips you used to connect led to pico, ?
@Core-Electronics
@Core-Electronics 3 года назад
Test Hook Leads are essential! There's a link to the full guide in the description with more info :)
@pratiklondhe5167
@pratiklondhe5167 3 года назад
@@Core-Electronics thanks
@jamesharris5012
@jamesharris5012 Год назад
I've got you code working well how can I make it run in a repeat in continues loop. Thanks anyone
@teokarlsson305
@teokarlsson305 3 года назад
Nice video! What are those leads called?
@dung3onmaster296
@dung3onmaster296 3 года назад
alligator clips?
@MojoMagicau
@MojoMagicau 2 года назад
I'm late to the party. They're called "hook test clip".
@FabZone4u
@FabZone4u 4 месяца назад
Nice tutorial, I'm originally from Australia too ; ) How can I make the rainbow pattern loop infinitely ?
@Core-Electronics
@Core-Electronics 4 месяца назад
If you place the [ rainbow_cycle(0) ] function inside a while True: loop it will cycle indefinitely
@rathv964
@rathv964 3 года назад
Can you do xinput game controller next?
@brendanfarthing
@brendanfarthing 3 года назад
Got any Picos in stock right now? They are hard to get.
@IanSMoyes
@IanSMoyes 3 года назад
I got mine from The Pi Hut.
@CharlesIsberInc
@CharlesIsberInc 3 года назад
What are the connectors you used?
@Core-Electronics
@Core-Electronics 3 года назад
Just some test clips- An example is linked in the article
@joshcosta423
@joshcosta423 3 года назад
Can you control those LED's to function as a "RPM" gauge?
@Core-Electronics
@Core-Electronics 3 года назад
Totally. If you can measure your tacho pulse and map that to a value between 0 and 12 then you can illuminate that index led
@Core-Electronics
@Core-Electronics 3 года назад
Check out this tutorial, it's pretty close to what you want: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-VFJ50tXNEbA.html
@cx3268
@cx3268 3 года назад
So the Pico is the new competitor for the Ardunio or ESP?
@sail4life
@sail4life 3 года назад
I think so, certainly for beginners or those needing an insanely flexible PIO block...
@SpeccyMan
@SpeccyMan Год назад
@@wesleyswafford2462 Ton is a measure of weight, not quantity. Is that too complicated also?
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
Any idea if this could be modified to work with SK6812 RGBW leds. I am currently using STM32 (bluePill) microprocessors and I had to modify the WS2812 library to support the extra byte of control data for the white myself since there was no available library to support it. But there was no assembly code required since the timing was handled by the SPI setup and the MOSI pin was used as the data output pin. But I have zero idea how that little bit of assembly code functions in your code. Maybe you could walk us through it in a future video.
@tannewt
@tannewt 3 года назад
It should be pretty easy! Just change the pull threshold from 24 to 32 to include a fourth byte.
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
@@tannewt I agree - I have been doing a little reading (and watching youtube) and it looks like all that would need to be done is to change the 24 to 32 and update the Def pixels_show() function to apply the brightness multiplier to the value.
@jcuellar578
@jcuellar578 3 года назад
@@MrEdwardhartmann if you get the rgbw neopixels to work could you please post the updated code? Thanks
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
@@jcuellar578 I don't have a Pico yet, but I have my name on the "notify me when they come in" list and I will order some. I will post if I get it working for sure.
@jcuellar578
@jcuellar578 3 года назад
@@MrEdwardhartmann Great! thank you
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
I think there is a minor bug in the code you used (but I am not sure). In the "Def pixels_show():" function, there is a line: "sm.put(dimmer_ar, 8)". This is a direct copy of the code in the pico manual. But, they were using 8 leds instead of twelve like you are using. But, that "8" might mean something else to the PIO function that I can't figure out since it seems that only 8 leds would have been loaded with this code, and I can see that all twelve of your leds are lit - I am so confused.
@davewalmsley8883
@davewalmsley8883 3 года назад
Edward, I think the '8' refers to 8 bit color values.
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
@@davewalmsley8883 I think I found an explanation for the "8" on page 362 of the RP2040 Datasheet. I am not 100% sure that this is the same thing because the datasheet is using C++ instead of Python, so it's different. it has the command pio_sm_put_blocking(pio0, 0, pixel_grb
@davewalmsley8883
@davewalmsley8883 3 года назад
@@MrEdwardhartmann That's it, 8 bits per color = 24 bits of RGB data.
@tubeDude48
@tubeDude48 Год назад
Magenta 246 - 100 - 175 as well.
@arduinominteszkoz1662
@arduinominteszkoz1662 3 года назад
How can I put the program on it to remember even if I unplug the usb?
@itznotonline
@itznotonline 3 года назад
Save the file as 'main.py' in pico
@arduinominteszkoz1662
@arduinominteszkoz1662 3 года назад
@@itznotonline Thank you
@edoardomariascardamaglia4325
@edoardomariascardamaglia4325 2 года назад
Hi! How can I make it fade?
@Core-Electronics
@Core-Electronics 2 года назад
Try using a loop! The best place for more in-depth technical support is at the bottom of the article, or on our forums forum.core-electronics.com.au/ We're full time makers and quick with a reply!
@rsriedel
@rsriedel 2 года назад
Has anyone figured out how to interface this as a slave to an fpp controller?
@ConsultingjoeOnline
@ConsultingjoeOnline 2 года назад
Why is the article disabled?
@Core-Electronics
@Core-Electronics 2 года назад
Thanks for the heads up, the link is fixed.
@user-jx3dr9zt2b
@user-jx3dr9zt2b Год назад
Is it available for ESP32?
@Core-Electronics
@Core-Electronics Год назад
GlowBits will work on ESP32 - they are WS2812Bv5 LEDs
@IanSMoyes
@IanSMoyes 3 года назад
If you're using 4 colour LEDS, e.g. rgbw or grbw then you'll need to change the code to say: # Example using PIO to drive a set of WS2812 LEDs. import array, time from machine import Pin import rp2 # Configure the number of WS2812 LEDs. NUM_LEDS = 13 PIN_NUM = 22 brightness = 0.2 @rp2.asm_pio(sideset_init=rp2.PIO.OUT_LOW, out_shiftdir=rp2.PIO.SHIFT_LEFT, autopull=True, pull_thresh=32) then add a fourth colour to all the data frames and the appropriate bit shifts.
@boi_doingthings
@boi_doingthings 3 года назад
Won't it be too good if you could have closed the lights. :)
@jyvben1520
@jyvben1520 3 года назад
a video for "each" example would be nice
@Keeping_IT_Simple
@Keeping_IT_Simple 3 года назад
A very understandable get going straight away without worrying about all the nitty gritty style guide - Thanks Looking forward to my pico arriving ( hopefully tomorrow ) and getting to actually put some code on it for real. Looks like this will make a great addition to my rapidly growing micro-controller collection - anyone know the number for " Micro-Controller Collector" Anonymous ?
@RamjetX
@RamjetX 3 года назад
Shhhh... Remember the first rule of Micro-Controller Anonymous?!
@Keeping_IT_Simple
@Keeping_IT_Simple 3 года назад
@@RamjetX afraid I don't as I haven't been able to even find the local branch, let alone join, as no one will talk to me about it !
@RamjetX
@RamjetX 3 года назад
​@@Keeping_IT_Simple Indeed... what MCA club? ;)
@fjolublar
@fjolublar 3 года назад
while True: pass is very bad. use time.sleep() instead.
@Videogame9559
@Videogame9559 Год назад
It's ok I'am a raspi anonymouse one first pi 1 raspi zeo 2 raspi w zeo one. Not working raspi 4 one 8gb raspi 4 one raspi 4 4gb two raspi pi pico one es32 mico controller.
@carlocarlo1635
@carlocarlo1635 3 года назад
mmm when Wifi?
@charlesm127
@charlesm127 3 года назад
At least 90% of microcontroller developers don't need wifi - why should I pay for it? go buy wifi module.
@carlocarlo1635
@carlocarlo1635 3 года назад
@@charlesm127 no Wifi, no money
@fsouzajr
@fsouzajr 3 года назад
just get an esp32
@carlocarlo1635
@carlocarlo1635 3 года назад
@@fsouzajr ho! yeah!!!!
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
Get a Pi Zero - wifi and bluetooth and $10 US
@RamjetX
@RamjetX 3 года назад
Not gonna lie... Disappointed to not see a rainbow
@MrEdwardhartmann
@MrEdwardhartmann 3 года назад
It is really really hard to record these little dots of light and get the color to show up on camera. They are beautiful to the human eye, but the camera sees all the colors as white. I think that is because the tiny spot of light is so bright compared to the surrounding area that it completely overdrives all the sensor pixels. For something as small as this little rainbow, I think putting a piece of white paper in front of the leds might have made it easier to see the colors.
@lomolariful
@lomolariful 3 года назад
The reflection on the table was helpful to me...
@Core-Electronics
@Core-Electronics 3 года назад
@Edward Hartmann they're pretty challenging to shoot - a diffusion paper is a great idea!
@RamjetX
@RamjetX 3 года назад
@@Core-Electronics I just like rainbows... They're like the Hello World of addressable LED strips
Далее
How to Setup a Raspberry Pi Pico and Code with Thonny
7:27
Все кругом Миланы... 🤣
00:12
Просмотров 119 тыс.
⚡️Uylanishim kerak, sovchilikka borasizmi?...😅
00:50
CircuitPython with Raspberry Pi Pico - Getting Started
42:47
Raspberry Pi Pico Stepper Motors via PIO
25:17
Просмотров 59 тыс.
How To Use A Servo With Raspberry Pi Pico
11:49
Просмотров 18 тыс.
Raspberry Pi Pico - Control the (I/O) World
1:03:16
Просмотров 603 тыс.
Raspberry Pi Pico - Review and Getting Started
18:32
Просмотров 74 тыс.