SparkFun Support and Front Desk will be closed on Thursday 11/14 from 1-2:30pm for a company event. Please plan to pick up your orders before or after this timeframe.
This has "Entrepreneur of the Year" written all over it.
I cannot begin to describe how much fun this costume was to wear out in Boulder over Halloween weekend. Felicia and I got countless high fives, picture requests, and just blank gaping stares. Remember, it's not the technology, it's how you apply it.
There are three rules to any costume I build:
Of course there are exceptions to each of these, but experience has taught me that it better be a really stellar costume idea before I consider breaking any of the rules. The Mixed Signal Costume fits my three rules of costumes swimmingly.
I got the idea of being a traffic light when driving in traffic in early October. It seemed simple enough: dress in yellow, get some LEDs, make them blink. LEDs even come in red, yellow, and green. It's perfect! I could even build one for my girlfriend. Oh wait - maybe they could talk to each other! And that's how crazy ideas get started. Talking to my girlfriend Felicia, I actually sold her on the idea (it helps that she's studying e-textiles at university). We quickly decided to start ordering parts in early October knowing that we had a massive build ahead of us.
The goal of Mixed Signals: When I was red, Felicia would be green and we would progress through the normal light sequence. She's always sending me mixed signals (snicker). We would essentially be a full intersection of traffic signals. This required two traffic light costumes and a wireless link between them. I used two XBees, two Arduino Pro Minis, and a handful of MOSFETs and LEDs to pull it off.
Here is a short video showing the two costumes communicating wirelessly with each other during the build phase. When one costume is green, the other is red.
The first decision was the lights. LEDs are easy enough to work with and can be driven from a small battery source like a Lithium Polymer battery. I knew the super bright red, yellow, and green LEDs that we carry would work, but they are painfully bright points of light. How were we going to diffuse the light through something to make it look reasonable?
Why not use a traffic light lens? The lenses we used are actual pulled-from-service traffic light lenses and came from Ebay. It seems the 12" diameter was the most common (pictured above), but look at how massive that thing is (a lawn chair is in the background)! I had not realized how big stoplights were before starting this project. After pulling out a tape measure, it became obvious that three 12" lenses would rival our height. Luckily we found some smaller 8" diameter lenses.
We were worried about the weight of glass and the fragile nature. With more luck, there were a few plastic versions available. This helped lighten the load considerably. We picked up two sets of plastic R/Y/G lenses for around $35.
The lenses took forever to come in (thank you Ebay seller), so in the mean time we started trying to figure out how to build the electronics behind the lenses. The LEDs were simple enough, but we weren't sure how many to use. Use too few and you'll be able to see obvious dots, use too many and you quickly drain your battery and blind everyone around you.
Felicia made the unilateral decision for 28. It looks reasonable enough. Another problem is something called "the tyranny of connections" or more commonly known as "damn that's a lot of solder joints". I was debating laying out a PCB but an 8" diameter PCB is atrociously expensive, heavy, and would take too long to have fabbed.
To build the light, jam the LEDs through the front side, and in a spiral fashion solder all the long legs together (long legs are the anode or +) and all the short legs together (the cathode or -). Finish off the spiral with a very high wattage resistor (2W 7.5Ohm) and a easy disconnect JST connector. Each light required about an hour of point-to-point soldering. It was evil and Felicia was awesome in tackling almost all of it.
Heed my warning: The next time you invent the biggest blinky in the world, carefully consider the tyranny of connections. Ours was a long build!
Shameless plug of a SparkFun product: I cannot stress enough how important these JST wire assemblies are. The wires are terminated by a professional instead of my clumsy hand and the connector comes with the cable so I always have the correct amount of both. When a costume breaks it's usually in the connectors or the solder joints. Making sure you've got good, solid connectors and troubleshooting a wearable project will be much easier.
After the LEDs are soldered, she added a layer of iridescent fabric (slightly transparent) to further diffuse the light. I've never seen this done before and it helped a surprising amount! Because the 5mm LEDs are completely cool, we could do this without worrying about melting the plastic.
Note the two power resistors instead of one. I tried two 7.5 Ohm resistors in parallel (wired next to each other) which meant the resistance went down to half or about 4 Ohms. I wanted to potentially drive the LEDs at their near max current. Each LED is not supposed to have more than 20mA running through it. This meant 28 LEDs * 20mA per LED or 560mA! That's a lot of power in my book.
Because all the LEDs are in parallel, they are going to act a little oddly. Because each LED is slightly different (due to manufacturing tolerances), one red LED may have a forward voltage drop of 2.2V where the next one may be 2.5V. This means each LED is going to pull slightly different amounts of current when exposed to a set voltage source (my battery). So in the end, I aimed for about 400mA giving me a save buffer to avoid potentially burning out any one LED. I did calculate out the required resistance:
(3.7V - 2.4V forward drop) = 1.3V
V = IR so 1.3V = 0.400A * R
R = 3.25Ohm
As with any real-world situation, things change and my trusty multimeter had the final say. Using two resistors in parallel I was able to drive the red LEDs with a bit more brightness. Also, as the battery drains the pack voltage will drop from about 4.2V to 3.7V down to around 3.2V before it shuts off.
I did note that even though the resistors were beef-cake 2 Watt resistors, they still heated up like crazy:
Power = VI
P = 1.3V * 0.400A = 0.52W
0.52W is a lot of power. Luckily this was uncomfortable to touch, but not hot enough to melt anything.
Side view of the stack-up with a yellow lens, a side rubber grommet, the fabric diffuser, and lastly the cardboard with LEDs. Felicia was paramount here. She made these into wonderful self-contained lights.
Add a layer of fabric to protect the exposed wires from shorting on the snaps.
There is a thorough use of electrical tape to attach the cardboard backing to the rubber grommet. The snaps are glued into place. Feel free to use lots of hot glue to prevent shorting and to secure the hold of the stack.
Next was the small overhanging piece that helps increase the contrast between the surrounding light. Again, Felicia used her limitless recycling ninja skills to locate raw materials.
Note the tabs which help anchor to the rear of the lens.
Apply copious amounts of fabric glue then layer the appropriate shade of yellow to match your costume on to the cardboard. Adhere the black cloth to the inside and yellow to the outside of the diet cola box of your choosing.
The great thing about the Dr. Pepper box is the thin nature of the material allows us to shape the box around the lens while still having rigidity for the shade overhang.
With a little work you will end up with one complete light. Now multiply by six! It was a multi-day process.
But in the end, we had some beautiful looking, very thin, very light weight traffic lights. But what do they look like lit up?
Here you can make out the various bits of my workbench. The brightness of the LEDs is so much that it forces the aperture of the camera to automatically close. It turns out 28 LEDs was enough!
Wait - but where does one find a yellow jumpsuit? After pouring over many websites I sent an email to find out if I could order the perfect jumpsuit in yellow. The response I received was un-encouraging:
I am looking for a basic yellow jump suit/coverall without reflective tape.
Do you have anything available? Any creative options?
The blunt response:
Ok then, thanks for your help. Off to Ebay I go! Obviously this costume was supposed to happen because this is what I discovered:
From Ebay: "Yellow Overalls - Sheriff's Squad Flight Suit, from the 1950s or 1960s."
Kamrowski?! Heck yes we're doing this.
Condition: Beautiful vintage condition. Unaltered. No flaws. No visible rips, holes, tears or stains.
Sadly, the flight suit arrived with all the insignias and patches removed. Sad Kamrowski. But in the grand scheme of things, it was probably for the best since the patches would have distracted from the costume.
Routing the wires was easy enough by cutting a few very slight holes. The flight suit had enough pockets to house the electronics. You can also see the magnetic snaps to hold the lights on the jump suit. This type of snap is commonly found on purses. They tended to work better than the mechanical snaps that Felicia used and we recommend them if you're thinking of attaching things to wearable things (you know, things!) that need to be removed and re-attached often.
A quick dry run of the snap system and we were ready to test the electronics.
This was the first project in which I needed to use a MOSFET. Sure, they taught us all sorts of things in university, but you never really learn something until you use it, right?
Disclaimer: I really don't know much about technical electronics. I have my time split between business stuff and actually designing things. Take this tutorial with a grain of salt.
A MOSFET is an impressive little device. It works as an electronic switch. MOSFETs allow you to turn a high-power thing on and off from a low-power thing. Where a transistor can turn on/off a motor or an LED of reasonable size (let's say 200mA max) a MOSFET is capable of controlling much larger loads (20,000mA max is not a problem). Because I was driving 28 LEDs with a max current of 560mA, I knew a normal transistor might not be able to handle that sort of load. This was a great project to try a MOSFET solution.
The weirdest thing about MOSFETs is the very odd naming nomenclature. On an N-Channel MOSFET, the 'source' is connected to Ground and the 'drain' is connected to the thing you are trying to control.
A MOSFET is quite capable of providing amps of power. Luckily our 'RAW' power in this example is a Lithium Polymer that can do multiple amps before it has problems. Note that with this generic N-Channel MOSFET, any signal above about 3V will cause the MOSFET to basically turn completely 'on'. This is nice because our Arduino Pro Mini is powered from the 3.7V LiPo and has digital signals of 0V to 3.3V. R1 is important as the pull-down resistor which pulls the gate to 0V if no signal is present. We don't want our lights doing funny things if the microcontroller is off in the weeds.
The general differences between a MOSFET and a transistor:
Here you can see the two control boards (the lower unit is still under construction). One board goes into each costume. We have three MOSFETs on each board able to turn on/off each Red/Yellow/Green light. The blue control board is an Arduino Pro Mini. Small, thin, easy to program in Arduino - they're pretty fabulous for wearable applications where you can hide it. LilyPad would have been an option but I was pushing way too much current to use conductive thread. Note the JST connectors. This allowed us to easily connect/disconnect batteries and lights so that we could put on or remove the costume.
What does the blue knob do? After noting how bright the lights were, I decided to add a trim pot with knob to control the overall brightness of the costume. By doing an analog reading of the wiper of the trimpot, I could get a value from 0 to 1023. I then mapped that to a ratio of 0 to 255. I then used that number as a maximum value for the analogWrite() number that I PWM'd the lights with. A software trick that worked pretty well.
This feature turned out to be crucial when going from large outdoor spaces into closed spaces of the Catacombs Bar in Boulder. Imagine being shoulder to shoulder with someone with a super power flashlight attached to their chest at eyeball level. It was important to be able to turn down the blaring brightness of the costume on the fly - the blue knob allowed us to do so.
Here we have the first trial run of the hardware. You can see the 6Ah battery (6000mA hour) running the system. This should allow the costume to run for more than 10 hours and it's rechargeable!
There are some important lessons here. Label your connectors! It would be easy to accidentally attach the battery where the light should be. With a little bit of sharpie and heat shrink, we are able to help prevent accidental damage.
The great part is that wireless is super easy. I used two XBee series 1 modules and a couple XBee regulated breakout boards that plug directly into the Arduino Pro Minis. Power up the system and pass characters back and forth like they were connected with a serial cable. Simple. The final sprint came down to programming. With a good hardware setup, programming is relatively straight forward on a traffic light:
You can download the code here. It may look a bit complicated because I combined both the master and slave firmware. My costume would run an internal timer and when the time was right, it would broadcast a serial character such as 'R' to Felicia's costume to tell her costume to switch to red. At the same time, my costume would then turn to green.
But what happens if Felicia and I get separated? What if she decides to run off with a Brett Favre look-alike and she's out of range of the wireless? Her costume still needs to operate so I built in a time-out system: if a command is not received from the master system in a certain amount of time, go into independent mode. But then if you hear a valid character again, synchronize and reset the timeout timer. It gets a little crazy with all the exception cases but it made for a carefree costume.
And just because we can, I added a 'disco' mode button. The arcade button was connected to a general input pin and the system checked to see if this button was pressed.
When the button was pressed, both my costume and Felicia's costume go into disco mode for a few seconds. I really thought this remote triggering of a costume would be exciting to bystanders but the excitement was less than expected. It was neat but most folks were so blown away by the simple fact that our costume lit up that they really didn't get the whole wireless interaction part. In fact, we heard a few folks tell us 'if only we could get them to light up at the same time'. Ugh.
Good solder connections are key. Moving around flexes connections a lot and can lead to broken circuits.
Be careful when stripping wire: a nicked wire can kill a costume. As the wire flexes a nick will create a weak point which may lead to a broken wire.
In a high contrast situation (such as bright LEDs at night) it is very helpful to have a quick and easy mechanism to dim the lights. We often turned down our lights when we were indoors and close to other people and turned them back up when outdoors on the sidewalk.
If you have multiple connectors of the same type on a board, label or color code them clearly.
Do one thing well - don't overdo the features of your costume. People were totally blown away by the fact that we lit up and really looked like traffic lights. Only a few people really got that they were wirelessly connected. Adding the disco button entertained me, but it was lost on everyone else.
How much time did we spend on it? Perhaps 30 hours between the two of us. Yes, that's crazy. But it was a labor of love. And the looks and words of encouragement from onlookers were unbelievable. It was an fantastic Halloween 2010!
Thanks for reading!