Raspberry Pi Pico Tutorial : NeoPixels / WS2812B LED's

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome back to my nerd cave in this tutorial today we are going to work with the popular new pixels or also known as individually addressable leds we are going to use the popular vs2812b led type we will learn how to program the color of each led individually making a simple larson scanner or mostly known as knight rider leds we will finish the video by looking at a simple prototype part of a project i am busy with to create an edgelit acrylic clock or also known as a cheap version of the led nixie tube which is an upcoming project video coming soon so make sure to hit that subscribe button and let's get back to this tutorial you will need the following component to follow along a raspberry pi pico new pixel or individually addressable rgb led light strip in this video i'm using 20 leds from a 1 meter ws2812b led strip with 30 leds per meter strip a breadboard and a few jumper wires the wiring is straightforward you connect the 5v of the led strap to the v-bus connect the data pin of the led strap to gp28 or any other type of gpio pen and connect the ground of the led strap to the ground of the pico just one thing to note for this demonstration we are only using a limited amount of leds so it is okay to power it through the raspberry pi pico if you are creating a project with many leds always use a separate 5v power supply that can supply enough current to all your led strips before we start the code we first need to download a library for the new pixels head over to the github repository of the user blaze-r open a new pixel.pui and copy all the code now open fawning create a new file paste the code and save it on a pico as newpixel.pui in our first example we will look at controlling the leds individually go to my github page linked down below copy the code under example 1 and make a new file in funny and paste in our first line we will import the new pixel from the new pixel library that we have added to the pico we import the udtime library to use a sleep function for delay and random library to random a value that will be used later in our code we then set the number of pixels in this example it will be 20 pixels we then initialize our new pixel function setting it equal to the variable strip and we passed the number of pixels the current state machine and our gp pen used for data in which in our case was 21 and we will also be using rgb some leds has rgbw which have a separate led for producing white light in this block of code we create different colors remember that we are using the rgb color model so you can create any color in a first line we create a variable rate answer it equal to the tuple which will have the value of 255 for eight and zero for green and blue at the end we create a list of all the colors we create a variable to store a delay value half a second showed here and using strip dot brightness we can set the brightness value of our leds to set a single led we can use the strip.set pixel and pass it to an led position and color but for this demonstration let's random five leds to be turned on displaying a random color from our list to do this we will create a random integer value from 0 to the number of pixels minus 1 since our index of our first led is 0 and then from the colors rgb we create a random integer from 0 minus the length or number of colors minus one since our index color for a rate starts from zero now upload this to your pico and here we can see five random leds turning on with random color and every half a second five new leds will turn on we can also then play with this delay or go add more leds our second example is the knight rider leds again we will import the same libraries except for the random set the number of pixels and initialize our strip this time we will only use red leds and a short delay we set the brightness of leds and this time without using foal to set the leds off we will assign the leds values 0 for the red green and blue in our main while loop we will use previous code covered in this simple knight rider project by setting leds on an orphanage sequence and shifting everything from left to right creating the knight rider led effect also known as the larson scanner changing the delay you can change the speed of the scanner the last example is part of a prototype of a project i'm working on to create an edge-led acrylic led clock in this case we only have the digit 0 to 9 which will be expanded by adding more to display hours minutes and seconds the way this is done is that i have cut the leds in the strips of free and glued them to the base then model the following two parts to ensure each acrylic piece is let up individually not causing light to shine through to other pieces the code at this moment is very basic just turning a row on every three seconds i plan to make a full video soon to take you through the whole process from designing to creating a pcb and a code so if this is something you are interested in make sure to hit that subscribe button i hope you found this tutorial helpful on a new pixel and i will see you in the following video
Info
Channel: NerdCave
Views: 32,267
Rating: undefined out of 5
Keywords: WS2812B, NeoPixels, Raspberry Pi Pico
Id: WpaXMcmwyeU
Channel Id: undefined
Length: 5min 17sec (317 seconds)
Published: Mon Mar 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.