With the holiday coming up real soon, I figured this would be a great opportunity to create and post some cool effects for your LED strips. Maybe you can be your own Griswold (National Lampoon’s Christmas Vacation) with these!

LEDEffects

Below an overview of this article.

All these effects work with NeoPixel and FastLED, and with each effect I made a little demo video.

UPDATE – All effects in one sketch

Bij popular demand, I’ve written an article how all these effects can be placed in one sketch, allowing you to toggle effects.
Read more about it in this article: Arduino – All LED effects in one Sketch. (updated the link)

Arduino IDE and Library versions

For this article I have used the Arduino IDE 1.6.6, which (after you installed either FastLED or NeoPixel) will show a message to update either of these (and possibly others) libraries. Please do so.

Arduino Connected to PC

The following I use for when the Arduino is connected to my PC:

Arduino & WS2812 – USB and External Power

Arduino Standalone

After you’ve uploaded your variation of effects into the Arduino, and you’d like it to run standalone, then this setup is what you need. Without a connection to your computer, the Arduino will need +5V from the external power supply.

This is for stand-alone ONLY so when the Arduino is NOTconnect to a PC!

Arduino & WS2812 – Only running on external power supply

Helpful tool: Color Picker

This tool might be helpful when picking colors:
LED colors are build up out of 3 numbers: red, green and blue (RGB).
Each number is a byte so it each has a range of 256 values (Decimal: 0 … 255, Hexadecimal: 00 … FF).

Now the human brain (usually) doesn’t work with RGB numbers, so I’ve added this little tool to pick colors.
You can select the color and it should give you the hexadecimal value of the selected color.
Please note that the LED colors might be slightly off – after all they are not calibrated.

Color picker:

Usage:
Click the input box and a popup will show a color picker. Choose your color, and the hexadecimal value will appear.
To use this in your Arduino Sketch:

The first 2 characters represent RED,
the second set of twocharacters is for GREEN and
the last 2characters represent BLUE.

Add ‘0x‘ in front of each of these hex values when using them (‘0x’ designates a hexadecimal value).

Example:
This purple is B700FE.
The hexadecimal values: red is B7, green is 00 and blue is FE.

As the Arduino can work straight away with hexadecimal number, you will need to type “0x” in front of it – so it can see the difference between regular decimal number and these hexadecimal numbers.
So for example a NeoPixel strip.Color() call would look something like this:

strip.Color(0xB7,0x00,0xFE);

Make your effects cooler: Diffuse Light (toilet paper magic)

I love playing with these LED strips, but sometimes they feel a little too … I don’t know how to say it.
With some effects you’d prefer to not see the individual LEDs light up.

To remedy that without too much effort, you can diffuse the light – make it more fuzzy.

There are different techniques for that, anywhere from using ping-pong balls (which works great for one or two LEDs), frosted glass (tube light!) or plastic tubes, cloth sheets etc.

I had none of these available – I used to have ping ping balls but my dog decided it to be awesome for chasing and chewing. So I’m out of those.

To my surprise, regular toilet paper (yes!) actually does a pretty good job with the diffusing as well. Naturally, I had only “fancy” toilet paper with a print on it, and neutral toilet paper would have looked even better, but you get the idea when you se these two examples.

Just make sure to keep the toilet paper roughly an inch (2 to 3 centimeter) above the LEDs – don’t let the LEDs touch the toilet paper.

Note: Both examples look better when held vertical, but without much assistance in my house, I had to do it horizontally.

The Fire Effect is my favorite and shows best in a darker environment, but look at what the toilet paper is doing … I love it!

Required Library – NeoPixel or FastLED ?

Since both are pretty good, but are not used in the same way – ie. they are not drop-in replacements for each other. That’s why I decided to create a few “generic” functions so that the “effect” function here can be generic as well, so these functions work with either of these 2 libraries.

Note : FastLED seems slightly faster. In the tests I’ve run I would estimate that FastLED is about 15% faster than NeoPixel. You will notice this with large amounts of LEDs (as I experienced with 300+ LEDs). On the other hand, NeoPixel seems to take less memory on your Arduino. Also note that the functions in FastLED are far superior to NeoPixel.

Now I wrote tiny wrappers around some of the basic functions of NeoPixel and FastLED – and I’m sure there is room for improvement. Suggestions are welcome.

Basic framework

For each of the LEDStrip effects, we will use a basic framework of code which we reuse in each of the effects.It is important that you pay attention to these since the basic settings for your strip is being done there.

Now in this framework I’ve also defined 3 generic functions.
These functions will automatically grab the code needed for the library you’re using (when compiling).

showStrip();

This function simply applies the recent changes to pixel colors and makes them visible.
It calls strip.show (NeoPixel) or FastLED.show (FastLED).

setPixel(Pixel, red, green, blue);

With this function we set the color of an individual pixel (LED).
You will need to pass the pixel number (start counting at zero) and the RGB values.
For NeoPixel it will call setPixelColor, and for FastLED it will assign values to the leds array.

setAll(red, green, blue);

This function sets the entire strip to a give color. You can use it to set the entire strip to a given color or for example with setAll(0,0,0) to black (off).

The code we present, with each of the effects, is simple replacing this part of the code in the framework code:

So in our effects code examples you will only see the loop() section and the effect function.
Settings and the 3 wrapper functions will not be displayed, but are most certainly needed!

FastLED Framework

This is the basic code for use with the FastLED library.

Here we include the needed library (line 1), define the number of LEDs (line 2), define the Arduino pin used (line 4), and define some strip specific settings (line 8) like color order (RGB, GRB etc.).

LEDStrip Effect – Fade In and Fade Out: Red, Green and Blue

With this effect, we use fixed colors for all LEDs, in sequence: Red, Green and Blue.
We will slowly increase brightness and when the maximum brightness has been reached, we will start decreasing the brightness again until the LEDs are OFF.

LEDStrip Effect – Fade In and Fade Out Your own Color(s)

Now fading in and out only red, green and blue is nice, but what about fade in and out your own color?

If you’re not sure how to determine your own color, check out the previously mentioned Color Picker.

As with all of these effects, you can mix and match whatever you like. But if you’re in a patriotic mood, then there is not much better than our belowed red, white and blue. You can accomplish that by calling the function for each individual color. So, for example, by replacing the loop() with the following:

LEDStrip Effect – Strobe

Now, this effect quickly flashes all LEDs a number of time and then pause a certain time after that.

I made this one more configurable, so you determine how much time should be paused between flashes, and how much the “end pause” should last.

The function takes 6 parameters.

The first 3 are the same red, green and blue we have seen in the previous effect so you can define your own color – see the Color Picker above for picking a color. In the example I used White.

The next parameter (StrobeCount) indicates how many flashes you’d like to see.
Parameters 5 (FlashDelay) and 6 (EndPause) are for delays between each individual flash and how long the function should wait once it completed all flashes.

In the more advanced call example, we make the fade out steps and fade out delays a little random. So some eyes disappear faster than others. And the “EndPause” delays has been made random as well, so that in the end eyes will appear more random.

Using Random numbers …

The Arduino random(Min,Max) function returns a random number between “Min” and “Max”.

Calling the randomSeed() function just makes things a little bit better more random.

You can use the calls to random() in the parameter of the functions presented here. You’ll see me do this occasionally to give the effect a more fun appearance.

LEDStrip Effect – Cylon

I suppose not all of us know what a Cylon is, but I grew up with those cool robots and I for sure wanted to have one.
My familiar with Knight Rider (although that’s about the same era)? It’s kind-a similar.

This type of “scanner” is often referred to as a Larson scanner is named after Glen Larson, the man responsible for producing both the original Battlestar Galactica and Knight Rider television shows.

Anyhow, here an effect that simulates the moving “eye” of a Cylon: A red “eye” moves from left to right and back, over and over again. Kind-a ike a bouncy ball haha.

The Cylon() function takes 6 parameters, where the first 3 are you preferred color (a Cylon has a red “eye”, but you can pick whatever you like with the Color Picker). The 4th parameter (EyeSize) determines how many LEDs run around, or: the width of the “eye” (outer 2, faded, LEDs not counted).

The 5th parameter (SpeedDelay) influences how fast the eye moves, higher values means slow movement.
The last parameter (ReturnDelay) sets how much time it should wait to bounce back.

In this comeback the KITT scanner started behaving differently. Instead of bouncing back and forth it now follows this pattern:

New Larson Scanner (KITT) directions

I had no clue about the change – I guess the revived show didn’t make that much of an impression – so I did get this pattern from the earlier mentioned KITT-duino Instructable.

As you can see, all steps repeat so I decided to make separate functions for the repeating patterns.
All these functions take the same parameters – so you can use them individually as well.

Obviously first the color definition (red, green and blue), then the size of the “moving eye”, the speed delay and how long we’d like to wait when the LEDs bounce.

NewKITT() calls for the complete routine of earlier mentioned pattern, where as CenterToOutside(), OutsideToCenter(), LeftToRight() and RightToLeft() do their fraction of the pattern. Again: they can be used on their own, so feel free to mix and match.

LEDStrip Effect – Snow Sparkle

This variant of Sparkle is intended to look like snow with to occasional sparkle.

Having snow in mind, the first 3 parameters (the background color) should be a more dim white and that’s why I choose 10 10 10 – but feel free to pick your own color.

The 4th parameter, SparkleDelay, indicates how long a “sparkle” will be visible. Do not set it too short, otherwise you’d barely notice anything happening.

The last parameter indicates how much time should be waited after a sparkle has been made visible and has been removed.

You could use a fixed interval for that:

