Here is a project I built to "wow" people at my daughters wedding.
I call it the "Coat of many colours". Using simple components and a basic Arduino sketch you can program the coat for almost anything you can think of. I decided on a simple "dot matrix" of 7 rows by 9 of LEDs which is 63 LEDs. The other parts are an Arduino (an UNO works well), a basic 5V regulator, silicone wire, a basic switch and a 2S Lithium battery. I used a HobbyKing Nanotech 0.95 2S battery which has JST power connector however any battery that delivers 5V or more can be used. The HK battery on my coat runs for about 1.5 hours using the basic routine shown in the video. About the hardest thing to get is the coat. I tried the OP-Shops but failed and in the end bought a waistcoat from the local "Hippy" shop (it is actually called that!).
Imagine turning up at your teams game wearing this.
Here is the Bill of Materials
- An Arduino! I used an UNO but I'm going to replace it with a Nano in the near future.
- W2812B LEDs. I used part 1194862 from Banggood.com - there are 100 pixels in a snap apart matrix
- A basic 5V regulator. Banggood part #951165. They are about $1.50 each
- A basic switch
- Silicone wire - I used 26G for about everything. You will need at least 4m of each colour to connect 63 LEDs
- A battery or battery pack to suit.
- A small plastic case
- "Liquid Needles" glue
- Thread and needles to secure
- A garment, I used a waistcoat, to light up!
I chose to use WS2812 "Neopixels". These can be purchased form $12- for 100. About the hardest part of this project is wiring the LEDs. The LEDS wire serially. The have a "DI" pad which is "Data In" and a "DO" pad whcih is "Data Out". The first LED in the chain has its DI pad wired to the selected Arduino pin. I used D4 but there is no specific need to use that. Use any Digital Pin. The system isn't limited to one string of LEDs either. You can, if you want to get really creative, drive multiple strings They only limitation is your power supply.
Step 1: Design and Build
You now need to decide how to layout your LEDs prior to soldering. I, as mentioned created a 9x7 matrix but you might just want rows of LEDs down your arms, front, legs, whatever. Go wild!
The one issue you will need to consider is the power supply. The suggested A 2S Lithium battery will drive hundreds of the LEDs but you will need to consider the current draw of each LED and the total current supported by your selected regulator.
Each LED will draw ~50ma (milliamps) at full brightness. You therefore get about 20 per amp of consumption. The suggest regulator will drive about 2 amps as is, 3 with a heat sink, so you can run 40 LEDs all day. Note that if you are flashing them on and off, you get a little more leeway with this. My coat drives 63 LEDS without heatsinking and runs fine. You could also power the LEDs "from both ends" if required using 2 regulators or just use "gruntier" regulators.
Each LED has 6 solder pads, the DI/DO as well as "5V+ IN", "Gnd IN", "5V+ OUT" "GND OUT". Get ready for a fair but of soldering! I highly recommend using "silicone" wire. It is much more flexible than PVC insulated wire and as this project involved a lot of soldering, the ease which silicone strips and works is better. I used red wire for the +5V, blue for the signal line and black for the ground (GND) but you can use any colour. You may select colours to disguise the wiring. I didn't bother as the LEDs are so bright they tend to obscure the wiring.
Once you decide the layout, its time to start soldering. I made a super simple jig to assist using an offcut of wood. I decided that each LED would be 55mm from its partner so I marked 2 lines on a small block and then drilled two holes for the LEDs to sit in during soldering. The lines used to cut the wires to size.
Set yourself up with sufficient wire, a jig, quality solder and tools. A fine set of side cutters and a stripping tool are required.
Start by measuring the wire(s) on the jig and start cutting enough to do about 10 LEDs (10 pieces of each colour wire). Using your stripping tool, remove about 3mm from each end. You then need to "tin" each end of each wire. Its tedious but necessary. Once you get into a rhythm it gets faster.
You then need to start soldering LEDs. I place the LED into the depression on the jig and then "tin" all 6 pads. I then 3 solder wires on the "out" side (DO) of the LED. They seem to be pretty tough customers so solder away. I then complete all 10 (or so) LEDs and you now have 10 LEDs with 3 wires.
Next step is to daisy chain them. Solder the 3 "Out" wire tails to the 3 "In" pads of the next LED. Continue until you have 10 LEDs soldered in a chain. I found that connecting more than 10 during the initial build made handling difficult. Build another chain until you have sufficient to complete your requirements.
Once you have all your chains built, its time to connect them and test. Do this BEFORE you affix the LEDs to your chosen garment.
Step 2: Arduino and Power Wiring
I've attached some images which show the wiring and general layout of the electronics. Both the Arduino's 5V output pin and the LED string 5V input are connected are connected from the output of the power regulator. The GND (ground) of the battery is connected to the "Input GND" on the regulator. The LED and Arduino GND are connected together at the regulator OUT GND connector. The other connection is from the LED string "DI" (Data In) connection to the D4 pin on the Arduino. This project is designed to "permanently" connected so I flip the Arduino over and solder wires directly to the pins. If you are going to use a Nano, they have pin holes (if you don't solder in the headers) which make the wiring simple.
One of the most important things to remember is that the combined current draw of the LEDs, on full power, is going to exceed the power supply capabilities of the Arduino's and possibly the USBs 5V power supply capabilities. So the rule is, always have the battery connected and powered on so the Arduino isn't stressed out.
At this point, power on the battery and connect the Arduino to you computer via the USB cable. Fire up the Arduino and load the attached sketch "CheckLEDs.ino"
The sketch uses the "FastLED" library to drive the LEDs. Once they are connected, the first LED in the chain assumes the address "0" and then from there 1,2,3 etc up to the maximum number of LEDs. The sketch provided shows some basic letters that I used on my daughters wedding. I'll leave you to decode what is said.
At this point, once you load the sketch, set "MAX_LEDS" constant in the top of the sketch to the number of LEDs in the test string, compile and download to the Arduino. The LEDs should start to flash from the first to the last. If the LEDs stop at a specific LED, disconnect the Arduino from USB and power off the battery. Check your soldering and make sure you have the LEDs connected correctly between the last one that flashed and the one that does not. Resolder, reconnect and retest. Once your basic test string runs, connect the next small string to the first string reset the MAX_LEDs parameter to the new LED count, upload and keep testing. Once you have all the LEDs connected and tested you are ready to affix the LEDs to the garment and finish the final wiring.
Step 3: Final Assembly and Programming
At this point you will appreciate using the silicone wire. Lay out your LED strip(s) on the garment. Think about where you will place the battery, Arduino, regulator and switch. On my coat, these were in a front left pocket for easy access. I laid my LEDs out in a grid where the first (zero) LED was on the bottom left of the coat. The LEDs then moved up the coat for 9 LEDs as a column, turned 180 degrees downward for 9 LEDs as the next column. Turning up for the next column and continued until I had 7 columns in 9 rows. The layout means that the LEDs are numbered 0 to 8 bottom to top in the first column with the next column being 9 to 17 going down and so on.
To affix the LEDs I initially used a product "Liquid Needles" which is a glue that seems to work effectively however as I didn't want to wait between each LED drying, I opted to sew the LEDs in as well. It just needs a loop of cotton sewn across the wires close to the LED. For the most part, a single set of stitches, as loops, works per LED. You may, depending on your layout uses some loops to hold the wires, especially between the "columns".
Don't sew/glue the first LED until you have connected it to the Arduino/Power. I pierced the fabric and ran the 3 wires through the hole and up to pocket. I sewed the "power leads" on the inside of the coat. Piercing the pocket allowed me to bring the wiring inside and complete the job. I insulated the regulator with some simple tape and then put it all in a small plastic box to contain the power components. You can make your own container, just make sure nothing can short out.
Using the attached ino file as a template, you can now start programming the Arduino for your chosen pattern. I created a very basic spreadsheet (attached) with the layout of the LEDs. It makes it much easier to "draw" whatever pattern you want to paint. Once you have the numbers required, adding them to an array is simple. Use the sample arrays in the attached INO to create your own.
The FASTLed library http://fastled.io contains example you can add to your sketch. The "cylon" section in the example sketch is copied directly from the examples.
Try your creativity - how about adding another switch the changes the order? A push button the cycles through a number of cycles?
BTW - the coat absolutely wowed them at the wedding.