How to use WS2812B RGB LEDs with Arduino

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today in this tutorial I'll show you how to get an example piece of code running to power your length of ws2812 the LED strips also known as in the air pixels let's get started okay so the first thing we need to do is wire up our dueña just as it shows in the picture for this tutorial so I don't have a DC barrel Jack adapter to some wires what I have instead is a lab power supply but the result is just a red and a black watt that's going to power the LED strip so these two connectors that I bring in here you can think of as the red and black leads coming off the power supply because that's all this is so with my black lead I'll connect it to the to the white fly light that's coming off the strip that's the ground and with the red lead I'll obviously connect that to the red on the strip so these fly leads that are on the strip additionally to the plug just allow you a convenient way to connect power connections you can power the strip through the connector as well but if you need a little more current or you're doing something like what I'm doing on the bench it's convenient to use these ones I'll just hold that down with some blue tack I think here we go just to make sure we don't get any any leads flying away just like that one okay so with our strip coward I just need to connect this signal wire and this black wire this red one isn't necessary because I'm going to be powering my doing it from usb this was just splitting off power to power the Arduino so I'll start by connecting the black ground lead which again connects to the white this time I'll just use a jumper and plug it straight into this plug that's on the lead that's nice and convenient and if you were wondering yes of course these two white leads are connected together and then the yellow which is our data signal goes from pm6 so I'll grab the digital six with my yellow lead and connect that to the center connection which is the the data input for the strip so you'll you'll notice that there were the 1/3 connection into that plug which is the power to power the Arduino but of course I've emitted that for you because I'm powering by USB so because I'm pretty confident that's all wired up with no errors I'm going to plug in my DNA and enable my power supply so now we have to open up Arduino it's go to my downloads folder and open up Twitter see here we are with an empty Arduino sketch and what we're going to do is first we have to download the neopixel library so we can go to sketch and include library and this is where we get the option to manage libraries if you already have a Adafruit neopixel library showing here you might need to follow this step but by opening up manage libraries I'm just going to waive that to enumerate and then in the filter I'm going to type neopixel and we can see the second result here is Adafruit near pixel by Adafruit so click on that and click install and that should happen really quickly and if I close that library manager I should now be able to go to file examples and down the bottom we have a different neopixel so I can just open up the thing it's the Strand test that I want to open I think that's the one that I've used to you yep so this is the Strand test this is already wired up to my straight away with strand test so let's just hit the upload button a way that goes and that's uploading and there's our instant gratification we have the LED strip working on the table running that that cool strand test script now if you if you didn't have a successful upload you may just have to check under tools that your board is selected correctly I'm using a Arduino Uno r3 today so I've just selected add we know yeah and that you have selected a valid comport and now just a bit of a muck around I've just scroll to the top of the script so you can follow along if we scroll down past the setup routine into the loop routine this is where all the action happens and if you just really want to focus on one of the demos and learn how that works then you can click drag and comment the entire blog so you can just click comment and I'm just going to focus on the rainbow so I'm going to comment out this is well I'm just going to comment that out so the only thing that we really have is the rainbow acting and if we upload that sketch now that will be the only demo that runs on the strip that's finished uploading so now you can see that we have just this this scrolling rainbow effect that goes all the way along the strip I'm not using the whole strip here that's easily changed by a single parameter just at the top of the sketch which is this first parameter which is the number of pixels in the strip so when we go down to this line adafruit neopixel strip this 60 is the number of pixels that are going to be used if you want to run your whole roll you can just count up the number of LEDs you've got and change that number to suit if you set it to 5 only the first 5 pixels on the strip will work and there you go just a quick start guide to get some instant gratification with some ws2812 B or neopixel leds I'll see you next time [Music]
Info
Channel: Core Electronics
Views: 333,640
Rating: undefined out of 5
Keywords: ws2812, arduino, led, rgb, how to, tutorial, guide
Id: 9hJyyUTflXA
Channel Id: undefined
Length: 5min 52sec (352 seconds)
Published: Thu Sep 14 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.