SnowSparkle(0x10,0x10,0x10,20,200);

I like it better though when it’s more random. For that I’ve added the random function again to the function call where (in this example) the wait time between sparkles is a random number between 100 and 1000 milliseconds (1/10th of a second and a full second).

LEDStrip Effect – Fire

This effect looks best when hanging your LED strip vertical and it simulates a one LED wide “fire”, and is adapted from an example in FastLED, which is adapted from work done by Mark Kriegsman (called “Fire2012”).

The first one (Cooling) indicates how fast a flame cools down. More cooling means shorter flames, and the recommended values are between 20 and 100. 50 seems the nicest.

The Second parameter (Sparking), indicates the chance (out of 255) that a spark will ignite. A higher value makes the fire more active. Suggested values lay between 50 and 200, with my personal preference being 120.

The last parameter (SpeedDelay) allows you to slow down the fire activity … a higher value makes the flame appear slower.
You’ll have to play a little with that, but personally I like a value between 0 and 20.

LEDStrip Effect – Multi Color Bouncing Balls

This is a more complex variant of the Bouncing Balls effect.
Instead of just one color, it allows the use of multiple colors, each defined by you.

This makes the function call a little bit more complex, since I wanted it to work for any number of balls you’d like set. The problem would be how to pass the color for each ball.

To accomplish this you will have to define a so called multi dimensional array – which may sound scary, but I’ll walk you through that.

Let’s first look at the effect itself.

The function BouncingColoredBalls() takes only two parameters. The number of balls and that scary array of colors. Easy so far, right?

Now, let’s say we want to use 3 balls and use a red, white and blue ball. So 3 balls, requires 3 colors.

123

byte colors[3][3]={{0xff,0,0},{0xff,0xff,0xff},{0,0,0xff}};

The first line defines the variable “colors” as a 3 x 3 array of bytes: byte colors[3][3] (downside: you can only use up to 255 balls)
We want 3 balls, so we need 3 sets of 3 values to define their colors. So the first “3” indicates the number of Balls.
Remember the Color Picker? Each color has 3 values: red, green and blue. So the second “3” indicates the 3 colors for each ball.

I guess I didn’t think that one through … argh … oh well I’ll show you some examples with a different number of balls.

We’d like to assign these values right away and in C we have a specific notation for that. For a regular array we use { value1, value2, ... valuen } …. so for 3 values this could be {1,2,3} , enclosed with accolades ( { and } ) .

Since we have a multi dimensional array – an array that has arrays as values – we will need to pass the arrays (colors) as values, so for a 3 balls and 3 colors array we need to do something like this: {{ value1, value2, value2 }, { value1, value2, value2 }, { value1, value2, value2 }} .

See the pattern? { value1, value2, value2 } is a set of 3 values (bytes) for one color.

Here an example if we would use only 2 balls, say for Christmas we use red and green balls:

12

byte colors[2][3]={{0xff,0,0},{0,0xdd,0}};

2 Balls, each having a red, green and blue value (3).

Now to make this work we have to make 100% sure that the first number (2 in the 2 ball example) of the array matches with the first parameter we pass to the function. So the 2 ball Christmas example would be called as such:

123456

void loop(){
byte colors[2][3]={{0xff,0,0},{0,0xff,0}};

BouncingBalls(2, colors);}

I know these can be a little out there to grasp, I hope I did explain this right …

Just another example, with 5 balls (red, green, blue, white and yellow), to illustrate the usage of the array:

LEDStrip Effect – Meteor Rain

This effect, based on a request by Hendrik, has been added almost 2 years (Januari 1st 2018) after writing this article – the video could have been done better and this effect should be vertical. None the less … here it is. This effect came with it’s own challenge since FastLED has a great function for dimming LEDs, NeoPixel however does not.

As with some of the previous examples, you can use the red, green and blue parameters to set the color of your meteor – you can use the Color Picker to find a color (even though it’s not perfect – it will get you in the right direction).

After the color, we can set the meteor size – the number of LEDs that represent the meteor, not counting the tail of the meteor.

The 5th parameter sets how fast the meteor tail decays/ disappears. A larger number makes the tail short and/or disappear faster. Theoretically a value of 64 should reduce the brightness by 25% for each time the meteor gets drawn.

Since meteors are not perfect, I’ve added the 6th parameter to mimic some sorts of difference in debris by making the decay a little random. If this value is set to “true” then some randomness is added to the rail. If you set the value to “false” then the tail will be very smooth.

Finally there is the last parameter, which basically indicates how much the drawing speed has to be delayed. A value of zero (0) means maximum speed. Any value above zero indicates how many milliseconds (1000 milliseconds in a second) the drawing will be delayed.

Donation options

Donations are very much appreciated, but not required. Donations will be used for web-hosting expenses, project hardware or a motivational boost (a drink or snack). Thank you very much for those have donated already! It's truly AwEsOmE to see that folks like our articles and small applications.

Very good tutorial, but I think there is an error on the picture 2 “Arduino & WS2812 – Only running on external power supply”. I guess when you connect Arduino to external power supply in this case external +5V (DC) should be connected to Vin pin of the Arduino, but on your chart it is connected to +5V (that i theory should be used to supply detectors connected to Arduino).

I guess you’re right that usually Vin is being used, instead of +5V.And even though the displayed setup works just fine (I’ve been using this setup for almost 2 years now on a daily basis), I should probably look into changing the picture to be really 100% correct.

The problem is that I’m traveling until next month, so I won’t be near my stuff in the next weeks to make the modifications …

Actually the VIN pin is connected to the voltage regulator, which at least on the UNO is supposed to be fed with 7-16V. When using a (regulated?) 5V source the 5V terminal can be properly used as an input.

Fantastic site! I just got a Arduino Uno starter kit from Amazon and waiting for a 1m strip of WS2812 lights to arrive as I have a project I am working on for a holistic friend of mine. I’m 50 and new to all of this, but from my research, using the Arduino and the light strip is my best way to go here, so I am learning as I go now.

I have to create a 7 led light strip that goes in the following order LED1 always red, number 2 always orange, 3=yellow, 4=green, 5=blue, 6=indigo and 7=violet.

What I need the sketch to do is run for about 10 minutes in a random format where 1 of the 7 led lights will light up for a second or two and other lights remain off and then the next random led lights up. Then after 10 minutes, I need the strip to then run a continuous simple chase format where LED1 lights up for a second or two (all other lights off), then goes off. Then LED 2 goes on (all others off) , then the pattern continues #3 thru #7 then start over again at #1.

I’ll be reading more of your posts, but any advice on how to proceed would be greatly appreciated!

Maybe (considering the potential code we’d be posting) it’s better to start a topic in our Arduino Forum. Any post in the forum, I read … It does not sound like this would be a very complicated project, so I most certainly am willing to help you with this.

I am a complete novice but have made some limited progress with some modifications as you will see from the attached code. I would be extremely grateful if you could point the way with the next stage as a variation on your Strobe code. I have so far modified it to produce the following: –

1. A second strobe function including and an additional integer that I have called BlackDelay which needs to have a different integer value to the FlashDelay.

2. Corresponding duplicate function and statement blocks for the second strobe function.

What I would like to do is make each Pixel individually addressable with a predetermined fixed colour/colour combination and strobe sequence. At the moment I am using 5 PL9823 addressable RGB LEDS for testing but will eventually require >100.

Not every one of the intended 100 or so Pixels will be unique, as in some Pixels may share the same colour/colour combination and strobe sequenceI and I am assuming that if there are say 80 variants, that these could be configured in setup and then called from a loop function for each Pixel?

I’d recommend taking this to the forum.On top of that: I’m traveling so I won’t be able to give you anything good until I get back home, which will be in a few days. If you decide to move this to the forum;– Post a link to the Forum post here would be great for others that might be interested – I do see every post in the forum, so I won’t forget or miss it

Hmm, you should be able to create a new topic.Can you try reloading the page and try again (if you haven’t done that already)?If not then that would be a problem – I just checked your user profile and it’s set to “participant”, so you should be able to create a new topic.

I did notice however that the login dialog doesn’t always seem refresh the page as it should, after loggin in.Please let me know if this issue persists. I’ll do some investigating on my end as well.

Hello i have a question, first off thank you for all the code and great job, second I try to put the code into Arduino and compile it, it keeps saying ‘meteorrain’ was not declared in this scope any idea of how i could fix that?

it’s a little hard to determine why you get this message without seeing the code.Please do not post the full code here though, rather use the forum for that to avoid that the comment sections gets too long.The most common reasons why you’d see that message:

1) You copied the code from this website and are one of the very unlucky users where the Arduino IDE is doing something goofy with it.

fix: Copy and Paste the sketch from the website into Notepad, Copy again from there and paste it in the Arduino IDE – this typically filters invisible characters causing issues.

2) You’ve typed the code and made a typo somewhere.

fix: Look around the “void meteorRain(…)” function definition. You may have missed a “}” or a “;” (quite common).

I tested it here with a fake username in Chrome and Safari – it worked just fine unfortunately. So I’m guessing it was a caching issue.I’ll keep an eye on it and take a better look once I get back home. Maybe one or the other thing is caching where it shouldn’t.

