Introduction: Led Shirt With Mode Changer (Arduino, Neopixels, FastLED)

About: Making interactive installation art

What

This is a step-by-step tutorial on how to take a regular shirt and use LEDs and arduino to turn it into a light up shirt (undoubtedly much better than a regular shirt.)

You could totally use the same steps with a hat, skirt, bag, etc - anything you want to cover in LEDs.

Why

This shirt is perfect for:
Festivals!
Raves!
Tuesdays evenings!
Any time you want to make a good impression, e.g. job interviews!

How

I took an existing shirt and added LEDs to it, rather then starting from scratch and making the shirt itself. This gave me a solid base to work from and allowed me to focus on the light-up-ness rather than learning how to make clothes. I then sewed tulle (net fabric) over the top of the LEDs for diffusion. I also made a little box to hold all the electronics, added a button so I can change the patterns, and a display because it'll be nice to be able to see what pattern I'm on - and because displays are cool.

There are 4 main parts to the project:

1. Design - Figuring out how to layout the LEDs.

2. Electronics - Soldering together the LEDs, buttons and screen.

3. Sewing - Attaching the LEDs and diffusion fabric.

4. Control box - To house the batteries, arduino, button and display.


Level

I try and write my tutorials in such a way that someone with absolutely no experience at all can at least enjoy reading it and get an idea of how stuff works.

This one is particularly suitable for people who have used Arduino a bit before, and ideally you should have a little bit of practice soldering - especially to solder the display.

Code

All of the arduino code is on my github here.

Step 1: Equipment and Tools

Main Components / Electronics

  • Some kind of shirt!
    Things to think about:
    - How will the LED strip hang on it? If the top is stretchy and baggy it won't work well. Something with a bit of structure is good.
    - Where will you attach the tulle? The top I chose has a straight top so it will be easy(ish) to sew tulle to it.
    - The overall look. I chose mine because I liked the detail of the straps.
  • Addressable LEDs (US Amazon | UK Amazon)
    I use ws2812b LED strip. There are a few variables you can choose from:
    Coating: You can choose from no waterproof coating, IP67 coating (totally sealed and waterproof) or IP65 coating (splashproof). For this project I used IP65.

    Color of backing: The strips come in black and white. For this project it doesn't really matter since the strips will be covered by tulle fabric as a difusser.

    Number of LEDs: The standards are 30, 60 or 144 LEDs per metre. For this project I used 60 LEDs per metre.
  • Tulle fabric
    There are different types of tulle! Some is kind of stiff and scratchy, some is soft and floaty. You probably want the soft and floaty type but, you do you. I got mine from a fabric shop in London, it was £1 a metre.
  • Battery Pack (US Amazon | UK Amazon)
    LED strip should ideally be powered at 5V. Usually AA batteries are 1.5V, so four of them would give you 6 volts. However, if you used NiMH rechargeable batteries, they range from 1.5 - 1.2V each depending on how charged they are. Basically four of them gives you close enough to 5V.
  • Ni-MH Rechargeable batteries (US Amazon | UK Amazon)
    Check the capacity of the batteries you buy. The highest I have seen is 2800mAh. Get as high as possible. Higher capacity is more expensive but the higher the capacity, the longer your batteries will last.

    Pre-judging how long your batteries will last with an LED project is *really difficult* because the power draw varies so much depending on which colours/brightness you are using and how many of your LEDs are on at any one time in your animations. The good news is that with one of these little battery packs, you can bring a few sets of spare batteries to any event and just swap them out if the batteries die half way through the party. In my experience, you can happily power ~100 LEDs doing fadey animations for 6-10 hours from 4x 2800mAh batteries.
  • Battery Charger(US Amazon | UK Amazon)
    To charge the batteries, obv.
  • Arduino / ESP8266 / NodeMCU (US Amazon | UK Amazon)
    I used a NodeMCU which is a type of arduino that comes with the ESP8266 chip included, which means it has Wifi. I didn't use wifi in this project but its nice to know I could connect my shirt to the internet if I needed to for some super fun reason. I just had a bunch of them from a previous project and also they are cheap.
  • Display with backpack (Pimoroni)
    When I decided to include a display to see what mode is currently selected, I felt like I was maybe over engineering things a bit but I thought it would be fun and it WAS. What I didn't expect was that it would immediately prove to be super useful - when I was writing and testing my code, it was very nice to know for sure what mode I was on.
  • Arcade button (Pimoroni)
    These are super cute and they come in a variety of colours. They are satisfying to press AND satisfying to clip into correctly sized holes in plywood. I will be using these again in the future for sure.
  • Container
    I laser cut a box to hold the button, display, arduino and battery pack. You could buy something and alter it if you wanted, or at a push just chuck it all in a bumbag/fanny pack. The lasercut file is included later on.
  • Wago Connectors (US Amazon | UK Amazon)
    You only need two of these but it's worth getting a bunch because they are really useful.
  • 10k resistor (US Amazon | UK Amazon)
    Again, you only need the one but they come in variety packs!

