I've been invited to go to a friends 40th birthday party and want to take a present that will be appreciated. He is a bit of a tech head and has also been known to get drunk and shout PANTS! a lot. So I've decided to make him a pair of flashing LED disco pants.
The idea is that the LEDs will be controlled by an Arduino so they can be flashed in sequence. To achieve this each LED on the pants will be separately addressable but to do this without a large number of unnecessary wires in the undergarment I will be using the Charlieplexing method to power them. There will be four strings of 12 charlieplexed LEDs
and each string of 12 LEDs will only need 4 wires. So a total of 12 wires will be needed to control the whole array of 48 LEDs.
The other advantage of multiplexing a Charliplexed array of LEDs is that only one LED per array will be ON at any one time. The down side to this is that they will have to be rapidly flashed or multiplexed to give the illusion that more than one is on at a time and that is more complex code on the arduino. However the big benefit is in power saving as there will be a potential of 4 LEDs on at any one time (one for each 12 LED string) which will lower battery consumption enough to get away with using a 9 volt battery.
Step 1: Materials
I only had this idea a week before the party so I had to use materials I had in my junk pile and 'left over bits' box. I'm glad I buy LEDs in bulk numbers.
Pants, Good old fashioned Y fronts are the best
LEDs Blue (36) and Red (12)
Resistors (Red 130 Ohm) (Blue 80 Ohm)
Heat shrink tubing.
Computer and Arduino IDE
Pre-programmed arduino processor.
Big assed needles
Sewing machine (but you could probably sew by hand as an alternative)
Plus the usual small workshop tools.
Step 2: Pants Selection.
First was to select some appropriate underpants. As I normally go commando I didnt realise the choice was so vast and I very quickly settled on the traditional 'Y' fronts basically because I childishly think that they will have more comedic value. Especially as I will be able to illuminate the 'Y' with more LEDs
On a more practical note the thicker seam around the edges and the seam forming the Y will also provide some extra thickness to hide the wires and LED legs in.
I did contemplate a pair of boxers which being loose would have potentially made them more comfortable to ware but the concept of an LED Y on them won the choice.
Step 3: LED Brightening
The high brightness LEDs I was using have a very directional viewing angle so I scuffed up the plastic surface with some sandpaper. You can see that after this the LED is bright from angles. It was tedious to do this for all 42 LEDs but very well worth the effort.
This is a photo of the 10mm LEDs I used to test the idea, I used 5mmLEDs for the actual project.
Step 4: LED Charlieplexing.
Because space is at a premium and there are only a limited number of pins available on the Arduino I have only two choices if I want each LED separately addressable. The first choice is to use a shift register or dedicated LED driver chip but this would have in its self needed to be housed in the pants and connected to each LED which is not the level of complication I want to go to in this project., The other way is to use Charliplexing. I know that on its own charliplexing can only drive one LED at a time but if they are then multiplexed then they can all appear to be ON.
Diagram of charliplexing.
The description of how charlieplexing is worth its own Instructable and there are a few really good ones to check out.
One benefit of charlieplexing is that each string of 12 LEDs can only have on illuminated at a time. So with the LEDs getting 10Ma each 4 strings of 12 LEDs will only be using 40mA plus the arduino power. This means a single 9 volt battery will last all night and bulky AA batteries can be avoided.
Step 5: LED Location
As these are supposed to be made for maximum comedic value for a party I chose to simply highlight the outline of the pants and also the 'Y'. I did contemplate random positioning of the LED but gave up as that would simply be spangly pants with little humour.
There is 4 strings of 12 LEDs
One around the left leg hole
One around the Right leg home
One around the middle
One on the 'Y'
The left leg and right leg holes will be common and display the same pattern. The Y and belt line will be separate.
Step 6: Sewing the Tape On.
The cotton tape is very important as it will enclose the wires and LED legs. This will make them more comfortable to wear and help hold the LEDs in position. I sewed on one side of the tape before fitting and wiring the LEDs. The other side will be sewed in position after they have been thoroughly tested for wiring errors.
NOTE: It is important to stretch the elastic as you sew the tape on. If you don't do this they wont stretch and you wont be able to get them on when they're finished.
ALSO NOTE: The cotton tape is fitted on the inside of the pants!
Step 7: Mounting the LEDs
This is where the big assed needles come in useful. The LED legs are not strong or sharp enough to pass through the elastic in the band around the top of the pants or around the leg holes. This is over come by poking the two big needles through to make a pair of holes that the LED legs can pass through.
You'll have to measure the waist of your pants and mark out 12 evenly spaced marks so the LEDs are positioned evenly.
Step 8: Connecting Up the LEDs and Arduino.
The LEDs are then soldered to wires as marked out in the charliplexing circuit diagram. The LED legs are cut short and bent over to stop them falling out. Heat shrink is added to provide some extra physical support for the LED and to cover any sharp wire ends.
Take care to give some extra wire between LEDs to allow the elastic to stretch! I gauged how much extra to leave by stretching the elastic and marking the wire with a pen before cutting it.
The resistors were soldered 'in-line' and then protected with some heatshrink.
I used a 9volt battery to test that each LED lit up when it should. I made a few mistakes and had to reverse a couple of LEDs before it was perfect.
The Arduino was sewn into place on the outside side of the side pants and the 9 volt battery clip was sewn onto the other side.
The whole process of soldering and heat shrinking took about 5 hours.
Step 9: At the Party.
The Pants were brilliant even though I didn't get the flashing pattern I wanted due to lack of programming time after the mammoth 5 hour soldering frenzy. Everyone loved them and in the darkness of the farmers field and bonfire the effect was dazzling.
They were difficult to photograph as the camera flash made them look off and the digital camera would not focus in the dark. The video is the only working shot of them that was made before they were broken.
The only problem is that at some time just before daybreak birthday boy fell over and landed arse first on the Arduino and smashed it rather badly which was a shame but at least they survived for most of the long dark night hours.