Running Arduino 1.6.3 with FastLED 3.0, Arduino Nano 3, 328 atmega, WS2812B leds. LEDs, when setup with RGB ordering, output green for red, and red for green. Blue is fine.Switching to GRB ordering, all the LEDs in my strip turn green, with hints of other colors (ie a flashing “red” LED will be a slightly pulsing fully lit green LED.The coloring of the strip does not occur in the RGB ordering – but obviously, the colors are backwards.Any thoughts?

there are several ways of ordering the LED colors, not sure why some (often Chinese) manufacturers choose a different order. You’ve already tried RGB and GRB, if I understand you comment correctly. As far as I can see, these combinaties should be valid, and you’d have to test which one works for your strip: RGB, RBG, GRB, GBR, BRG, and BGR.

Since I haven’t ran into this issue, I would not be able to predict which one would work for you.

Note: When you set all LEDs to WHITE then the color scheme should not matter, since all values (R, G and B) should be FF.However ,… if you strip does not light up white, then there might be another problem.

I am “newbie” with Ardunio and my English is not sooooo good (I read better than I write). So I have to use Google translator to help me to write to you.But I hope you can help me.

I visited this site: //www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/. I liked what I saw and tried out all the sketch on this site.

So my question is: Can I find a sketch/Framework that contains all the effect-sketch in the Framework?

I want to teach me the use of functions (I would think that I have to use functions to “connect” sketch together?), but still has a lot before I understand their use. Unless there is a sketch which shows that use of all smal sketch in the Framework.

I would be very grateful if you could write me the sketch to show me all the effect-sketch in use in Framework.

You can also post it on your site so that other people can use it. :)

I want to study how you put together all the sketch and run them together, and use off function to be beeter to write code. I want to make myself a great Christmas stuff! :)

you’re English is actually pretty good – with or without help from Google

I suppose theoretically, you could put all effects into one sketch. It might be however, that you run out of memory (depending on the Arduino model you’re using).First you’d have to copy all the functions I have mentioned here into the same sketch – just keep adding them at the end each time.

Next you’ll have to look at the “loop()” function where we call these functions – this is where you have to be creative and see how you’d like to call them (what order etc).

Posting the entire code here would be a bit large, so I did post it in the forum … You’ll find the FastLED and NeoPixel versions in this post.

OMG…you know how cool it is when you find EXACTLY what you are looking for on the magical interwebs? Thanks so much for sharing your knowledge on this…just got my first set of pixels to make a marquee sign, and have been trying to explore both of the libraries you use here on my own…this write-up pulled it all together for me! Now I have them doing exactly what I want, and have come up with some different ideas that I never would have thought of…

These LED routines are all great. I’m trying to combine a few of them into one program and have a variable chose which one to display. I’ve only tested a few so far, but I found that the Bouncing colored balls gets stuck and does not return to the loop. I added a line after showstrip; to break if the variable is not set to the value for that routine. I thought I’d mention this in case someone else is attempting to do the same thing.

I have not run into this issue before, but it makes sense since we keep the balls bouncing using “while(true)”.You could of course add a timer or something and then modify the while to something that checks if it has been bouncing for a certain time.

A few other users have been toying with combining the effects, see this forum post and this one.Not sure how helpful they will be of course for your project, just thought I should mention it …

If you have created a cool project, feel free to post it in the forum!I’m sure others might enjoy it as well – but it’s totally optional of course …

I added the Cylon and New Kitt to my Program and noticed every time these routine starts over, most of the leds briefly flash white. I cant see anything in the code that could be causing this. Any ideas?

I got it to do exactly what I wanted. I was already using the bouncing color ball routine, so I used the array to call up the different colors as it switches from left to right, outside to center, etc. I’m just started learning this arduino stuff. I’ve been programming pic micros in assembly language for the past 25 years. Using these addressable LEDs is a great way to learn a new language. FYI, I’m using a Teensy 3.2 as my processor.

Hey, for me, a lot of this stuff is new as well. I used to play with the BASICStamp (far from as advanced as using assembly) for a while, but the Arduino made things a lot easier. Also good to know that Teensy pulls this off!

Utterly fantastic. Thank you so much for taking the time to create, write up, and share all of these fantastic light displays with us! You have a true gift and a generous heart.

Since your code has saved me at least a day’s worth of work, I would happily donate to your site for your time and effort, but I’d rather all of the funds go directly to you (instead of 90% through Flattr). Are there alternatives (like PayPal) or something similar? I’m US-based, if that makes a difference.

Thank you for your kind compliments – that is always a motivator to keep going .You can donate through PayPal, although it’s not required yet very much appreciated.Unfortunately, PayPal did not allow me to have a donate button but I do have a PayPal account. I’ll email you the details.

Absolutely Amazing! You truly are the keymaster of NeoPixels. I absolutely love WS2812’s and have been playing with them for about 6 months now. This is by far the best use of them I have found. I was hoping you could point me to an example that uses your examples with a switch. I have been trying for a few days now to get your code with “all effects” to operate through a switch case instead of time delays. I have had no luck getting a switch to control even two shows. I must be missing something very simple like checking my switch at the wrong times. Hopefully there is something out there for me? Otherwise you have made a wonderful contribution to NeoPixels.

I could use a drink right now haha (it’s super hot here right now).You can donate through PayPal (email: hans at luijten dot net) … pick a subject like “drink” or “LEDs”. PayPal doesn’t allow me to place a Donate Now button on my website ….

Hahaha once you get the hang of it … you WILL go overboard with the LED strips … don’t forget to send pictures!!!!It’s awesome stuff to play with …

Hi, I’m new to all of this LED and Audrino stuff, I was wondering if it is at all possible to create a “Chase” effect or any of the effects posted here for that matter, using a single color LED strip with UV LED’s?

First off, thank you Hans for writing back so quickly. I really do appreciate it and your your time. So yes to, there are lots of strip out there with UV LED’s but to my understanding they are all analog. I can’t seem to find a single color digital strip anywhere let alone one that is UV. This is basically for a computer build that I’m putting together. The other question I came up with is permanent placement of the arduino in side the computer. Is it possible/ok to, substitute the external 5v power supply you in your diagram with a molex connection to the 5v 30a DC rail on a ATX computer psu?

I think the problem with Analog strips is that you cannot address the LEDs individually, so making that work with an Arduino might not be possible. I did find this Arduino Forum Topic, which might be of interest.

As for powering the Arduino+LEDs with your computers PSU; that should work (5V 30A is definitely enough). Just make sure that you get a PSU with some extra watts available to power your PC (mainboard, disks, videocard, etc) and the LEDs. Placing the Arduino itself in the case would not be a problem though.

So I went and got an Arduino UNO Starter kit, ordered a whole mess of led strips (waiting for them to be delivered). Downloaded the Arduino Software and the Fast LED Library. No matter what i do whether its open a file from the fast led library or just copy and past it from here. All I get are error messages. I have to say beyond the simple downloading and uploading of files or copying and pasting the code. I truly have no clue as to what I’m doing or looking at, or even what I’m doing wrong. Whatever help you can give would be greatly appreciated.

I can totally understand the frustration … it’s too bad that the Arduino IDE doesn’t handle GitHub ZIP’s all that well (see also here). You could try that older FastLED library and the Arduino IDE could automatically update it to the latest version.

So I quickly started up a Windows virtual machine to describe it for you., and installed the latest Arduino IDE (1.6.9).After the application started, I went to the menu: Sketch -> Include Library -> Manage Libraries. This will open a window, which takes a bit to load everything it can find. But once it’s done, you can type “fastled” in the “Filter your search…” box. FastLED should appear here. Click it and the button “install” will appear. Installation takes seconds. Once done, click “Close” and the FastLED library should be available.

My Project: I’m building a new High End Gaming Computer, with a custom liquid cooling system, of which the main focal point of the system will be the a custom built reservoir tank. Everything inside the case will be visible through large side panel windows. I plan on cutting the led strip down to length, to fit inside a sealed tube, inside the center of the reservoir and have the LED’s running the desired effects while the coolant is swirling around the reservoir.

So obviously I will have to change the led count from 60 to whatever it is that’s on the strip after I cut it. Correct? Hopefully……..

I ordered 2 strips of Waterproof WS2812 LEDS one with a 60 LED count, One with a 144 LED count. Again in theory either should work as long as I change the LED count in the sketch accordingly?

I also “get” the part in the code, on how to tweak the colors.

So simply put, where can I get the the code, for the examples I gave from beginning to end, simply copy and paste into a sketch, save it, use it, and works?

Looks like you’re starting an interesting project (send pictures when you’re done!!).Yes you’d have to reduce the LED count to make it fit the strip/LED count you’re actually using.The examples can be found in the code here as well. There is pretty much no overhead in my code – I just made it so it can be used with both libraries.

As for combining effects, take a look in the Tweaking4All Arduino Forum (goor place to ask questions too). It’s not super extensive, but this topic for example discusses how to put multiple effects together. For most effects, it’s a matter of copy and paste, for a few others it takes a little bit more work … but it can be done!

I don’t think I’m going as far as combining effects. Just switching them around as the mood suits me. I’ll definitely be posting up some pics soon as I get things up and running. Might even do a you tube videos on the build too.

Looking for major help, I have made an intinity mirror which is using 205 ws2812B what I would like to do is use the fire sketch (which i can of course) but what i cannot do or maybe its not possiable is to have 2 starting point with the flames using 100 leds.

starting point (1) leds 1 to 100

starting point (2) leds 205 to 105

The idea is that it looks like the flames are starting at the same point and lapping round the mirror

I really enjoy working with the arduino and leds but sometimes its so bloody frustating :)

If you think its not possiable let me know as i will then give up on that idea, on a postive note if it is any help would be much appreciated

Thank you for your reply, if they were the same for a start then I dont think that would matter if I like the effect , I was trying a sort of New Kitt with the flames instead of the chasing lights but you guessed I could get it to work

