04-FastLED with Arduino Tutorial Introduction - How to Code for RGB LED Strips (WS2812B)
HTML-код
- Опубликовано: 11 сен 2024
- Source code below! Arduino FastLED Tutorial introduces FastLED and provides connection info and programming steps to get a WS2812B rainbow up and running in one episode.
All coding is shown live in Visual Studio Code, and results are displayed instantly on the ChipCam! Carl the cameraman assists.
Links to parts used in this episode:
IP65 Silicon Waterproof version of 5V BTF Light Strip.
amzn.to/3dKADNr
Infinity Mirror that we will modify to build our own:
amzn.to/3f0ibAz
Link to MakerFocus ESP32 Module with 8M of PSRAM:
amzn.to/2UnjbXC
DC Power Connectors to simplify hookups:
amzn.to/3dRuIWJ
That swanky stainless steel USB meter I use:
amzn.to/3dUCYVY
And a nice non-stainless version at 1/3 the price:
amzn.to/3hiljda
The above are Amazon affiliate links with commission at the wholesale level (ie: no increased cost to you). Here is a copy of the completed main.cpp file from the end of the video:
pastebin.com/x...
I've updated the description with the source code, which is now available at pastebin.com/xXJ0wTku
Very elegant. I'm a fan. Thanks for sharing your knowledge. Subscribed!
You never blink. That's really scary :D Love what you build and a really nice explaination :) Love the fire windows ahahaha
It would be great if you could fix the Amazon links. I had to guess which parts to purchase. Hopefully they'll work when they arrive next week! (April 7-10, 2021)
@@ou81aswell it would also be nice if you could let us know what parts you picked. Still have no idea
can you share the code to the led strip behind you on wall/ceiling. Orange.
Came for the Microsoft history, stayed for the awesome projects powered by MSFT option FU money. Dude. You're living the dream. Thanks for sharing.
I was a friend of Dan Garcia, this whole video would have made him incredibly happy, thank you!
I was just reading your book earlier today and coincidentally googled how to wire a WS2812B LED strip and found your video! Very cool.
Dave, I would mention that Mark Kriegsman (kriegsman) joined the FastLED project in 2013 and that the library is still actively maintained by Mark and a great group of people. I am really liking this series of videos, great job.
Thanks! Someone recently did the ESP32 side with parallel RMT support as well, do you know who that was... was it also Mark?
@@DavesGarage Dan helped with that a little bit, but that would mostly be Sam Guyer. Thank you to Sam!
I'm following along at home.... Christmas presents will be very bright this year. ;-)
Man you are badass! Took me a week to find out i can "puzzle" the GBR / RGB stuff. Also the rainbow method is an awesome trick. Your channel is way underrated, keep up the good work!
Love you channel! Commenting to let the YT overlords know that there is interaction and should be promoted to others!
It was so simple I had to watch it a couple of times, and I was convinced I was missing something. Great video!
The audio in your video is great. I see no problem keeping the mic right there, it's quite unobtrusive.
And the bokeh is great too. :P Really good video and great info Dave. I think Dan would agree.
Crap. A friend of a friend went down on that dive boat with Dan. Second time I've heard a reference to that tragedy in the past 7 days.
Hey anyway, I'm really enjoying your channel.
Hi there the mic is fine in the corner and you don't need headphones I've seen a few of your other videos and I have subscribed keep up the good work
Hey - just as a note - if you are like me, and you bought the Heltec (HiLetgo) ESP32 LoRa instead... :)
You will need to set the OLED_RESET (Pin16) to High and add the following code to the void setup() to get results on your OLED display...
pinMode(16,OUTPUT);
digitalWrite(16, LOW); // set GPIO16 low to reset OLED
delay(50);
digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 to high
I had a Neopixel strip laying around from an old AdaBox and was able to get my project up and running quickly with this guide. Thanks Dave!
Might I suggest managing your videos in playlists so that one can view this whole series easily? Thanks for the videos!
Indeed, there should already be a playlist on the channel that includes all of these in sequence. Is there somewhere that I'd need to list or expose that to make it more visible for you? I'm fairly new to RUclips, so all I did was create the playlist, set it as "series", and put it on the channel page. Thanks for any tips!
@@DavesGarage oh, yes actually its visible now. Thanks!
Hi Dave
Newbi here .
Very helpful and love your banter.
Well worth a subscription.
Hi Dave. I am at the start of my learning to program LEDs, and this is a nice
introduction. Thank you.
Task Manager Sensei
First View and First like of the new Video! Keep up the great work. I love the format and cant wait to get my hands on the animation sequences code!
Cool, thanks! It's always nice to hear from someone who's following along!
Just found this channel as I learn Arduino and fastled. But there is so so much more.. thanks for producing all this content!
You do a great job. Looking to implement this into a Burningman LED bike set up and a staff that also works.
I saw your 'Burningman LED bike and a staff' and had a very similar idea. Staff or scepter with a glowing orb at the top. Let us know how your project is coming along.
Use FastLed inbuilt power limiting. Works and is nice: you tell it your power or current limit, it globally dims the strip to meet it (if you light too many)
Will research that! Thanks for the heads up! I cannot find a power supply that will fit in the form factor that I need above 4 amps and the calculations he provided of 20 ma per each leg of the LED's gives me 7.2 amps draw. I think the real world draw is considerably less than that, but really don't want to find those limits. I could set this feature to 3.5 amps to build in a bit of safety factor and then program away happily knowing that I can't fry my power supply by accident.
Is this the command you were thinking about?
FastLED.setMaxPowerInVoltsAndMilliamps()
"Call the fire department that guy's house is on fire!'
"No need, he told me he has fire leds."
'Cool, I guess he must have installed smoke and heat generators too!"
Can't wait for Christmas now, its gonna be Lit! 🤘
Thanks for teaching us Dave. You are awesome. 😆
That fire effect does look pretty real. Someone is liable to call the fire department for you.
The Most LED Strip person in youtube.
OMG, its too expensive watching the number of strip you have.
Btw, nice video, i like it
You're the man" #1 fun stuff to do"
Love this series @Dave’s Garage!
Love this video. It helped me get started with individually addressable LEDs more than any other I've found here. Liked, subscribed, etc. And I'll buy your book for friends who are parents of a very gifted, autistic child. Thank you. BTW, your shortened Amazon links don't work for me. Not sure if they've expired but they merely take me to the top of the shopping site, not to the individual products you've referenced. Thanks again.
LOL, Man those fire windows looks pretty dangerous. I mean, someone might just call Firefighters to your house. 😂
Leave the mic in frame. Quality is fine and no one should care that it can be seen.
Love this tutorial and your humor. Thanks man! :)
Your garage looks like heaven!... :-O
Loved the way you ended it. 😂😂😂😂😂
It's cool to see Louis C.K. is getting into hobby electronics these days
Good content. Your accent provides extra watching pleasure. Thanks!
Canadian accents always pleasurable. (ok I'm a Canadian)
This channel is AMAZING
#Dave makes programming soooooo entertaining.
Thanks #Dave
Great video, sort of like This Old Tony but for LEDs. Subbed.
If we can only put LEDs on Tony's Maho! :)
Just found this channel, awesome
"More than 1000 LED's? You have a LED problem". Sir, you have a LED problem haha. Nice work :)
Woo , now i'm tempted to get an arduino uno kit and a WS2812B strip !
I subscribed 30 seconds in the video. 🤣
Love your content brother!
To borrow a phrase from a popular pilot You-tuber (Mentour Pilot), "Absolutely Fantastic!" (Mentour is the European spelling.)
I now see why your house is covered in LEDs. I’ve just had the idea to put a strip around my bedroom window behind the curtains to simulate the sun coming up when it’s winter, dark and I have to get up.
And then I thought of several other places they’d look nice too...
Do you just stick your LEDs to the wall with their sticky backing, or put them in aluminium channels?
Loving your movies Dave. Please don’t take this badly, but outside the USA “pound” has a different meaning. Pound is “£”. So it’s “hash define”, not pound define.
The Mic is fine, good stuff so far!
Dave, I have just a question of looks, did you use the strip with 144 leds per metre or 60?
Hi Dave, your videos are very well made and a pleasure to watch. It's fun to watch pros program with FastLED! I'm not yet finished watching, but I'd like to say that displaying an oled display can hugely lower the frame rate (that's my personal experience). I've even come to conclude that oled displays are better not used at all with FastLED. Perhaps you could work around that issue by assigning that task (displaying the oled) to a different core, if at least you need a high frame rate (ESP32 should have 2 cores). I didn't try that out myself as I rather run a webserver, which is assumed to also capture a core. Note that I am an amateur by all means. Have a nice day and keep making nice videos!
Thanks, and a good point! My practical solution to this is, as you say, a low priority task on the second core. I didn't want to complicate the intro with that, but we might get there eventually! In my own major project I'm having trouble with hardware SPI so am running the screen in software, which is super slow, so I had to solve it somehow! It only updates about 4 times a second, if that.
@@DavesGarage Great, looking forward to those episodes! For now it would indeed complicate everything.
For my own project, even updating the screen (I2C protocol) once per minute caused an annoying lag in some animations, which made me disable all oled updates in animation mode. I'm just telling you this because hunting such 'lag buggs' while nothing is wrong with the code can be a pain!
Don't leave us hanging here, Dave! Anxiously awaiting episode 5...
It's underway! I'm working on a "Reverse Engineering Tempest" thing that is taking up time and had some back surgery but it'll be along eventually!
@@DavesGarage working ahead a bit... Can you tell me what microphone module you're using for the music reactivity? Learning from many sources as I go, but what to be sure the hardware I get still works with your project.
You’re like an alternate universe version of AvR where he studied software engineering.
You mean AvE?
Nice, Like your Videos Strait to the point !
Just working thru this series - aiming to take my kids through them afterwards (they like playing with LEDs too).
Happen to have some slightly different kit lying around - so using a Lolin D32 for ESP32 and a nokia 5110 screen instead of an OLED - using the same libraries - just a little fiddling on the constructors - and it all works well.
But - I was going mad - once I added the fastled code - the LEDs blinked like crazy. In fact - they seemed to blink along with the onboard LED.
Took me a while to figure it - and you may have guessed it already :) - but this code is the reason (from the d32 header files):
static const uint8_t LED_BUILTIN = 5;
Oh - look - the same pin I have the pixels data line :)
Oh well - made me smile.
Wow, I've never seen a board that had the built-in LED on Pin5! Good catch, that could really trip you up!
@@DavesGarage It did for a while :) I just dropped the bLED toggling for now.
I was also interested - a little less screen real estate - but the 5110 screen using software SPI (U8G2_PCD8544_84X48_F_4W_SW_SPI) the gets about 44 FPS on that moire design :)
Excellent!!!! I found using GPIO 23 for LED DATA on my DOIT ESP32 DEVKIT V1 gave low output during reset and avoids full brightness on power-up. I was trying GPIO3 but it comes up as a driver and is high for about 250ms until the pin gets setup, long enough to confuse all the WS2812Bs and set the controls for the heart of the sun.
Mic I frame is not an issue.
Alternatively you could use a Lavalier mic, lots of people do that.
Hey Dave, great channel and a great series! Your links for the leds and controller went dead. They are falling back to the amazon home page. You must have sold out.
You mentioned connecting to a USB HUB/Switch (I think you meant hub) to protect the computer. Does it need to be powered? Recommended link? BTW. Loving the videos!
It depends on the switch and how it routes power, but I would think a powered hub would be much safer, if it indeed isolates the power entirely. Good thinking!
Dave, is the next one almost out? excitedly waiting
ur neighbors must love u
Oh, and since you've asked for tips regarding recording: someting to consider: the echo while recording a video. I am responding 5 months later so you might already are awere (if you weren't already)
Thanks! Not sure if newer videos are better, let me know! I've made a number of changes to audio.
Some of your links in description are broken... Just FYI.
Hey Dave. Thanks for the videos, very helpful. One question, you appear to include a number in most titles that I'm assuming is showing the order to watch the videos. However, either you skipped the number in some of the videos or I'm just not finding the whole set. How may videos are there related to FastLED with the Esp32? If you aren't showing the suggested order of these videos can you please reply and let me know the order that makes the most sense. Appreciate your help. Thanks.
Hey Dave, your videos are great and I'm following along. Keep it up. With each video though, it seems like you're suggesting I buy a slightly different arduino board. Is this really necessary? I'd love it if, up-front, you had a full parts list you would suggest for the series so I'd know how much $$$ I was committing to in order to get to the end.
So far each one except the very first uses the same board, but I might link to a different catalog entry perhaps? It should be the Hiletgo ESP32 w/ 0.96" OLED. I prefer the one sold by "Maker Focus", but I bet they're all the same. I did just switch to a link to a version that contains extra PSRAM for free, pretty much. So it's not the the *requirements* have changed (any of the boards will work with any of the projects).
I guess the one exception was the very first episode where I used a board with a colored LED onboard to keep it super simple, but I won't switch often, honest ! Though I do like the M5Stick-C, check that out, as it is what I am tinkering with now! But I still have dozens of Hiletgo units :-)
Greetings Dave, I have suffered happily learning from this series of videos.. Thanks for both the angst and for that sense of triumph, when (literally) the light comes on. Getting connected to the WS2812B strip with a board that has solder holes, rather than PINS will be fun.. Time to get the solder station out.@@DavesGarage
I meant to ask: Are you using the M5stick in these videos for their ease of use.. (Places to put pin connection wires)??
Funny, but after spending my days in C#, I find going back to C++ makes my beard grayer. Thanks for some great content choices!
This is a great tutorial !.....cheers.
Hi Dave, since you share a love of c# why haven't you tried nanoframework with esp32 ?!
Awesome content man!
I bought the board and LEDS you recommended and I have a question. The code builds fine but I get this error when uploading.. "serial.serialutil.SerialException: could not open port '/dev/cu.SLAB_USBtoUART'" I don't think it knows where the board is? or what port. any help or advice would be great. Thanks
Assuming you're using the Arduino IDE, you may need to select the correct device under Tools > Port in the pull-down menus.
Dave, possibly a stupid question but can you use FastLED to control white LEDs too and change between warm white and cool white? Or will it purely only work with RGB?
I think the amzn link to the MakerFocus ESP32 no longer works (or isn't available in Canada?)
Dave, is there a fastLED setting that regulates the communication speed to the WS2812B strip? I wanted to test my strip with just Red for each RGB led, then just green, then just blue to verify the individual LED were good. My string is 300 LEDs long. I have a separate 5V 20A supply for the strip. I connected the Gnd from the ESP dev board to the negative of the power supply so that the 5V power and the signal to the Data In on the strip (I’m using IO16 from the dev board) have the same common reference point. In the setup, I use a for loop to set all 300 elements of the CRGB array to 0xFF0000 so all 300 LEDs will powering only the Red LED. In the loop section, no changes are made to the CRGB array. I did leave fastLED.show() in the loop. I do not have an oled screen, but put a delay(250) in the loop. The string lights up red, but then glitch flickers to sometime showing blue briefly, and sometimes flickering to green briefly, but mostly stays on red. The CRGB data going out should never change. I’m thinking the speed of the ESP32 might be causing the data rate to be too high and the receiving WS2812B chips are not clocking in the data consistently.
Hi Sir Dave.. Thanks for all of your videos, I followed your tutorial about FastLED but it turns out my WS2812B is only showing white color LED after uploading the exact same codes. I'm using 18LEDS, 330ohms resistor for the data and Arduino nano. Why it's only shows white? Thanks.
I'm looking for an led strip where the LEDS are at least 3 inches apart, any recommendations?
Hey man i was wondering if you can share the code of the red fire/lava style behind your back
I noticed some of the Amazon affiliate links are obsolete. Dave, would you consider refreshing them? Thank you.
Love your content, thanks!
I appreciate that!
Great Video! New Subscriber. Thanks for making this.
It is a good job that there are people like you making these videoas. Excellent i have followed your code using 20 LEDs and the LEDs fade in and out, i have now tried 60 LEDs and the LEDs switch on and off without any fading. What am I doing wrong? Thank you
hello i amd trying somethis but there is nothing in internet about it. i want to run 2 defferent led stip same time on one arduino nano. but how i edit the code?
pls give me solution if you can. i just started learning about codding.
for example take any fastled code. and give the 2 defferent data pins like pin 6 and 7 but pin 6 led count 70 and pin 7 led count 50. but work same void loop how to edit code ?
i know its so simply who understand coding. but hard for me. help me pls
Many links are invalid ,can you update them ? Thanks so much .
Should any mains input / 5V output work for these projects? Thanks! Great videos!
How do you type so fast? Makes me dizzy... I have to pause to give me a break! Great video though fits what I am trying to do!
Love this stuff
10:40 i love you dave
Dave, I would like to know more about the M5Stack.
I'm curious as to what LED size strips you are using? Is it 96 LEDs/meter, or 144 LEDs/M? Hard to find these in longer than 1M strips online.
Hi Dave! I’m following along at home, but I noticed some of your affiliate links no longer work. Do you have any current recommendations? Thank you.
Blue Crew!!!
Hey Dave any plans of creating a tutorial on how to use your editor? Unlike you I am the hardware guy, not a coder. Your job is way harder that frying components!!
Ooo yes.. thanks homie
Well e plained thankyou so much.
Now have an idea for my project.
Oooo fireworks mode.
woooh`` I LIKE YOUR CIELING LED STRIP.. WHERE CAN I FIND OR GET THE SCRIPT FOR THAT? THANKS
What is that hexagonal lamp flashing patterns in the background? Have a video on it? Can be seen at 10:50
Some Amazon links not working.
Fun stuff...free stuff for .. free...wow!
This was super helpful! Thank you!
The first 3 links (Lights, Mirror, ESP32) are not working, just comes up to the Amazon front page.
Dave, looking at following your tutorials for a fun side project. Do you know of a ESP32 board/setup that doesn't require any soldering?