Tools

  • Soldering Iron (US Amazon | UK Amazon)
    This soldering iron is fancy, there are cheaper ones out there too if you're just starting out. If you're getting serious though, I definitely recommend this Hakko.
  • Wire strippers (US Amazon | UK Amazon)
    I love these wire strippers. The mechanism pulls the wire coating off automatically as you clench them and also it makes a very good click-kuh-lunk noise.
  • Heat gun
    I'm not posting a link for this one because I kind of hate my heat gun (it's too strong and heats too wide an area) so I don't have a good one to recommend unfortunately. Do you love your heat gun? Let me know in the comments!
  • Sewing machine
    I'm not posting a link for this either because I'm not a sewing machine expert! Any sewing machine should do.
  • Scissors
  • Ruler

Consumables and other bits

  • Heat Shrink - Large & Clear for LED strip (US Amazon | UK Amazon)
    Combined with the RTV silicone, this provides a strong waterproof-ish seal over your LED strip joints.
  • Normal Heat Shrink (US Amazon | UK Amazon)
    This is for sealing other joints, on small cables.
  • Solder (US Amazon | UK Amazon)
  • RTV silicone (US Amazon | UK Amazon)
    This stuff makes it possible to reseal waterproof LED strips after you have removed the waterproof covering to solder it.
  • Jumper cables (US Amazon | UK Amazon)
    You only need about 10 of these but it's worth getting a bunch for future projects.
  • Glue
    I used Gorilla glue. This is for constructing the box that holds the stuff.
  • Sticky back velcro (US Amazon | UK Amazon)
    This is for sealing the box that holds all the stuff, if you're not doing the box, you don't need this.
  • Needle, thread and pins

Step 2: Design the Look

See how strips look on your body

Put the shirt on and hold up bits of LED strip while looking in a mirror to see how it looks. You can use pins to keep strips loosely in place, to try out designs with lots of separate pieces.

Finalise details

Once you've seen how strips look when the shirt is on, you can lay it down flat with the strips on top to finalise the layout.

I decided on having two long diagonal lines on each side, and then a little piece with 3 strips near the neck.

On the back, I'll also have 3 long lines.

Step 3: Design the Cable Layout

Sketch your design.

Use paper to sketch out the details of the design, working out exactly how many LEDs to put in each section.

Work out where you'd like to keep the arduino and batteries etc. I decided to put it on my right hip.

This diagram will be useful for reference later, so you don't forget which bits of strip were meant to go where.

Cable layout.

Decide how to connect the LEDs to the arduino.

You could connect all the LEDs in one long joined together line which all connects to one pin on the arduino. However, I decided to create four shorter joined together lines, which will connect to four separate pins on the arduino.

This is preferred for several reasons:

- Because long lines of LEDs can suffer from voltage drop at the end of the line, causing them to tend towards looking red or orange.

- Because this will create one neat "artery" of cables on the right hand side of the top, with only short connecting lines between strips, rather than lots of long connecting lines all over the place.

- Because in my code I'll have 4 separate "lots" of LEDs to work with, which helps me think about them neatly.

Cable lengths.

With the strips laid out on your shirt, measure how much cable you will need for each connection. Err on the side of making them slightly too long, I usually add 5-10cm to all measurements.

Sketch out a diagram that shows your LED strips with the number of LEDs in each section, and the length of cable between them. Again, this will be a good reference for you, so you don't have to keep checking how long everything is meant to be.

Step 4: Construct the LEDs

Now it's time to make the real world match the design.

Step 5: Cut Cables to Length

What cables?