I’ve been trying to utilize your hint about random numbers in order to run different functions every time I switch on the arduino, but I keep getting error messages. I try to tie if and if else statements to different functions and numbers but I’ve been unsuccessful. Can you please let me know a better way to think about calling random functions?

A while back I posted about using an RS-422 ic to extend the wiring between and arduino and a strip of addressable LEDs to 1000 feet.

Since then I’ve added remote control using a Sony IR codes, a music interface, and made a high power LED pixel using a WS2811 IC and power Mosfets. I was thinking of making an arduino shield that would contain these features as well as a circuit board to make the high power pixel. I put a video on youtube that shows the music interface in action and the high power pixel thats made up of 3 watt red, green and blue LEDs.

i appreciate you taking the time to upload this, alot of it looks cool, but… i am very much a beginner to this and it looks very unfriendly to me, i have tried with both NeoPixel and FastLED library, and get the same errors no matter what, yet, virtually no explanation on how to fix it :( i get either, NUM_LED not defined or SetAll not defined, and it is frustrating me :(

i have a strong of 50 WS2811 12mm LEDs i want to make use of for christmas :(

Hey,I’ve been playing around with the Fire code, i’ve been running into problems getting it to start and end within a pixel range.Any idea what I need to change to achieve this?Thanks for all of this has been really helpful!!

You should open the lightita.ino on the Arduino IDE and the effects.ino should be opened automatically on another tab inside the IDE. The effects.ino file contains all the effects, I separated on two different files to keep things organized.

Although a very cool and fantastically laid out article, I find a lot of the code needlessly complex. To me, the big no no’s in an animation that may have button or other controls include:

Nested loops

Floats

Blocking delays

My other big issue is counting pixels up and down and I’ll use the cylon as an example. Why have all that code to count up and down, when you could just use some basic high school math and use sine waves instead? You could use it to go back and forth, you could use phase shifting and have waves, you could clip it and so on. In addition, with FastLED’s beatsin8() function, you don’t even need delays at all.

thank you very much for your input, and you’re right about the ability to optimize this much more. If I’d be writing this just for me, things would look very different. However … the intend is that everybody (as far as possible) can follow all this just fine, or at least with minimal effort. And yes, there is always room for improvements, and I’m very open to that, so please feel free to post modified sources that have been optimized. I’m confident that certain users will definitely be interested.

Also keep in mind; I’m trying to target everybody and I have found that explaining a sinus to my 11 year old nephew proved challenging, not to mention that quite a few users have no programming background.

I would like to invite you though to post optimized alternatives here – It would be welcome for sure.

Marvelous amount of information – thanks. I’ve bookmarked your site for additional reading.
I am into light painting photography, using tri-color LEDs for years, with a bank of logic switches to control color. Just read a magazine article about Arduino’s and have gone crazy looking for new light patterns and codes. I have a two part question:
First, I want to build several light painting props, where I can turn on a “GO” switch and then select one of the switch positions of a 4 or 5 position switch. Should I go with the “HIGH/LOW” logic or put resistors between the 5 positions and push 0, 1.25, 2.5, 3.75 or 5 volts to the input and do voltage logic?
In either case, what would the: if, then else logic look like, directing the Arduino to run program1 … program5?
I went to the forum and read imdr5534 logic, but that was for a system generated number and not a selected input.

I’d probably go for using several pins and maybe a rotary switch. You’ll need a wire from GND with a resistor to a pin or several pins (see basic diagram here – you’ll find some basic code there as well on how to read a switch/button state), then a wire for each pin to a switch which shorts to +5V. I’d probably consider using a rotary switch so we do not switch multiple switches at the same time.

Thanks, That’s the way I was leaning, but with only a few weeks of coding, my first test loop was only working for switch position 1 and 2 and not 3, 4 and 5. It may have been a bread board or jumper wire issue too, now that I think of it. Adafruit has an article on using pixel strips, to paint with, search for: Jabberwock.

I’d go with what feels right for you, especially when you’re just starting with the Arduino.You can always try to find more elegant solutions once you get more experienced with Arduino coding – at least that’s how it works for me. This way I get a better feel for what I’m doing as well …

I’ll take a looksy and see what Jabberwock stuff I can find (some links I found so far: Overview, and this one). So far I like it

You helped me a few years ago with a sketch and now I’m back for more. . I’m making a cloud lamp and I’d like to have a lightning effect inside. I have an Arduino Mega and a short strip of WS2812B NeoPixels. I want the effect to be random, like real lightning. For example, three quick flashes, dark for several seconds, then a slower flash fading up; that kind of thing. I thought I could edit the strobe sketch or the Halloween eyes, but I don’t understand how to use the random function. Would love some help!

Where the first 3 parameters define the color (0xff),The 4th parameter sets the number of flashes (10 flashes),The 5th parameter sets the delay between flashes (50 ms),and finally the 6th parameter determines how long we’d like to wait after the flashes have been done (1000 ms).

So this function is responsible for a one time effect. In the example: 10 white flashes with 50ms pause between each flash, and once done a 1 second delay (1,000 ms = 1 second).

Now, since it’s placed in the “void loop() { … }” this function will be called over and over again, with the same parameters. So just a rinse and repeat of the same effect. To add randomness to this we could modify the function call and use the Arduino “random()” function.

An illustration how we we could use this (can be done much more compact – but this way it’s easier to read and understand):

In the beginning of the sketch, just before the “void setup {” line, define the following variables:

Note: the Arduino doesn’t really do random numbers very well, since it always starts with the same “seed”. We can however change the seed by a more random number whenever the sketch starts by adding the “randomSeed()” function to the “void setup() { … }”.

void setup(){ // if analog input pin 0 is unconnected, random analog noise will cause the call to randomSeed() to generate // different seed numbers each time the sketch runs. randomSeed() will then shuffle the random function. randomSeed(analogRead(0));}

Just an idea to add more randomness to the whole thing: make the color brightness intensity random as well:

You might notice that I introduced two things here. First of all “random(x);” produces a random number between zero and x. “random(x,y);” generates a random number between x and y. You might want to use that in the other variables as well, to make sure that a minimum delay is observed.The other thing I did is set the color to “red, red, red” – I’m packing a random number between 30 and 255 for the variable red. Since you might want to keep a “white” like color, we would need to have red, green and blue to be the same number. So I’m just recycling the variable for green and blue as well – I hope that doesn’t make it too confusing.

Thanks! But I need some more hand holding, I’m afraid. Are you suggesting editing the Strobe sketch? I added the six suggested lines to the top of the sketch and replaced the void loop section as you wrote. But I don’t know what to do with the other two sections of code, void setup and void loop.Claire

FYI, I pulled the code from the Forum page and pasted into the Arduino editing program, made a the changes for NUM_LEDS and PIN and tried to compile it – got a couple of error messages (240 and 300?). Did a re-type of code and still the same error messages and then I stated to look at the “error lines” and found several referenced lines as blank lines, more online searches and found copy/paste can add hidden code. So if the error referenced line 15, I did a control L and enter 15, moved the cursor to the stated of line 16 and hit back space until the cursor was at the last character in line 14, then “enter”, “enter” and that error line disappeared. After doing this several times, the Forum code worked beautifully, so I started to tweak the code for my “Light Painting” sticks.

Could find a place to comment on the Forum page, so I’m doing it here.

You’ll have to register (free) to be able to post comments in the forum. It’s a little inconvenient, I know, but unfortunately a fully open forum invites spammer and script-kiddies to come pollute the forum with none-sense, trolling, advertising, misleading information, etc. — my sincere apologies that I made it that users need to sign up …

Anyhoo; you did indeed catch the issue with the error codes.As mentioned below; copy the code, paste it into Notepad, copy all from Notepad, paste it into your Arduino IDE – this should strip all excessive characters.

Under what operating system did you see this happen and with which browser?(can’t reproduce it with Google Chrome on MacOS)

Hello, i am a beginner with WS2812B LED strips with an Arduino nano and I would like to use the KITT effect. I try to use it but I get an error. Are you able to help me please, thank you. The error message is:Arduino: 1.8.1 (Windows 10), Board: “Arduino Nano, ATmega328”

first off the friendly request to post large source codes, logs, or other lengthy outputs in the forum

Coming back to your issue: I suspect you might have copied and pasted the code into the Arduino IDE?The “stray ‘\240′” and “stray ‘302’” refer to characters in your code that may not be visible, but do interfere with the code.I tried finding some reference for you: this is one at Stack Exchange.

Now, what I usually do (I assume you’re working under Windows) is copy code, then paste it into Notepad, select everything in Notepad and copy it again. Now excessive characters are gone … now paste it into your code editor and try again …

I would like to ask you if it is possible (how) to change the colour of the moving strip from red to another colour on the cyclon effect. Also how can I do it so the strips start moving from both sides and bounce like this one but from both sides not just one. So it would look like this:

——–> <——–

<——————>

——–> <——–

Explained:

From both ends the leds will move towards the other side passing each other in the centre (not bouncing apart) then at the ends they bounce back and pas each other again etc.

Thanks, I hope you can help me as that would be amazing (I’m only a beginner so need to learn these codes)

Changing the color of the running LED is easy. You can pass it to the function in the “void()” section.For example:

Red:

CylonBounce(0xff, 0, 0, 4, 10, 50);

Green:

CylonBounce(0, 0xff, 0, 4, 10, 50);

Blue:

CylonBounce(0, 0, 0xff, 4, 10, 50);

The first 3 parameters are hex RGB (red green blue) colors (see also the color picker in this article).

As for your second question; this is kind-a what the New KITT effect does, just a little more elaborate.You’d have to modify this a little bit for the NewKITT() function (so copy the NEW Kitt code and replace the “void NewKITT(…)” function with thsi):

That is kind of what I wanted, but I wanted it to not bounce apart in the middle. Like the Cylon but from both sides so it will start on left and right and go to the opposite sides and then bounce at the end of the strip and bounce back again to the opposite sides instead of bouncing in the middle.

I think I know what you might mean haha … so we have 2 “runners”, one starts on the left and bounce on the right, back the to left where it bounces again to the right etc. In the meanwhile the other one does the exact opposite?

Hi, i need some help. I’m clueless when it comes to programming so I’m kinda lost. I have an issue, whatever is meant to fade out and then in to change, is blinking and changing instead. Is my strip faulty, or am i doing something wrong. Using arduino nano clone and ws2812b 5050 led tape (60 led), Arduino nano, ATmega328

I’d first see if the LED strand test works, just to make sure Arduino, LEDs and powersupply play nice.I have only played with the Uno, and I tend to stay away from clones since they can create all kinds of issues.

Thanks for posting this though, since others might run into the same issue!

As for the forum; maybe this is browser related as well – I have not tested Microsoft Edge with my website yet.Would you mind checking again? When logged in, you should see (at the bottom of a topic) a text editor to post replies.

Hello Hans,First, thank you very much for this superb page. (The best on the web ).Difficult to find information on the implementation of “NeoPixel” (Adafruit).

I am a beginner in programming (Arduino IDE) and I realized an e-textile project (ATtiny85 + 1x LED RGB WS2812B) with one of your script (NeoPixel) that works well.

The base comes from: “Blinking Halloween Eyes”. (My script not posted as requested).But I would like to work with 2-3 colors like: “Fade In and Fade Out Your own Color(s)”.

Since “Blinking Halloween Eyes”, so I would like to add 2-3 colors and a Fade-in. (Existing Fade-out).Currently I come back with another color with function: [setAll(0,0,0);].I want to keep the random side for the whole !

I tried to mix these two scripts unsuccessfully. Can you help me ? Thank you in advance – I would be so happy.(If it’s simpler with the “FastLED” Framework. I can also try).

Greetings from Switzerland PS: My current project uses only one LED RGB, but in the future why not 2-3 LEDs – which would have a different sequence.

First off: thank you for the very nice compliment – that’s always appreciated and definitely a motivator! Thank you so much for observing the code posting request, if you’d like, you can post the code in our Arduino forum.

I’m not sure I understand what you’d like to accomplish though (sorry – it’s early in the morning here so I probably need more coffee) …I guess I’m getting a little confused; do you want a each “eyes” to appear in different colors?Or a different color to fade in/out? And you’re using only one LED? or one LED Strip?Since I’m sure I can help, I did start this forum topic so we can chat about code and how to implement it. (you’d have to register, but it’s free)

I registered yesterday and had the same issue you have. Seems that admins must approve your account before you can post on the forum.I could not create a topic right after registering but this morning it was ok.

I’m sorry to hear you’re running into issues with the forum (I’m getting pretty fed up with the forum software ).Admins do not need to approve your account, but I did notice that on rare occasions a page needs to be reloaded for the text box to appear so you can add or reply to a post.

Please let me know if you run into more issues with the forum – I’m already looking for a replacement forum.

I noticed that sometimes the forum is acting up, so I’m already looking into replacing it with another forum.Occasionally the user has to reload the page to be able to post a new topic or reply to a topic. It’s quite aggravating since I can’t seem to find a fix for it.

Hello Hans,After many tests yesterday – I’m now logged (Yesterday by selecting a link in the history of the browser, I was logged – but only on this page of course – Then by clicking on the link of the other subject I was losing the log-in).

The problem: when you do the log-in, the Menu at the top right is always as if you were not logged in. (You do not see the user – [User Menu]).It seems that at this moment, by making a refresh of page one becomes logged !Then I repeatedly got the message (Top of Chrome): “WebGL encountered a problem” – [Ignore] [Refresh].(Never seen this message before with other sites).To be continued…

After log-in according to the trick: refresh the page, I have posted 3 times without success !The image I wanted to attach was too big !? (Max 4MB).I went from 3.6MB to 1.5MB then 960KB – Every time with the error message (Chrome):

Request Entity Too Large:The requested resource/forums/topic/blinking-halloween-eyes-with-different-colors/does not allow request data with GET requests, or the amount of data provided in the request exceeds the capacity limit.Additionally, a 413 Request Entity Too Large error was encountered while trying to use an ErrorDocument to handle the request.

I attempted to send the image alone (960KB) with the same error.My Post is now Online – but no picture

I think you saw, I was able to download 2 images (2.7MB and 450KB) without problems. (Chrome Win7Ux64).Your changes seem to be conclusive PS: I can now read: “Your account has the ability to upload any attachment regardless of size and type.”

I wanted to thank you for all these examples, it made me want to have fun with those LEDs. I actually had a DAC project ongoing and I’m using these ideas (and the way they’re coded since I’m in uncharted territory here).

I actually have a problem but since I modified the code to fit my plans I’m going post my code on the forum so anyone can help me understand what’s wrong :D

Thanks again for the ideas and the very well explained code there is on this page, it is very educational.

It seems that dutch people inspired me on this project since my DAC board is based on Doede Douma DDDAC with differences on components (all SMD to gain size). an output buffer has been added as well as a FIFO buffer followed by a reclock board.

First, context. I’m making myself a DAC and I was looking into VHDL and PWM for a little while but as I expected, last time I used VHDL was in school more than 10 years ago and I suck a lot at it! I have a bit better knowledge of C.

Back to subject of interest. I found this article which made me hopeful (almost a better man!). My idea of the result goes through phases (I used switch/case ).

1st phase: Start-up lighting to actually signify to user it started. I used fade in/out code, I only modified the brightness increasing with sine wave instead of linear.2nd phase: RaspberryPi starts and look for a connection to my NAS. I used twinkle effect.3rd phase: When NAS is found, the RaspberryPi updates its output and my arduino goes back to almost the same fade in/out as in phase 1 except it doesn’t go back to LEDs off but stays to 50% (I don’t want too much light and I like how it looks to go high and a little back down).4th phase: Steady lighting at defined brightness. If connection to NAS is lost, it goes back to phase 2.

Seems nice but it only half works. phase 1 and 2 works perfectly fine but when I connect my wire to simulate the input from the RaspberryPi it goes crazy. It’s like the switch/case is broken and I have all code executed at the same time and it looks badI could make a video to clear things up if required. I’ve got to mention I don’t arduino but a smaller Adafruit Pro Trinket with 10 LEDs.

I just uploaded, to the Forum, my modified Button Cycle .ino, where every time I press a normally open switch, the sketch jumps to the next loop (case) segment and does a different light pattern sequence. The problem is if I am doing a photography workshop and the people want loop #5 repeated, I have to power down and restart at loop #1, pressing the button time and again until I get to loop #5 (each loop creates a 35 second light show). I have tried to modify that sketch to take a keypad input of 5 to jump to that case (Keypad_Test), but I have two (2) lines that keep giving me error messages. I have re-typed those lines and many other lines above and below the error lines, plus lines in the define section and have cleared many other error messages (I’m using Windows 10) and from previous posts see where I should have possibly saved the code to Notepad and then copied it into IDE. If that is the answer, then so be it, but if I am doing something stupid, then tell me – thanks.

I solved the issue, with the 2 lines of code that were giving me error messages, it seems that “Fat Fingers” had creeped in and I had an extra character in the define line. I now have a working 3 X 4 matrix keypad., where I can press any one of the 12 keys and that case/loop runs. A sample video has been posted on YouTube https://youtu.be/t14OyY58YNY and I’ll post the full code on the Forum page https://www.tweaking4all.com/forums/topic/lightning-effect/

Sorry. I now to coding and i am zero. Of course i have a long road to go and for now i m just trying to het the logic. I just want to ask this ; i see j and k and i integers. I didnt get what are these because i dont see that we define these letters as integer names in void setup. Are they predefined in library or what? Thanks. Sorry for my english. I m not native talker. So i guess u also understand why its hard to understand that kind of articles for me.

So for example, a variable that needs to be available everywhere, is defined way at the beginning of your code.If the variable is only needed in for example the “setup()” function, then we define it only there, ideally in the beginning of the code.If however, the variable is only need briefly, for example for counting in a loop, then we can choose to define it right there (as seen in the example).

Yes Hans i see int goes for integer but i disnt know we Define k in here. I was thinking we Want k to do something in ur code. So its a Define code, not a Do code. Umm okay. Thanks for ur very fast reply that was so nice of u. I will dig on that in my mind. I m a newbee. Thanks again. I guess i need another article that teachea Coding from zero and the logics of it.

No worries, we all had to start at some point in time … This might be helpful to get started: Arduino Programming for Beginners.I wrote it for those with no programming experience, so maybe it’s helpful for you as well.Enjoy! And feel free to ask question if you have any (either under the related article or in the forum).

Wow. This cant be real. I email and wrote so messages on some websites and i wait for days long but was no reply. And you show me road to start and tell me to feel free to ask if i have some to. My friend i would like to give a handshake to u. I m so happy to hear this friensly sentences from u. I do thank you. Now i have more energy to sit and learn this. (I am web&graphic designer and in love with electronics from childhood times and i want to combine them in my interior design lighting projects). Peace..

I got my Arduino unit mid-November and beat my head against the wall too. My best advise is think of coding as a good book – Introduction, Table of Content and the individual chapter or chapters.

What I wanted to do was create a “Light Painting Stick” for photography, where I could press one of the keys, on a 3 X 4 keypad and have that sub-loop/sketch run. With a few comments from Hans, it all came together for me and if you read the above Feb. 5 post, there is a link to the finished code – enjoy this site.

If I understand correctly, you want LED ‘0’ (first LED) to be red and the last LED to be violet? If so consider defining each of the 16 LED’s like this (you need to enter color code as desired). This is copied from another program, so verbiage may have to be changed to suit. Have to run for an appointment, but will check later today.

yes, i want LED ‘0’ (first LED) to be red and the last LED to be violet which show out at the same time in 16 LED’s. But the colors are not run in the 16 LED

But the above code, where can i put it?

Otherwise, i want to adjust the code. when i load the program to my arduino, my other function I2C display can not show out out and detect sensor must delay to read the data, can you give me some suggest?

Candy; you’ll just have to expand this to 16 LEDs – you can use the color picker and split the hexadecimal number into 3 sections. For example B5FF8A would become (the first parameter – 1 – is the LED number):

strip.setPixelColor(1, 0xB5, 0xFF, 0x8A);

So B5FF8A becomes: B5, FF, and 8A. to let the Arduino know this is not a normal number, but a hexadecimal number, add “0x” (zero-X) in front of each of the numbers (this would save you from having to think too much about hexadecimal number and convert them).

I’m sorry that I had to remove all the code you posted, but this became a little too much for the comment section.Could you place your question in our Arduino forum please?I’d be happy to take a look and see where I can help. But with long codes being posted here, other users would have to scrolls for days to find something.

Your next question is to combine the code with controlling a display and reading sensors. This makes things a little bit more complicated and we’d need to see the code for those peripherals. Since this might become a rather longer topic, I recommend starting a topic in our Arduino Forum.

Hi there, I’m very new to all of this. I have completed the strand test and uploaded a couple effects. My question is: if I want to make a standalone strip that cycles through effects with the push of a button, where would I begin? As in, I want to give the whole assembly a power cord, and just use a button to cycle through effects, how would I do so?

cycling through effects has been requested a few times (which makes me want to write an article about it, but simple do not seem to get to actually finding time to do it). A few users have been working on the same question in the Arduino Forum – that would be a great starting point.

Ben, thanks to a few comments from Hans, I have created several different light painting sticks, using the Arduino Uno Board and either a 12 button keypad, a 5 position switch or a normally open push button (9 sub-sketches). Sample video’s can be seem on my YouTube page “Gerald Bonsack”. I have found that as the 9V battery gets weak, the Arduino wants to do it own thing and not follow my written code. I have posted one or two of the .ino files, on the Forum page and will post others, if requested. For the 5 position switch, I have the 10k resistor between the ground and the common connection between the 5V supply and the switch – output from the switch goes to INPUT PINS, on the board. Since I started playing with the Arduino only a couple of months ago, my code my not be pretty, but it works.

Hello! I am trying out these sketches using an Adafruit Trinket as my microcontroller. For some reason, no matter if I try the Neopixel library, or the Fast LED library, all I am getting when I upload any sketch, say the Fire sketch, is just all white LEDs. The Neopixel sketches from Adafruit work fine. Any ideas?

ehm, I’m not familiar with the AdaFruit Trinket. As far as I can read from the specs, there is a 3V and a 5V version – so it might be related to that, since the LEDs might expect 5V for their data, then again, you said that the NeoPixel examples do work.

The next thing might be in the initialization – verify that with the ones used in the NeoPixel examples:

Thanks for the reply. I will say upfront, that I am a Arduino newbie. However, using the code you posted gave me the white LEDs again. I compared that code to a working Neo Pixel sketch, and noticed some differences that pertain to the Trinket. I modified the code with those bits, and now when I run it, all the LEDs go black. Here is the modified code:

I’d assume you have to bring that over to the demo code from this article as well, which would make it like so (note: your code says PIN 0!):(I hope I got all the differences, and this would be the “base” code of course – just didn’t want to post very lengthy code, that would be better in the forum, if we want to continue the topic)

Thanks for all the help Hans. I’ll look back into it once I get another Trinket in.

My original intent was to use the Neopixels to fix the lighting in a friends jukebox. Most of the lighting effects on it were made by using fluorescent tubes, and color wheels. The color wheels have long since quit working, and are expensive to replace. I like the fire effect example here, but as I wasn’t able to get it working (yet), so we went with another fire effect I found @ Adafruit. Anyways, the end result looks much better than I anticipated. We ended up using two of the Neopixel rings for the “ends” of the top of the jukeboxe, a strip behind the “compact disc” area, and two strips going verticle up the leg areas (that’s where the fire is). I still think the fire example here will look better, and once I figure it out, I can easily upload it.

Yeah I dabbled for a bit with 3D printers, and have to say that I’m probably not patient/accurate enough to work with 3D printers (LeapFrog) just yet haha … Maybe one of these days I’ll pick it up again.

hi im new to coding on Arduino but iv been trying to do the KITT effect (Cylon) for ages and just found this site yesterday iv managed to get it working but not liking the look of the KITT effect when i slow it down, iv set the speed to about “70” as i want it to look like the real KITT car but i can see the LED’s are not fading into the red as its going along.. it looks as if its just turning the led’s on from 0% brightness to 100% also the faded sides of the eye that I’m guessing jumps from 0% to 50% brightness.. so my question is can i make the effect better by fading the LED’s in as they go along.. for example each LED will not jump straight to 100 instead 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% brightness.. any help il be much appreciated.

that would most certainly be possible, maybe we should try to find a video that displays the 100% correct effect.I did play a little with fading (happened to be for a bouncing ball project), and selecting 10, 20,…,90, 100% is a little tricky since brightness does not behave in a linear way with LEDs.

I just started learning how to use the arduino, my idea was to have custom led configs on my pc case for fun, and I found out learning arduino with 2812b leds is a much better way to do this than lets say buying a retail product like NZXT Hue+.

I have a question, I got it all working, but I need a way to either update the arduino data to change effects.

Is there a way to have many effects on the memory and by an USB command change between it? Or perhaps a way to double click a shortcut and it will directly upload a sketch to it?

glad to hear you’re having fun with these LEDs as well.In our Arduino forum, you’ll find a few topics covering the combining of all effects in one sketch.I’m planning on writing a dedicated article for that, but just simply haven’t gotten to it yet.

So, it’s very well possible, just might take some work to get it going …

Please note that I did not have the opportunity to test this code, please let us know how well this does (or does not) work.Also note that I changed the variable names to make it more readable, and … keep in mind that I might have made typos …

Also keep in mind that the original code only uses 3 LEDs (see comments in the loop() section).

Thank you thank you thank you!!!!This did exactly what I was looking for, I’m just starting with Arduino, neopixel etc, so I’m still trying to figure out coding things so this is a HUGE help.Thanks again!

it depends on what RGB strips you’re using. The WS2811 and WS2812 are RGB LED strips running on 5V (typically). There are some cheap knock offs that use a different color order (GRB for example), but in essence that works just the same.

I just ordered some strips from AliExpress – I had ordered from this seller before and they work very well.They are also very affordable. See this link.

I always pick the 5 Meter strand with 60 LEDs per meter, with black PCB and IP65 (5M 60 IP65).

The LEDs are waterproof and casted in some kind of solid transparent silicone, which makes it very well protected against dust, water, bugs etc etc. It also makes it look really nice with the black “PCB”. It’s $22.73 for a 5 meter strand – different sizes are available – at the time of this writing.

if each color works, then white would be when all colors are ON.this should work for all types of LED strands. Now if the strand is not really a WS2811, it might become tricky to control the LED colors. Quite a lot of sellers advertise wrong or misleading information. Did you try some test code from the “Controlling LEDs with Arduino” article?

Hi tweaking4all.com. My English translator level is Google, I apologize for the mistakes.

– I googled a lot about LED on WS2812b, and came across your magic site, which helped me a lot in mastering. But I have a few questions, tell or send me to the desired section of your forum.I
downloaded “AllLEDEffects-FastLED” unlocked ALL effects, but in the
case of “Bouncing Balls Multi Color” and just Bouncing Balls it stays on
this effect and that’s it. In the case of “Fire” if something is unlocked in addition to this effect, then “Fire” simply does not play.

Questions:1. How to remove these shortcomings?2. How to make a random effect switching time, or every 10 minutes?3. In the “Bouncing Balls Multi Color” effect, do random colors?

It is best to start a forum topic in our Arduino forum for this. I monitor this daily, and it would keep off-topic and long source codes away from these comment sections.Do however feel free to post the link to the forum topic here to grab the attention of others.

The project i m working on is stair project one PIR sensor bottom stair and one top so when bottom sensor activate the light start from bottom to top when top sensor activate the light start top to bottom and also how to do the wiring also thx

Could you let me know which Operating System and which browser versions you’re using?I have seen the videos causing issues with old Android devices, but with Windows and Mac I have not seen any issues yet.

Hello friends!I
have very little knowledge on the subject but, I would like to join
several of these codes mentioned in several strips of Led, say, 8;Therefore, how can the code be assembled in this way?

I’m a complete novice with Arduino and Neopixels, and by novice I mean I’ve never coded anything before! I’ve picked up some bits and pieces but I’ve found that most tutorials jump through stages without actually explaining the basics, pretty much just copy and paste code which isn’t great for learning! I’ve been attempting the Rainbow Cycle sketch but I get an error message saying the the number of LEDs has not been declared, where do I put this value in the code?

I’m also hoping to loop 5 rainbow cycles and then run a colour wipe through every colour on my RGBW Neopixels before returning to the rainbow cycle, is this possible to run on the Arduino as one sketch?

As you might see; I combined the code of both effects, and call them in the loop().It does the 5xrainbow, wipe for Red, wipe for Green, wipe for Blue.After it completed that, it will do the loop again, so effectively do 5xRainbow, and 3x wipe.

Keep in mind that the code needs to be pasted in the framework, replacing the text between the lines (maybe you forgot that earlier):

// *** REPLACE FROM HERE ***

and

// *** REPLACE TO HERE ***

If you want to add more colors, you can add a line like this for each color you’d want:

colorWipe(0x00,0xff,0x00, 50); // red, green, blue, here: Green

If you want a ton of colors for the colour wipe, then consider using for-loops (see also the little course).For example:

I’ve been messing about with all of this and I seem to be getting a warning message saying that I have created a compound expression list after dealing with a declaration problem, will this cause any problems with the neopixels? See below;

Question: Using the “Fire” code to create a flame inside an outdoor lamp post w/diffuser to simulate a flame. I’d like to change the flame colors to have more orange and less red. Also would like less white and more yellow? Could you recommend changes to the Fire code to modify the output as such?

I have not tested this, but in the last procedure used by the fire code (setPixelHeatColor()), you could play a little with the “Red” value when the pixel colors are calculated, worse thing that can happen is that the colors will be off

there have been a few requests for this and some of the users have worked on it in the forum – however, it will take some work and reading to get this done, which might not be the easiest for a beginner.

If users could tell me how they would like to see then, then I’ll try to create code to include all effects.Do we prefer toggling effects with a push button? Or based on a predefined pattern?

thank you for the very nice compliment. It’s very much appreciated and definitely a motivator to keep working on more articles. And the relaxed attitude is what I’m going for. I like to show folks how things can be done, in a fun way. The more folks that participate with the same mindset, the more fun it will be for all of us …

Thank you for sharing your fantastic work. I arrived here after searching or neopixel fire. I wanted to bring a big picture of a rocket to life on my sons wall. I plan on using a shorter strip, so I think with a few little tweaks your code will be work great for me.

I love the other effects too, so I’m going to have to think of where I can use them.

Hi, and thank you for your examples they really have made it easier for me to get some good effects as I start getting my christmas led displays ready (it’s my first year doing my own). And in response to Daniel and Dhiraj’s question, I have created a single sketch that includes all your examples as their own functions and then call them in the order I prefer in the loop section, I now have my pro-mini running my first example string with hours of different effects before they get repeated. These have saved me a huge amount of time and I can’t praise you enough. Thank You. :)

That’s awesome and thanks for sharing!Feel free to post the sketch if you’re comfortable doing that – once I get the time to play with that, I’ll try to write an article on how to do that and your input would be very welcome.

Here is my sketch that I have been using to get the timings sorted out (Sorry if it is too long), I have had to make a few adjustments to your demos to prevent infinite loop in BouncingBalls and BouncingColoredBalls , which is now simply a for loop which runs the amount of times specified in the extra parameter “timesToRun”. Also there are some short routines that would need a for loop in the main loop to make them run a certain amount of times (like I have done for the Fire function). I also added a colorWipeReverse function which as the name suggests simply goes the other way.

You will notice I have a couple of Serial.print(millis());, one at the beginning of the main loop and one at the end, this is to tell me the timing of each loop as I change settings. I am doing that so that I can set each effect to last X amount of time.

There are a couple of other changes you may find from your examples although I did not make note of what I was changing but I’m sure you will spot them.

I hope this is of some use to others as it is just the beginning of setting my own strings, so not perfect, but usable.

And just a note about hardware, I am using Arduino Uno for testing (as it is easer) and then a pro-mini in the actual project. The led string I am using with these have 3 leds from each ws2811 IC so the 14 pixels listed are actually 42 on the test string, this may make the timings I have used a little more understandable.

You see the two for loops? The first one cycles colors (j), and the second one addresses each LED (i).Instead of doing a color change for each LED, I moved the color selection out of that loop (i).So it selects a color and then applies it to all LEDs.Now, I did not test this (I’m traveling) so it might need a little tweaking, but it will get you started.If you have a working sketch, then please feel free to post it here.

I have this sketch that is part of a sequence I am testing at the moment, not a finished one but might be useful to you. Obviously you will need to change the settings for your own pixel type and quantity but it works on my test strip. You can change the colour sequence in the sketch in each “colorStep” using RGB values.

I see you have used the ws2811 in your sketch, and I’m fairly new at this, so please bear with me.

I’ve been running various test sketches using WS2812 and a 144 pixel strip. Fascinating what can be done with one data wire!

If you have a couple of minutes, could you comment on my question, below?

If I were to change “#define NUM_LEDS 14” to “#define NUM_LEDS 144”, and “LEDS.addLeds<WS2811,DATA_PIN,BRG>(leds,NUM_LEDS);” to the specification line for the WS2812, could I expect the sketch to work?

It will work just fine with the 2812 as well. You are right though that some of the settings need to be modified to match the 2812 and the LED count you’d like to use. The “addLeds” line might not need to be changed, since i seem to have used that as well even though I have a 2812 strip hahah …

Just to add that if you copied my sketch there would be some that I have changed as I have got used to using decimals for the brightness level and have changed some of them to make it easier for me to understand.

Multi Color Bouncing BallsHi !Could show me in the code of “Multi Color Bouncing Balls” how to invert the show. For easy wiring of my strip led , I want that the first led is the number 15 ” Starting led is 15 instead of 0″Please explain me !thank a lot !fred

Only one line did get changed, where we simply flip the LED order by subtracting the original position from the total number of LEDs.So position 0 becomes 15-0=15, position 1 becomes 15-1=14, position 2 becomes 15-2=13, etc.The “-1” is added since we count 15 LEDs, but we humans start counting with “1” where as the LED array starts counting with “0”.So the 15th LED actually is position 14 in the LED array in the code.

This way the “gravity” will be slightly different each time the function will be called.I have not tested this, but this is what I’d play with – maybe the notation of the random float can be done better. It basically adds 9 + “a random number between 0…99 divided by 100” (so we get a fraction of “1”) and after that make it a negative number, so that -9.81 is a possible outcome. Or better set -9 … -9.99 is a possible outcome.

I am new to Arduino. I want to add multiple sketch in one . How can I do this. As a Arduino can run only one sketch at a time. If I want to run multiple led function in one sketch then what is the solution for it?

You can only run one sketch on your Arduino at a time.To get the multiple sketches to work, you’ll have to rewrite the code so all of it is in one single sketch.In this case (LED effects) you’ll have to combine them, like for example in this post.

First off, thanks for the really well written and highly nutritive tutorial. I’m using the FadeInOut code broken up into two chunks like below. Curious as to how I can change the speed the leds fade up and down. Very new to Arduino and coding so my attempts experimenting with different values have resulted in undesired results. –E

first off: thank you very much for the compliment, it’s much appreciated!

As for changing speed, the procedure you use is pretty much at the max of it’s speed.We can delay it though by adding delays in the loops, for example by using the delay() function. Of course it would be nice to be able to pass the “delay” value in the function, so I modified the functions a little bit to accommodate that. The delayvalue is expressed in milliseconds (1 second = 1,000 milliseconds).

If I’m understanding correctly that would add a delay between the fade up and fade down. What I would like to do is slow down the time it takes for the Led to go from black to the desired brightness level and correspondingly light to dark. I’m using the code in a motion activated light sensing night light. So, fading on and off slowly is what I’m after.

No this would add a delay between each color “step”, effectively making the transition slower. So FadeIn and FadeOut would be slower, depending on the value you pass for “delayvalue”. Give it a try. DelayValue-0 is the same as the original speed. DelayValue=1000 will make it that the fade will take about 255 seconds (dee the “for” loop).

Thanks for your easy to follow no-nonsense explanations, very straightforward to follow.

I want to build some hanging outdoor Christmas decoration with my children (to get them interested in electronics and coding), using either Adafruit DotStar LED strip APA102 144LEDs/m or Adafruit NeoPixel RGBW 144LEDs/m and a 5V DC Trinket Pro (small size, easy to waterproof). I want to drive three two-metre strips independently (same effect, but different velocity/randomness). Does this mean I need three 5V DC PSUs and three Adafruit Trinkets? Or is there an alternative solution to drive three strips independently but from a single larger/more capable microcontroller?

On another note – what is the limit of the length of cable if one wants to keep the microcontroller and the LED strips at a distance, say, four metres?

Well, the easiest would indeed be with 3 Trinkets yet. Two major challenges might be, when using just one, are:1) Addressing the LEDs in 3 blocks, but with some coding tricks that might not be the hardest part.2) Having the effects on the 3 “strips” behave indecently. Arduino’s are usually not use in a multi-task setup, so they usually do things in sequence. Again, with so code skills you could consider using interrupts, but I’m sure that would make it difficult and possible undermine the enthusiasm of your kids.

As for the length, I assume you mean the wires between Arduino and strip; 4 meters might work just fine. It will be a matter of testing, but I wouldn’t expect any issues.

Sounds like you’re ready for a cool project – your kids will love it! And you’re right, don’t want to make it too complicated, otherwise they’ll loose interest and that would be a shame.Keep us posted on the progress!

I found this page while googling other led animation stuff led animations and thought it would be useful to others to know a way to have their arduino’s use a non-blocking method to display animations. I am using this to allow a button press to change animations (in progress) and so far it looks very promising. I haven’t had time to convert any of your animations yet (but I’m sure to try soon) but I do think it would work with a little tweaking.

Here is a code snippet example showing both ways to code the same display, I’m not sure if either are the best way to do this but it’s code I am trying at the moment.

That’s a pretty cool project, I’ve bookmarked it for when I get my ESP8266! I’m currently using arduino pro minis for my strings as they are cheap and can control around 600 (ish) pixels depending on the code, but I think the ESP8266 has more possibilities. I might try adjusting your code to see if I can get an Arduino Mega with ethernet board working with it. I like to code in python and think if I get this working it would mean I could use some scripting to get all the effects I could possibly need (for now anyway :) ) Thanks for posting this.

I’ve been playing around with some different effects for a few strings of NEOPIXELS running on an Arduino Pro Mini and have found that theatreChaseRainbow function will prevent any further effects being displayed. I have adjusted my effects to put this one last and it works for now but I must put it last in the list and have also noticed that the millis() count is reset to Zero after this effect finishes. I don’t know if this is possibly a memory limit reached causing a reset or something like that but thought I would post in case somebody had noticed (and maybe fixed) it.

If I comment out the theatreChaseRainbow effect then the millis() count is normal (keeps adding after each cycle). Any body have any ideas?

Also what I haven’t shown here is if you put the theatreChaseRainbow in the middle of the list it will display the effects before it but then resets after it and the following effects do not show (it starts from the beginning again without completing the main loop)

I couldn’t find anything weird that might trigger these issues.millis() will not reset until it has run for about 50 days (according to the documentation).Resetting the clock used by millis() isn’t even that easy (see this post).

So now I’m left guess, and what might do the trick is where you use “NUM_LEDS”, and use “NUM_LEDS-1” instead, so try the theaterChaseRainbow with this code (I changed 2 lines):

Thank you Hans, that has worked on a small test with only three effects, but when i put the full script in place it seems to go back to previous behaviour (resetting the millis count and starting from the beginning…) I am guessing at this point that there would be a memory full error which might cause a reset because it is not happening when I use less effects, but thank you for trying and I might have to reduce the number of effects for these strings or I might use another method to get similar effect.

Yes, I think it is a simple out of memory error, and thanks to your link I may be able to fix it using PROGMEM for some fixed variables, although I will have to come back to it when I’ve finished a few other bits .

I did try with theaterChase Rainbow at the beginning and the results are the same, that is, if I only have one (or maybe two) other effects it works as expected, but if I have more effects (and the associated Serial.print statements that I’m using for tests) then theaterChaseRainbow will trigger a restart (not directly but because of the memory issue). So I’m sure that it can be overcome with a little coding change on my part.

I thought I had better post the solution to my particular problem in case it might be of use to others with a similar issue, I decided to try and “shorten” or “shrinkify” the theaterChaseRainbow sketch and this is what I ended up with :-

This makes use of the fadeall function I am using in another sketch to turn off the lights after they have been displayed, it can be set differently to have the lights go off almost immediately to make the pattern more like the original one you (Hans) posted.

Anyway, everything is working as it should and I am again a happy bunny

We got our setup (Pro Trinket 5V and APA102C 144 LEDs/m strip) working and are now wondering how we could achieve something along the monochromatic/polychromatic “twinkle” or “sparkle” effects shown above, but more subtle and continuous, also taking into account that the brightness of LEDs should fade in/out sinusoidal or, rather, logarithmic (human brightness perception)?Here’s one code-less example of “random twinkling” that shows what we’re after… do you have some ideas how that could be done?Thanks for some hints!

As for the desired effect; I like the idea, but I have not code readily available to do this.i’d have to sit down and set everything up to do some testing to see what works best.Unfortunately, I do not have my gear readily available so it would take quite some time before I’d have code available …

You could try this sketch I think it goes some way towards what you want, it uses the TwinkleRandom sketch with some minor modifications, you can enter the fade speed using the extra parameter I added. You will probably need a longer fade value for longer strings as I have only been using this on a 14 pixel string at the moment. Also this doesn’t fade pixels in but does fade them out. Hope this helps towards finding something useful.

void loop() { fadeToBlackBy( leds, NUM_LEDS, 1); // Third variable determines how quickly the LEDs fade addGlitter(37); // Changing the number will increase the chance of a "star" popping up FastLED.show();

As for the “while(true)” – this keeps the loop going until the end of time (unless power gets disrupted of course. I did this to avoid having to look for an elegant exit.To change that you’d have to change the while-loop.

for (int i = 0 ; i < BallCount ; i++) { setPixel(Position[i],red,green,blue);
started = started || Position[i]>4; // arbitrary number (4) - depends a little on the length of your LED strip
canstop = (Position[i]<3) && started; // did we start? and did a ball go below 2? Then we exit the loop }

showStrip(); setAll(0,0,0); }

The idea being; if one of the balls has passed a position higher than LED #4 then we set “started” to true (meaning; we can now start looking for when a ball goes below LED #3). “canstop” will become true when “started” is true AND we found a ball below LED #3.Again the numbers 3 and 4 are arbitrary chosen, you’ll have to play with that to see what value works for you.

Hope this will get you started – feel free to ask questions and/or share your findings.

//Your code: //started=started||Position[i]>4; //arbitrary number(4), depends on the length of the LED strip //canstop=(Position[i]<3)&&started; //did we start? and did a ball go below 2? Then we exit the loop

Since ImpactVelocity will never be below 0, we could abuse that – set it to -1 when the bounce is done.Not sure what the impact will be of not setting the ball … but I figured it may remain “at the bottom”?Again; untested, but maybe it’s helpful …

Good morning! Thanks a lot for this awesome and helpful site. The toilet paper hack is my favourite

I used your code for my attiny85 with a WS2812 strip. A motion sensor turns the effect on and off after a short delay. Now here comes my question and it would be great if you could help me, because I want to use this for an infinity mirror as a christmas present!

Question: Do you have an idea how to go through all effects instead of repeating only one? So, whenever the sensor detects a new motion, he does not show the previous effect but a new one. Do you think this is possible?

Thank you very much for your answer! It worked out and my parents-in-law were very happy about their present. I used it for an infinity mirror with a motion sensor and two magnetic key holders. It was fun doing the project, so thanks for your help and sharing for knowledge

Thanks for the YouTube links,… and thanks for keeping traffic on my website going, it’s very much appreciated.

As for the code for the meteor rain; I’ll have to do some tinkering – mostly finding my Arduino and LED strips.It doesn’t look like this would be super complicated though.I’ll try to make some time this week to write some code for this, and maybe combine that with some extras to cycle through all the effects mentioned in this post.Might take a little though,…

Give it a shot an see what you think. I’m sure there is room for improvement (for example; dividing colors to mimic a fade is OK but can be done better).I did try this with a 60 LED strip and looked pretty good. Then again; I never payed much attention to the meteor rain effect in the past.

Let me know what you think, and if it’s worthy I’ll add it to the list above – if not, then we’ll do some tweaking …

Glad you liked it. As for your suggestion; Hey, it wouldn’t be fun if we couldn’t improve this right? The option to add more strips would of course be great, but that would no longer fit this “generic” approach I’m afraid.

This one only works with FastLED since NeoPixel has no function to fade LEDs (by my knowledge).

I’ve added a few options like the size of the meteor (excl. tail), how fast the tail decays, if the tail LEDs should decay at random (leaving little pieces that decay less fast). Play a little with the values and to add randomness – play with random values as well.

As for a random start when using multiple Arduino’s and/or strands; you could do a “delay(random(12345));” before the meteorRain() call. You’d probably need to set randomSeed() in the setup function, for example:

We can always do what we do better ;). I’m learning from the bottom up and your tutorial is gold for that. I’m also trying to implement the lighting effects into some of my projects at the same time. e.g. https://youtu.be/R-_Mn9t1OoE

Have you ever done a sketch that results in 2 different effects to two different sets of neopixels (of different lengths) at the same time?

I’d like to have the core pulse randomly separate to the circle that I want a superfast spinning effect on.

That’s a cool project, which initially (since I forgot to read the “Iron man” text) made me think of a LED ring around a speaker responding to music. Anyhoo – both fun projects!

I have not played with multiple strips yet – I’ve always used math to set the LEDs so it looks like 2 strands. FastLED however does support multiple strands, but I can imagine it to be challenging to have 2 or more effects to run in parallel. I’m thinking about timing issues and such.

I guess I would start using 2 Arduino’s for that – to get max speed as well.

Then again, if you’d make one procedure handling the spinning – just 1 step, and another one doing just one step of the other effect, and then call them in a certain sequence in loop(); might work.

in my practical experience, 300 x 20mA would work or is at least worth a test. This works since not all LEDs are on and at max brightness all the time for a long period of time. Which would suggest a 6A power supply could pull this off.

If you’d like to use individual PSU’s, then your approach looks good; common GND, Vcc for each strip.

However if all strips have a common data pin 6, then they most likely all will display the exact same effect. Not sure if that’s what you had in mind.

If this is NOT what you had in mind then connect the Din of the first strip to Pin 6 of the Arduino. At the end of the first strip you’ll find a Dout pin (follow the arrows) which can be connected to Din of the second strip, and so on, daisy chaining the strips. Power still can still be done per individual LED strip.

If this is NOT what you had in mind then connect the Din of the first strip to Pin 6 of the Arduino. At the end of the first strip you’ll find a Dout pin (follow the arrows) which can be connected to Din of the second strip, and so on, daisy chaining the strips. Power still can still be done per individual LED strip.