How to control LED Strips with Arduino - Cosplay Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys this is valera from Kamui cosplay and today i'm going to show you how to control fancy LED strips what they are do you know I already made a video about static lights and also one about digital LED strips and how to insert them in your costumes you will find a link in the video description below today however I want to show you how to find and edit code without actually knowing anything about programming might Sinagra dual blades for example have different animations and different modes you see that super fancy so this mode is blue pulsing this one red pausing just some static blue light and last but not least a blue crawling effect some other examples are my food Sinagra built from monster honda or master nova from heroes of the storm for these examples all the code i needed here was actually pretty written and i found it on the internet and today i want to show you how to find and a just code the way you need it so you can put it into your own project and be super fancy I will keep this video quite short dosent you can actually fill a whole book about this topic and what a coincidence I actually wrote a whole book about this topic it's actually filled with informations about all the materials you need all the chips and Hydra which is necessary it tells you how to get to the soldiery and how to do all the other programming stuff but all the things you need and yeah check out the advanced cosplay rights book on can we cosplay that cup yes for this example I'm working with their Arduino Uno which is basically a mini computer and digital I to be LED strips and you will find links for all products in a video description below and now let's start the video so before we start here are a few basics on how the Arduino code actually works first go to the website and download the most current version of the Arduino IDE this program allows you to write and edit code and upload it to the microchip which controls the LEDs now the easiest way to run some cool animations is to use a library it's basically just a collection of pre-written code my favorite one is the Adafruit neopixel library you can install it by going to sketch include library manage libraries and then search for neopixel simply install it and you can find it under file examples era fruit neopixel now choose strand test here and it will open notice here that I'm working with an old version of the strand test which gives me more options for adjustments to get the old code you can copy it from the link in the video description this pre-written code is a so-called sketch I know this might look super confusing right now but don't worry I was there as well so let me help you first let's see what happens when you upload the code just make sure that you board is set to Arduino slash genuine uno your programmer to Arduino ISP and you port to Arduino genuine you know as well not here that I'm working on a Mac so it might be slightly different on a PC next connect the LEDs rope with the Arduino here is a schematic by the way plug it in and click the upload button once you see the done uploading message LEDs will start doing all kind of neat stuff what they actually do do is to run through all the animations that are written down in the code one after the other look first the microcontroller sets the strip to red then to green then to blue blinking white blinking red blinking blue then the rainbow animation afterwards the rainbow cycle animation which is pretty similar finally a blinking rainbow animation then it's done and starts again from the top pretty straightforward right now it's up to you to pick your favorite animation and adjust it the way you like at least that's what I do for most of my own projects look here is a rainbow cycle running only with blue light and here I use the same code but only with orange colors and this is actually a completely different code which I also found online and adjusted a bit what I want to say is that you actually don't need to be a programmer to create some cool light effects all you need to get started is to edit some already existing code my favourite source is the Adafruit website as an example I use the cyber fall sweet code as a base and change the colors speed and amount of animated raindrops the result was a fancy light-up ponytail so let's dive into a little bit more detail like how does this work exactly first some simple basics to work with the strand test sketch this command include tells the microcontroller to load the Adafruit neopixel library define means there is LED strip with 60 LEDs which is connected to pin number 6 these are just some parameters you can adjust later and the white setup section basically tells the LED strip to be prepared for some incoming signals well and void loop includes a collection of all animations which run you guessed it right in a loop these are only names though the real code for all these so-called functions can be found after the brackets of voice loop are closed here you'll find color wipe white rainbow white rainbow cycle or white theater chase if you write two slashes in front of a line or a function you'll be activated in this example I take everything out except rainbow cycle the function I mostly use for my costumes after uploading the code again the only animation that is shown now is rainbow cycle now let's change some colors you will need to edit the wheel function for this step explaining why and how would go too much into detail right now however but all you need to know is simply that this part here is responsible for the red light this part for green and this part would be blue so by setting all red parts to zero you turn off the light and the result is a rainbow that only cycles from green to blue same goes for only blue you can do the same for the function color web for example the free numbers you can set here are for red green and blue and need to be between 0 and 255 0 means the color is completely off and 255 means it's on full power for example by adding a lot of red and a bit of blue here we'll get a pink color the 50 on the end is the delay which controls how fast LEDs are filling up 50 is almost instant while 500 will only slowly fill them with color it's not that a nudist from the very beginning though I always play around with a new sketch by changing some random numbers upload the code and see what happens this is really the best way to understand what you're actually doing for the next step I want to be able to switch between two different modes we can achieve this by merging two different sketches together strand test and button you can find button under examples digital and button button this is sketch that allows you to turn a light on with the push offer well buttons I'm using a slight switch here though so I don't need to hold the button the whole time see if I flip the switch the light goes on and if I flip it again it goes off here is a schematic for the wiring and here's the schematic if you want to use your LED strip of such a slight switch so let's grab include and define from strand test and place them at the beginning of the button sketch same goes with the white set apart just copy it into the void setup of button next we need two animations to switch between let's grab a color wipe and wrap which goes here and color wipe and blue finally we need the full white function just copy it at the end oh and if you don't know where the function ends that you need to copy just click on the first curly bracket and the Arduino IDE will show you where the part ends now if you upload your code your LED strip will be animated depending on the position of your switch oh and by the way the rainbow in rainbow cycle codes are written in such a way that they can only be interrupted at a specific time or above a specific command I won't explain this in detail here but note that you'll need a slight switch and you'll have to wait a bit until the animation stops and changes if you want more information and get a little bit more into detail here just check out my advanced cosplay lights book well in if you want to do anything else like the blinking Scout flies in my Monster Hunter costume light up raindrops for the crazy pony tail of my Nova costume or the charging power fact of my gas rifle simply search for code try to find the right sections to adjust it and have fun playing around with it I really hope this video was helpful and you are now able to understand code a little bit better now how to find it and how to adjust it for yourself and I hope you are now inspired to put energies everywhere because that's how I feel about every single project as always thanks so much for all your support and please like and subscribe because this really really helps our channel and if you want to support us even more you can also check out our patreon and as always thank you very much and see you very soon bye
Info
Channel: KamuiCosplay
Views: 614,818
Rating: undefined out of 5
Keywords: Kamui Cosplay, Cosplay Tutorial, Cosplay Progress, DIY, Do it yourself, how to, led tutorial, arduino, arduino tutorial, how to control leds, led strips, adafruit, neopixel, neopixel tutorial, strandtest, strandtest tutorial, cosplay led tutorial, arduino leds, arduino ide
Id: EvRxQbhDxCo
Channel Id: undefined
Length: 12min 42sec (762 seconds)
Published: Mon Dec 02 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.