For each bit of LED strip, you need 3 cables:

  • Power (Red)
  • Ground (Black)
  • Data (some other colour, e.g. blue or yellow)

These cables should be multicore, around 24awg. I like to use silicone coated, it's just nicer to work with, especially in this case when it will be worn, the cables will bend inside the top in a nicer way.

Prepare your cables

Using the measurements you took a couple of steps back, cut your cables to length.

Strip the ends of the cables. For the ends that will attach directly to the LED strip, you should only strip 1-2mm. For the ends that will attach to the arduino, strip about 6mm.

Step 6: Solder Cable to LED Strips

Prepare the joint

Cut the LED strips to length (you might have already done this at the design stage when you were holding them up to your body etc). Peel away a little bit of the waterproof covering and cut it away.

Slide a piece of large clear heat shrink over the strip, and keep it away from the joints.

Solder

On the LED strip, the contacts will be labelled something like 5V, Data and Ground. Make sure you have your strips the right way around. Power can be injected from either end, but data MUST flow AWAY from the arduino. There will be arrows along the length of your strip showing the direction of data flow.

Solder your red cables to the 5V contacts, black to the ground contacts and other colour to the data contacts.

Follow the diagram you made a few steps back keep soldering til you have everything looking like your diagram.

Tip: I suggest that you do not seal the strips (by heating the heatshrink) as you go along but, rather, wait til you're finished and can run a little test to check you did everything right before sealing it in as it's a pain to undo once it's sealed.

Step 7: Solder Connectors for Data Cables

How these connections work

For each line of LEDs you have (made up of several bits of strip), you should have one end with loose cables, these are the bits that go to the arduino/power supply.

The data cables connect to the arduino using jumper cables. (You can also use female header pins but I had run out!)

Solder

