Today, we’ll look at the applications of LED strip lighting, which is a terrific, basic component that can bring a lot of aesthetic impact to any project. LEDs provide brilliant, colorful, and (in some circumstances) adjustable light, and purchasing them in strip form saves you a significant amount of time and work at the soldering bench.
While there are several “LED kits” available on the internet, the great majority of them can only cycle through a single color at a time. If you’re lucky, they might flash once in a while. However, with a little more effort and innovation, there are several opportunities for individuals ready to go the extra mile. This article will explain how LEDs function and teach you how to set them up step by step. Even if you have no programming skills, you can design your custom led strip light arrangement!
When shopping for LED strips, you will come across the following:
They are all good options, but each has its own set of advantages. If you want warm, comforting illumination, the CCT LED strip is great. Aim for RGB and RGBWW LED strips for additional color selections. However, if you want both color and vivid displays, the is the way to go. Order some addressable LED strips right now.
Furthermore, addressable LED strips are the programmable option among the three. They are unique because they are by programmed data and not the power supply.
So, what are we required to get started? We’ll need the LED strip, but we’ll also need a way to control it. Because our LEDs can be customized so much, we need something to tell them what colors to be and when to be. This is where the Arduino enters the picture. Don’t worry, even if you have no programming expertise, we’ll get you up to speed quickly. Finally, we must find a means to power everything. We’ll only need a 5V power brick for this, and we’ll be ready to go.
You will need the following items for the programming procedure and subsequent control of the LED strips:
So, what makes these LEDs unique? Why bother putting in the extra time and effort to work with these lights? Unlike other LED strips, you have the option to control and alter the color of each pixel. This means we can make a variety of bespoke animations. They can flash, pursue, and dance in a variety of ways.
Most LED strips from a reputable LED strip manufacturer, like the one listed above, have a useful 3 pin connection. If you don’t want to solder, you may connect your Arduino with a pair of jumper wires and the power source using a barrel jack. While power and ground can be attached to any side, double-check that the data wire is connected to the correct side of the strip. It is worth mentioning that it is usual practice to connect a tiny resistor to the data line to safeguard the LED strip. However, strips like the one listed above already have this resistor.
Before we get started, let’s take a step back and consider how we go from a statement like “I want the LEDs to be green” or “I want two separate areas of the LEDs to alternate from blue to purple” to something the Arduino and lights can comprehend. Because each of our LEDs might be a different hue, we need a mechanism to communicate this to the Arduino. Let’s see what happens if we make the first pixel in our strip purple and the second yellow.
When we zoom in on each of our LED pixels, we can see that they are made up of three LEDs: red, green, and blue. By adjusting the brightness of each of these three hues, we may generate almost any color we choose. Each of the three colors can have a value ranging from 0 to 255, with 0 being off and 255 being maximum brightness.
It is as simple as turning on that specific LED to obtain green, red, or blue light. If we want a more complicated hue, we must experiment with the brightness of numerous LEDs. Set the red and blue values to 255 and switch off the green to make our first LED purple. To obtain yellow, we increase the red and green values to 255 and turn off the blue.
The second issue we must solve is that the Arduino only understands 1s and 0s, therefore our numbers must be saved in binary. A number between 0 and 255 requires just three digits in decimal, but eight digits in binary. As a result, each color receives 8 bits (also known as 1s or 0s) to store a value ranging from 0 to 255. Because we have three colors per pixel, we have a total of 24 bits for the entire pixel. We now have a string of 24 (1s or 0s) describing the color of a pixel. In this example, we have our colors set to 255, but we may lessen their brightness by scaling them down.
Now that we’ve learned a little bit more about how LEDs see color, let’s get into the coding. Rather than just copying and pasting a bunch of code and calling it a day, let’s go through it line by line and make sure we understand precisely what we’re doing. This way, we’ll have a better understanding of how to create more sophisticated animations.
The setup is carried out in the first piece of code. The Arduino runs over each command line by line and executes it once. Let’s have a peek at what they’re up to.
The FastLED library is the first thing we do. This enables the Arduino to comprehend the next few commands we’ll issue. The FastLED library understands how to transform our decimal integers into the binary format required by the Arduino.
Second, we must inform the Arduino of the number of LEDs we intend to use. In this case, we’re only utilizing two LEDs. If you wish to utilize more, alter this amount.
Third, we must inform the FastLED library of the sort of strip/lights we are utilizing. Because the FastLED library may operate a wide range of LEDs, we must select WS2812 (even though technically we are using WS2812b).
After that, we inform Arduino which PIN we’re utilizing. This is where we connect the data cable to the Arduino. As shown in the figure, it is connected to Pin 2 which might be in 3,4 or Pin 5 location where your strip is plugged in.
The fifth aspect is the arrangement of our colors. This informs FastLED that we want to utilize green first, then red, and then blue.
Finally, we give it the name we created in step 2 for our strip.
The loop is the name given to the second portion of the code. This is because instead of running once, it goes through the lines of code and then returns to the top of the loop and begins again.
After that, we tell the Arduino what color we want each LED to be. In this example, we increased the red and blue values on the first LED to make it purple. The second LED was then turned to yellow by cranking up the red and green while leaving the blue off. The “RGB” function comes from the FastLED package and does its magic by taking our (255, 0, 255) and modifying everything.
Finally, we must send color data to our LEDs. Until now, only our Arduino has known what colors we want the LEDs to be. When we execute the display command, we send all of the data from the Arduino to the LEDs. Assuming we accomplished everything, we should now have one purple and one yellow LED.
Finally, we provide a delay command at the conclusion. This causes the Arduino to wait 1000 milliseconds, or one second, before proceeding to the next line. However, because we have reached the end of our loop, we return to the top and begin again. The Arduino adjusts the values of the two LEDs once again and sends them to the lights. The only difference this time is that the lights are already on and the color values haven’t changed, thus we don’t see any changes in the lights even though they continue to update every second.
This is my favorite of the NeoPixel animation examples. It scrolls across the complete color spectrum while equally spreading it across the LED strip.
This is a little animation I created based on the “Theater Chase” animation from the NeoPixel sample code. It simulates an animated candy cane by creating the effect of a crawling light in red on a white backdrop!
This animation generates a slew of randomly blinking white pixels that resemble snowfall.
Now go ahead and illuminate everything! It’s worth mentioning that the Reddick is capable of addressing far more than 60 LEDs, but you’ll need to upgrade the power supply before you start chaining strips together.
Do you require extra LEDs? Check out our Elstarled website and place an order with us; you’ll be able to locate whatever LED strip you need.