Arduino powered LED Mask with FastLED [Part 1] - How to write code for an irregular matrix

Ғылым және технология

I made an LED mask with 11 patterns to demonstrate how to code for a matrix that is not rectangular. It runs on an Arduino Nano and uses FastLED library. If you just want to look at pretty flashing lights, skip to 07:35. Watch right to the end to see the basic sound reactive part - this still needs some work!
GitHub repository for code and schematics: github.com/s-marley/LEDMask
FastLED XY example code for rectangular matrix: github.com/FastLED/FastLED/bl...
FastLED XY Map Generator: macetech.github.io/FastLED-XY...
If you've found this useful and you'd like to support me to create more stuff, you can now buy me a coffee: www.buymeacoffee.com/scottmarley
The mask runs from an Arduino nano and the LEDs are controlled using the FastLED library.
As an Amazon Associate I earn from qualifying purchases from the links below. It doesn't cost you any more and it helps me to keep making videos!
Black mask to make one yourself: amzn.to/30VHMWV
5m LED strip LED strip: amzn.to/2SKL62v
Ender 3 Pro 3D printer: amzn.to/33OR7Sf

Пікірлер: 111

  • @andrewjames2569
    @andrewjames25695 ай бұрын

    This is has been extremely helpful as Ive been digging for info on how to map leds and irregular shapes, thank you!

  • @johnvargo8050
    @johnvargo80503 жыл бұрын

    So, I was having trouble grasping these irregular matrix concepts from all of the web sites I've been reading. This video finally brought it all into focus for me. A thousand thank you's, this was really helpful. I'm making a wall art piece with columns 3-4-5-6-5-6-7-8-7-6-5-6-5-4-3 land I knew I needed an irregular matrix but had no idea where to go from there. Thanks again!

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Thanks John, I hope you can build something amazing!

  • @jerryhalasz
    @jerryhalasz3 жыл бұрын

    I have not seen a better tutorial for creating an LED mask. High 5 to you sir!

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Glad you liked it!

  • @Preske
    @Preske3 жыл бұрын

    the sound reactive one is my favorite :D

  • @holbylarsen
    @holbylarsen3 жыл бұрын

    This works great. Thank you so much for sharing! The irregular matrix tool is a godsend as my custom PCBs are highly irregular :)

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    No worries, yeah, that tool is a lifesaver!

  • @jstro-hobbytech
    @jstro-hobbytech Жыл бұрын

    I asked a question about binary udls the other day on one of these videos. Disregard. It was quite fun learning about it because I learned alot of other stuff I never knew.

  • @deverostv5046
    @deverostv50463 жыл бұрын

    amazing job, thanks for sharing with us

  • @howardgregory892
    @howardgregory8922 жыл бұрын

    Fantastic ideas and great instructions so thankyou for helping me in the Arduino path - I think ! Your LED mask demo inspired me to make an LED coat as I could not solve the irregular matrix in my mind until I saw your post. The button info was great too as this will help - ALOT with the design! I have your code running on the first panel perfectly thankyou! (9 x 24) vertical serpentine and looks great ....... but the UNO dies as the row size increases. (43 x 24 irregular matrix in total) and is out of Memory.. so upgraded the board to a Mega which easily takes the code as you would expect If I upload the same code onto an Arduino Mega it simply wont run at all, even though it runs fine on the UNO I have changed the "j" to a uint16_t j from 8 as I exceed 255 but that gives not joy... I cant solve why it Runs on the Uno but not on the Mega Do you have any ideas - I am trying the Arduino forum and not getting very far!

  • @ClaytonDarwin
    @ClaytonDarwin3 жыл бұрын

    Love it. 👍 I'm going to have to give that a try.

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Would love to see what you make!

  • @Technochris0
    @Technochris02 жыл бұрын

    Awesome video, do you have experience with an irregular strip? I have a strip with gaps, sections that go forward and backwards, and groups of leds that need to combined. I wrapped the led strip inside a sign that isn’t in a matrix or straight line. More like circles and shapes with a single seamless strip.

  • @DRHall-rn3sb
    @DRHall-rn3sb3 жыл бұрын

    Nice explanation of the design, I have got a fire routine that is basically generated on the fly but can control it with variables to get better flicker and strands leaving the main fire. i will make my 16x16 matrix equals yours by turning off the unused leds. I will email you the code once I am happy with the adjusted code. As for covering it, use cling film, then mold features using clear latex that is paintable or foggy, this would be good if an area fails you can just remove the latex and access the leds. Latex will need studs or some way to hold it on. Great to see this.

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Molding latex over it is a good idea, definitely easyish to remove if necessary. I tried a number of fire routines on it including the usual fire2012 one and found this one looked the best. I also disabled side to side motion of the flames as it just didn't look that good on such a low res matrix. Happy to see what you've come up with though!

  • @ArnovSharma
    @ArnovSharma2 жыл бұрын

    this video is AWESOME!

  • @okkaputra9361
    @okkaputra93613 жыл бұрын

    Thank you sir..I got the idea from your video

  • @50shadesofskittles9
    @50shadesofskittles93 жыл бұрын

    Nice B-Roll buddy! :)

  • @filippolorenzoni2185
    @filippolorenzoni21853 жыл бұрын

    Perfect tutorial, exactly what i was looking for! Is there a way to change effect? I mean something like Glediator, but with an irregular matrix, is it possible? thank you!

  • @cine-lights
    @cine-lights3 жыл бұрын

    Very Very original and great video... Great build scott..., i am aiming for a man cave sometime near the end of this year..., this would look cool in it...

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Thank you :) I'm sure with your love of flashing lights you could throw one of these together for the man cave!

  • @cine-lights

    @cine-lights

    3 жыл бұрын

    @@ScottMarley Just had the mask arrive today, seriously lacking leds though, now due to the lack of time i have they will sit in a corner and gather dust lol

  • @cine-lights

    @cine-lights

    3 жыл бұрын

    which version of fastled and arduino are you using? quite a few errors popping up .. Drops.h:24:36: error: could not convert '(const uint32_t*)(& OceanColors_p)' from 'const uint32_t* {aka const long unsigned int*}' to 'CRGBPalette16' CRGBPalette16 currentPalette = OceanColors_p; ^ In file included from C:\Users\Mannys\Desktop\Mask\Mask.ino:84:0: Noise.h:17:36: error: could not convert '(const uint32_t*)(& PartyColors_p)' from 'const uint32_t* {aka const long unsigned int*}' to 'CRGBPalette16' CRGBPalette16 currentPalette = PartyColors_p; // Starting palette ^ exit status 1 Any ideas ?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    @@cine-lights the latest I guess, 3.003.003. I'll have a look shortly and see if I get anything like that. Not sure I do as it would not have compiled!

  • @cine-lights

    @cine-lights

    3 жыл бұрын

    @@ScottMarley i just upgraded to the latest version of fastled and arduino and getting the error..., i was using a slightly older version and had other errors too.... the simple version works no probs.., no rush, if all else fails could you throw over a hex / compiled version - im using a nano as your are

  • @paultheisen9871
    @paultheisen98712 жыл бұрын

    Great video, and fun project. I've subscribed and am working my way through your videos to better understand the possibilities of FastLEDs and Ardiuno. This is a bit off topic, but can you use the irregular matrix on a regular matrix so only certain pixels light up for some patterns but all of them light up for others?

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    Thank you! There might be a cleverer way to do this, but an easy way would be to make your pattern fill the matrix as usual, then set the pixels you want switched off to black before calling FastLED.show(). You could store the index numbers of the 'off' pixels in an array, and just loop through this setting them all to black.

  • @Coltography
    @Coltography3 жыл бұрын

    This is so cool, I've made a mask similar to this but just used the default demoreel stuff for fastled. How did you get the sound reactive animations at the end?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Take a look at the GitHub link in the description, it's the pattern called 'Sound.h'. it's really basic and could be expanded a lot but I just wanted to get the video done. It just looks for a sound level between fixed points and draws the appropriate image. Really these points should be determined dynamically and I'm sure I'll do it some point!

  • @user-wv1qk8bg5s
    @user-wv1qk8bg5s8 ай бұрын

    Hello, Newbie question as I am just starting off. I am able to get the matrix to work with the rainbow pattern. I am having a hard time trying to figure out how to only put the fire pattern on the matrix. I not sure where to replace the rainbow pattern for the fire pattern in the code. I do not want to use classes, I simply want to use the fire pattern on the matrix. If you could please explain where to change it on the code, that would great. Thank You once again!

  • @maximilianogaggini5959
    @maximilianogaggini5959 Жыл бұрын

    Awesome project man. Can i ask you the version of all 3 libraries? i´m having problems compiling. THX!

  • @Coltography
    @Coltography3 жыл бұрын

    Would love to see you revisit this with an ESP32. I can't help but think there's a ton of potential here, you could have an app control "facial expressions" and crying animations or something cool if you had higher density pixels covering the entire mask!

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Replacing the Arduino with and ESP would be straightforward, just 3d print a different case for it. Problem is, I don't have time to add new patterns and stuff! The code is all there if you'd like to have a go? Not sure about increasing the pixel density though, the power consumption would increase hugely, so I'd have to rethink how the power is distributed, and soldering all those strips together on a curved surface would be miserable! It does have a lot of potential though. Maybe one day I'll get inspired again to have another go!

  • @Coltography

    @Coltography

    3 жыл бұрын

    @@ScottMarley Wish you had the time, I'd gladly collaborate with you on this! ! I've 3D printed a translucent mask before and lined the entire inside with ws2812B pixels but never got the software side of things worked out. I'll be teaching myself some things later this year I guess.... :P Keep up the awesome work!

  • @getyerspn
    @getyerspn3 жыл бұрын

    Wow that's a great find , I've been 'making' my own pixel maps for my pixel trees for years....this will be soooo much easier...I never even though to search for a ready made pixel map generator ...I feel silly now. Can't thank you enough... No sure about sealing the leds in epoxy ..would make it a pita when one or two inevitably fail. The vac forming of a removable cover sounds difficult to get right but could be more practical.. If you just want environmental protection from moisture then conformal coating like DCA SCC3 from electrolube would work. Anyway nice helpful video.. thanks

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I think you're right about the epoxy, I generally dislike doing anything like that which I can't reverse later! I'll have a play with some ideas and see what I think might work.

  • @TomS699

    @TomS699

    3 жыл бұрын

    Weird how people are just seeing this tool now. It was very popular on Reddit and when Google+ was out

  • @costynvd

    @costynvd

    3 жыл бұрын

    @@TomS699 Weird, I've been a FastLED lurker for years and hadn't seen it before! @Scott: It's a little late for this project, but you could use WS2813s for a next project. Dual data line (main and backup). Less annoying if one fails.

  • @umit4334
    @umit43343 жыл бұрын

    very cool . . do you have WS2811 real time Video Transmission project

  • @costynvd
    @costynvd3 жыл бұрын

    Very cool project! Thanks so much for the video, also explaining the amazing XY calculator. The droplets animation is very cool, hadn't seen that before. Assuming you are going to be using this in dark places, I would suggest turning down the brightness a lot. People do not like being blinded. Speaking from experience here. ;-) But you were going to add a diffuser anyways, so I think that will be allright. Might even consider using a slightly smokey material to dim it a bit (sometimes these WS2811's look ugly at low brightness).

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I agree it needs some diffusion and toning down a bit! It does look quite different on camera than in real life however, I'm recording all this on a phone so I don't have much control over how it records. Thank you for your comment!

  • @scottpaynter2219
    @scottpaynter22192 жыл бұрын

    To cover the mask you could use Wonderflex Thermoplastic. It's a plastic which becomes soft and malleable when heated and diffuses light really in a way which you can still make out the LEDs. If you image search for "wonderflex thermoplastic led mask" you'll see what i mean.

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    I gave the mask to a friend, and he's customised it similar to what you have suggested and it looks great. Thanks for the comment

  • @leemarsh5258
    @leemarsh52583 жыл бұрын

    Hi Scott, love your projects. Quick newbie question - what wire are you using between the copper strip and the led connectors? I've built a LED matrix and want to use your copper tape method to distribute power/gnd but I'm struggling to figure out what wire to use. I see with your mask you seem to mainly be using bare wire - what gauge is that and is it pre-tinned? Sorry for what is no doubt a really basic question. Thanks!

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    No worries, it's just single core copper wire, that I covered in a thin layer of solder. That way it solders quickly so not too much heat ends up in the copper tape. I don't know what guage it is, but the insulation is 1.1mm diameter and the core is 0.6 mm diameter if that helps. Probably doesn't matter too much here unless you're making an enormous matrix!

  • @mehmetengur6980
    @mehmetengur69802 жыл бұрын

    great tutorial, thanks Is it possible to make a digital clock with the same logic and make the same patterns? (esp the firs pattern)

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    It's possible to make anything! Good luck :)

  • @MegaMario0007
    @MegaMario00073 жыл бұрын

    For the cover, use Fossshape 300

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I had no idea that was a thing! Would it be transparent enough to show the LEDs through?

  • @MegaMario0007

    @MegaMario0007

    3 жыл бұрын

    @@ScottMarley check out instagram.com/wow_elec_tron?igshid=mrldp6j1no68 , He makes his masks with it

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Great, they look amazing!

  • @LeonMOOK
    @LeonMOOK3 жыл бұрын

    This is the best thing

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Cheers dude :)

  • @aimiloo
    @aimiloo3 жыл бұрын

    I see a lot of really awesome LED masks, but I just want to buy them! Is this one for sale? Will you be making any for sale?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Sorry, this takes way too much work to make and it's pretty fragile to be selling I'm afraid! There's a big difference between making something as a hobby and working out how to get things manufactured, and it's a skill I don't have at the moment. I do appreciate you asking though!

  • @aimiloo

    @aimiloo

    3 жыл бұрын

    @@ScottMarley @Scott Marley Bummer. Well thank you for the prompt reply, I appreciate it! I just personally don't have the time or desire to build one, it looks very complicated to me. I'm not code savvy or an engineer of any sorts so I would just get frustrated building one. I hope that somebody will be able to build a really awesome one and I can buy it! I've found some online but they're just very generic, not that great of quality, or way too expensive.

  • @maartena82
    @maartena823 жыл бұрын

    Very nice mask. Can i ask how you switch between patterns ?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    At the moment you change patterns by pressing the push button. Have a look at the GitHub page in the video description to see how everything is wired up.

  • @maartena82

    @maartena82

    3 жыл бұрын

    @@ScottMarley i gone have a look. And al the code you place on a diverent tab. And then you can push the button and switch the pattern ? Thank you for the information. I will try it. Its very nice

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    @@maartena82 all the code is also on GitHub. However, you will need some experience in wiring, coding, FastLED etc in order to get this to work. Good luck!

  • @ratchet601
    @ratchet6013 жыл бұрын

    How are you powering it? How much voltage does it need?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Everything runs from 5V. I run it from a USB power bank. The amount of current depends on the number of LEDs and the brightness setting. At 250 brightness, the most demanding patterns draw a bit over 2 amps.

  • @valeninstudios1937
    @valeninstudios19373 жыл бұрын

    I don't know if I'm too late to get an answer, but how did you make the other patterns? Maybe do a tutorial? That would be very kind :)

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    All the code is on GitHub if you want to take a look at it?

  • @valeninstudios1937

    @valeninstudios1937

    3 жыл бұрын

    @@ScottMarley Found it, thank you very much

  • @Ruths138
    @Ruths1383 жыл бұрын

    great work! how can I compile these animations without the button?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Not sure what you're after? How do you want to change the patterns?

  • @DustinDalziel777

    @DustinDalziel777

    2 жыл бұрын

    @@ScottMarley I'm curious about this too. Is there a way for it to just cycle through the animations and change automatically every 30 seconds for example?

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    @@DustinDalziel777 yeah, very easy to do. Just change bool autoChangeVisuals = false; to true. Done.

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    Oh, and to change timing to 30s, change #define PATTERN_TIME 10 to 30

  • @lazywargaming6752
    @lazywargaming67523 жыл бұрын

    I want to do this so that it reacts to sound. i have a microphone, nano and everything else. I just don't know how set it up. any chance you could show the wiring on the sound reacting one?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    The wiring is shown on the github page linked in the description github.com/s-marley/LEDMask

  • @lazywargaming6752

    @lazywargaming6752

    3 жыл бұрын

    @@ScottMarley thank you so much for your help

  • @ice-iw5xr
    @ice-iw5xr6 ай бұрын

    this work for wled?

  • @mr.oliverNo0815
    @mr.oliverNo0815 Жыл бұрын

    Hi...What kind of wire do you use to connect?

  • @ScottMarley

    @ScottMarley

    Жыл бұрын

    Not sure what you mean. To connect what? The Arduino nano uses a micro USB connector for power. The wires to the LEDs are just normal hookup wire (not sure what size). The wire used to connect the led strips to each other is tinned copper wire.

  • @yusuf120581LED
    @yusuf120581LED3 жыл бұрын

    Coool

  • @donvukovic
    @donvukovic3 жыл бұрын

    Did you purchase that actual black mask or make it your self ?

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I bought it from here www.amazon.co.uk/Kasstino-Airsoft-Cosplay-Costume-Halloween/dp/B01IT8Z2R0 I'm not crafty enough to make it myself.

  • @DustinDalziel777
    @DustinDalziel7772 жыл бұрын

    So I'm using an Arduino Nano 33 IoT which does not have an EEPROM.h library. Do you know of any workaround?

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    I've never used it, but apparently this library is a good option github.com/cmaglie/FlashStorage

  • @DustinDalziel777

    @DustinDalziel777

    2 жыл бұрын

    @@ScottMarley ok thanks! Where would you recommend I copy paste this amongst your code? Really appreciate your help.

  • @etherealx3
    @etherealx32 ай бұрын

    I hope your ok, i used to watch all your videos and havent seen u in a while!, i hope its everything ok :)

  • @ScottMarley

    @ScottMarley

    2 ай бұрын

    Thank you for checking! I'm good, I have a baby and a house to renovate now so just no time to do this any more unfortunately. Maybe I'll come back one day!

  • @etherealx3

    @etherealx3

    2 ай бұрын

    @@ScottMarley super good to hear from you! I truly understand, family comes first, I hope everything goes well :)

  • @slayerz_0019
    @slayerz_00193 жыл бұрын

    How did you solder and connect all of them

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    With a lot of patience, some wire and a pair of tweezers! 5V is connected to the right side of every strip, GND is connected to the left side. Data starts at the top right and zig-zags it's way through every strip.

  • @slayerz_0019

    @slayerz_0019

    3 жыл бұрын

    Scott Marley oh alright thanks and if it’s not to much trouble how many parts did you use like how many resistors, LEDs, you know stuff like that. If u can thank you I’m doing a project and I would live to do a mask like yours.

  • @joeledgar5879
    @joeledgar58793 жыл бұрын

    Please make a video about porting to the esp32!

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I may do that in future as having Bluetooth or WiFi control would be great! In the meantime, this code will work fine on the ESP32 as it is, just change the board in the boards menu and upload it.

  • @costynvd

    @costynvd

    3 жыл бұрын

    @@ScottMarley Check out the Blynk project. You can easily add wifi remote control. Although it requires internet, not so handy in a mobile installation.

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    @@costynvd I'd probably do it like the Bluetooth control on my ESP32 matrix. I don't generally have WiFi where this is useful (mainly festivals!). Or maybe local WiFi control although I haven't done that before. Always good to learn something new though.

  • @elyastadesse8774
    @elyastadesse87742 жыл бұрын

    Awesome work, I loved it. Can u send or share me the entire code I like to try it. Thanks 😊

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    It's all in the description at the github link

  • @TheBritt2001
    @TheBritt20013 жыл бұрын

    Great ending, hahaha! xD

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    I videoed my friend wearing it out and about in Bristol kzread.info/dash/bejne/n5yrpauklrm-eJM.html

  • @JarppaGuru
    @JarppaGuru2 жыл бұрын

    4:56 yeah but leds are in serie there is no blank spots

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    That's true, but we are telling the software that there are blank spots so the image display correctly.

  • @somakantamajumder5408
    @somakantamajumder54082 жыл бұрын

    Please make led charki

  • @lazywargaming6752
    @lazywargaming67523 жыл бұрын

    JC_Button.h doesn't want to work for some reason. edit. nevermind. got it

  • @ForgottenKnight1
    @ForgottenKnight12 жыл бұрын

    Hey, do you have tutorials on how to build masks? Is this 3D printed ? How did you attach everything to it ?

  • @ScottMarley

    @ScottMarley

    2 жыл бұрын

    I bought the mask from Amazon. I think everything else is shown in the video.

  • @user-wy9wp2yu2x
    @user-wy9wp2yu2x3 жыл бұрын

    zombie apocalypse ))))

  • @mrdestructoid9988
    @mrdestructoid99883 жыл бұрын

    bdsm has gone too far

  • @ScottMarley

    @ScottMarley

    3 жыл бұрын

    Lol

Келесі