Solder each data cable to a jumper cable. (Ideally don't use black or red data cables as these are reserved for power/ground).

You can shrink the heat shrink on these joints right away.

Note: Only attach connectors to the data cable, not the power and ground cables, we'll deal with them in a minute.

Tip: Check out my "helping hands" alternative solution for soldering cables. Helping hands are usually fiddly things that hold your cables in alligator clips. I came up with this idea of using two blocks of wood / upturned boxes one time when I didn't have my helping hands with me, and I actually find it works great. I just use electrical tape to hold the cables in place.

Step 8: Connect Up Power

How these connections work

I have four separate lines of LEDs (made up of several sections each). We'll connect all the power cables together, and all the ground cables together, so they can use the same power supply. I use wago connectors to do this, as it's a super quick way to join lots of cables together.

You'll need two wago connectors, one for ground and one for power.

In each wago there are 6 cables to connect together but I'm using 3-way wagos. This is because they are smaller and also because it's fine to put a few cables in each slot of the wago. In fact, the wago will grip better if there are a few wires together. Twist the cables together before putting them into the wago.

Also grab your battery pack at this point, and connect the cables from that into the wagos too.

Each wago should have:

  • 4 silicone cables - 1 each for the 4 lines of leds (all the red cables in one wago, all the black cables in another)
  • 1 connection to the battery pack (red with the reds, black with the blacks)
  • 1 jumper cable for the connection to the arduino (again, red with red, black with black)

Tip: Keep your battery pack off while you are connecting the cables.

Step 9: Connect to Arduino

Connect all the jumper cables to the arduino:

CableArduino pin
Red jumper cableVin
Black jumper cableGND
LED data cable oneD3
LED data cable twoD4
LED data cable threeD5
LED data cable fourD6



(Keep pins D1 and D2 free as they are specific pins needed for the display)

Step 10: LED Circuit Diagram

Here is a diagram of how the LEDs should be connected up.

Step 11: Run a Test!

To run a test we need to set up the arduino and get some code going, let's do that!

Step 12: Set Up Arduino Software

Install software

If you haven't used Arduino before, then you need to install the Arduino IDE. You can get it from here: https://www.arduino.cc/en/main/software

NodeMCU

I'm using a NodeMCU/ ESP8266 which is similar to a regular Arduino, but it comes with wifi (there are a few other differences as well). I'm mainly using it because I have a bunch of them left over from a previous project - but also because I like the idea i could control this shirt over wifi in the future. You can use a nodeMCU for this project or a regular Arduino. If you use a regular Arduino you will just need to adjust the pin numbers a bit.

If you use a NodeMCU and you haven't done so before, you will need to add this kind of board to your Arduino IDE. There is a good tutorial on how to do that here: https://www.instructables.com/id/Get-Started-With-... Step 2 of that tutorial is the one you need to follow.

Step 13: Add FastLED Library

Get the library

My code uses FastLED which is a brilliant library for controlling LED strip with arduino.

In the Arduino IDE, go to Tools > Manage Libraries.

Then, search for Fastled in the window that pops up.

Hover over the result to see the "install" button and click that.

Step 14: Import LED Test Code

Download the code from my github here:

https://github.com/amygoodchild/LED_shirt

(Click on 'Clone or download', and then 'Download ZIP'.)

Unzip the file and you should end up with a couple of separate folders.

Open up led_test and then led_test.ino.

Step 15: Upload Code to Your Arduino

Turn your battery pack on so that the LEDs will have enough power.

Plug the Arduino in to your laptop using a usb cable and upload the code.

Step 16: Pause to Admire LEDs

Hurray! Some lights! (Hopefully)

Check that every one of the LEDs is lighting up through the animation.

If they're not, there are some troubleshooting tips in the next step.

Step 17: Troubleshooting

There are some lights, but some sections never light up:

Most likely a connection somewhere is bad.
If a whole strip is not lighting up, then check it's plugged in to the right pin on the arduino.
If the strip lights up as far as one of your connections, then probably the connection is bad, have a close look and try resoldering it (turn the power off and disconnect from your computer first!


A strip lights up and then stops midway through the LED tape itself:

It could be that you have your LED strip set up does not match the code. This code will only work perfectly if your LED set up is the same as mine in terms of how many LEDs each line has and which line is plugged in to each pin. Otherwise only parts of your strips will light up, and you will need to adjust the code to match your set up.

It could be that you have your strips plugged in to the wrong pins.

Or it could be the strip is damaged. The damage could be at the end of the last working pixel or in the first broken one so... cut out the last working pixel and the first broken one, and solder two new ones in their place.


The colours are weird:
If your strips are not similar colours to in my video, then you might need to change the RGB ordering. Different LED strip has a different set up for the order in which it deals with Red Green and Blue information. My strips are GRB, yours might be RGB or something else.
There is a line in the code like this which you can adjust:
#define COLOR_ORDER GRB


The strips are all orange/red instead of white:

I've found that if the strips aren't getting proper power, they will draw a tiny bit of current through the usb connection - just enough to light them up red. Double check that the battery pack is on and your batteries are charged. Check the connections there.


The strips are white at the start but fade to orange:

This could happen if you have a strip that is very long. You will need to look at splitting the strip into two sections and "injecting" power again along the strip.


None of the strips are lighting up:

Double check all your connections.
Check that the code uploaded and you didn't get any errors in the Arduino IDE.

Step 18: Understanding the LED Code

My code is full of comments! The best way to understand it is to go through those.

I have highlighted in the image here the section that you will need to edit if you have different numbers of LEDs in your strips to mine.

Step 19: Seal the LED Strip

If everything's working, then you can seal up the led strip. This will protect and strengthen the joints where you have soldered cables to the copper contacts.

Heatshrink the LED joints

Get something to cover your work surface as the silicone sealant can be messy.

Blob a bit of RTV silicone over the joint, cover the copper contacts and get some on the back too.

Slide the clear heat shrink over the joint.

Blast it with a heat gun.

Do this with every joint.

Turn the battery pack on and check nothing's broken!

Step 20: That's All the LED Stuff Pretty Much Done...

... on to the button and display!

Step 21: Prepare the Display

Solder the display to its board

The display comes with a board to solder it to.

Slot the pins from the display into the board.
Make sure it is the right way around or it will not work and it will be a huge pain to get it back out. The dots between the numbers on the display go at the bottom, and the words on the board should be below them.

Turn the whole thing over and solder all 14 of the pins on the display to the board. Be careful that you don't join any of the connections together.

Solder header pins

Next, slot a row of 4 header pins into the other holes on the board, and solder these too.
Make sure the header pins are on the underside of the board.

Step 22: Plug the Display Into the Arduino

Use jumper cables with two female ends to connect to the arduino:

Display pinArduino pin
+3v3
-GND
D (Data)D2
C (Clock)D1

Step 23: Prepare the Button

The arcade button has two pins but it doesn't matter which way round they go.

Solder button connections

Solder one jumper cable to one of the pins. (Let's call this pin A)

Solder a jumper cable and a 10K resistor to the other pin. (Let's call this pin B)

Then solder a jumper cable to the end of the resistor. You can cover the whole resistor with heat shrink for neatness / strength etc.

Step 24: Plug the Button Into the Arduino

Plug those jumper cables into the arduino.

Button cableArduino pin
Pin A - just cable3v3
Pin B - with 10K resistorGND
Pin B - just cableD0

Step 25: Run a Test!

Go back to the code you downloaded from my github, and this time use the led_button_display_test.ino file.

Upload that to your arduino.

The LEDs should run the same animation and you should see a number on the display. As you hit the button, this number will increase. When the number gets to 9, it will cycle back to 0.

(Hitting the button doesn't change anything on the LEDs yet)

My code is full of comments, so check there to see how it works.

Step 26: Design a Container to Hold Everything

I decided to keep the batteries, arduino, display and button in a little box on my hip. Most of the time I would also put the box inside a bum bag (fanny pack).

You could adjust this to whatever is comfortable for you.

I have attached my Illustrator file to make the box I made. I got the pieces laser cut at a local shop, because I don't own a laser cutter. It's usually pretty quick!

Attachments

Step 27: Construct the Box

The box
Once you have your pieces, glue them all together - I used gorilla glue and then I taped the box with electrical tape to hold it together while it dries. Gorilla glue expands as it dries so make sure you frequently check the box and wipe away any excess.

The lid

Don't glue the piece with straight edges directly on, this piece is the lid so it needs to open.

Use velcro to create a "clasp" on either side of the box. I used sticky backed velcro. It will work as a hinge as well as a clasp, so you can easily open the lid.

Stick two squares of rough velcro on each side of the box, about 2cm x 2cm.

Take a piece of soft velcro, about 10cm, stick one end of it to the lid so about 4cm is over hanging. Fold the overhang back on itself so it sticks and creates a double sided soft piece.

This will then attach to the rough piece on the box and keep the lid closed.

The strap

I included slots in the side of the box for a strap to go round the waist, but for now I'm going to keep my box in a fanny pack/bum bag. You could make a strap if you like!

Step 28: Button and Display!

The button and display should pop nicely into their slots.

You will need to unplug and replug in the jumper cables of the button, it's worth it because the button is super satisfying to pop into place.

Tuck all the other bits into the box and close it with all the wires poking out of one side neatly.

Step 29: Sew the LEDs to the Shirt

Lay out the strips a section at a time and sew them on to the top. I don't think it's a good idea to do this with a sewing machine, I did it by hand.

Anchor the end of each strip
I found one good method was to use the overhanging pieces of heat shrink:

Tie a knot in the end of your thread, then stab the needle directly through the heat shrink (be careful not to stab the silicone cables inside!)

Sew this in place.

Add extra attachments in the middle

Once all the ends are attached, then do some little wraps of sewing around the middle of the strips, to stop them from flipping over and hold them in place better.

Step 30: Sew the Tulle Fabric Over the Shirt

Pin the tulle fabric in place and then sew it on. I did this in sections, pinning some and then sewing it, then pinning more to build up layers.

I just sewed the tulle to the top of the shirt, and let it hang loose at the bottom. Each piece I sewed on was folded in half at the top, and I sewed inside the fold so that when it's folded over, it hides the seam.

Step 31: Code!

Go back to the code you downloaded from my github and this time use the file LED_shirt.ino

This code has several different animations in it, which can be cycled through using the button.
My code is full of comments, so the best way to understand it is to look through that.

I found it was useful to make a little diagram that showed the ID numbers of the LEDs at the start and end of each section of LEDs, I could then use these numbers to design animations.

Step 32: Animation Modes

Here are all the animation modes... I would love to see what variations on this you come up with!

Step 33: That's It!

Hope you enjoyed this tutorial... don't forget to check out the full build video!

Find me online:

Instagram
YouTube
Twitter

Feel free to post questions in the comments here or on Youtube and I will try and help out.

Wearables Contest

Runner Up in the
Wearables Contest