×

SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.

Mixed Signal Costume


Mixed Signal Costume

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-19.jpg
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:

  1. While wearing the costume it has to be easy to drink beverages. This is more than just an alcoholic requirement. In many cases it's rather important to be able to eat, hear, see, talk, etc. I've built a handful of costumes like the cardboard-box-robot that really put a damper on the night when you trip over a bike rack. Wearing a costume should be comfortable, not dangerous.
  2. It must be warm. I can't tell you how many people I see turning blue on Halloween. Yes, being a cross-dressed gymnast in a skintight floral colored leotard can be fun, but when it starts to sleet you may be in for a short night.
  3. You should not have to completely disassemble a costume to use the restroom. Think ahead.

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-22.jpg
Out on the town.

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.

Building the Costumes

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?

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-23.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-1.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-2.jpg
Like MacGyver, Felicia raided the recycling bin and re-purposed a cardboard box.

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!

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-24.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-3.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-4.jpg
The red LEDs getting rigged up.

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.

http://www.sparkfun.com/tutorial/TrafficLight/MOSFET-Tutorial-2-M.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-5.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-6.jpg

Add a layer of fabric to protect the exposed wires from shorting on the snaps.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-7.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-8.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-9.jpg

Note the tabs which help anchor to the rear of the lens.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-10.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-11.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-13.jpg
Snaps and overhanging shade attached.

With a little work you will end up with one complete light. Now multiply by six! It was a multi-day process.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-12.jpg

But in the end, we had some beautiful looking, very thin, very light weight traffic lights. But what do they look like lit up?

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-14.jpg
Yeeesss!

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-15.jpg

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!

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-16.jpg
Felicia found a low-cost (is cheap a dirty word?) yellow jacket online. Attaching snaps to hold the lights in place...

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-17.jpg
And we are one step closer to directing traffic...

The Jumpsuit

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:

Hi,

I am looking for a basic yellow jump suit/coverall without reflective tape.
Do you have anything available? Any creative options?

-Nathan

The blunt response:

No yellow.

Thank you,
sales@allseasonsuniforms.com
847-952-9860

Ok then, thanks for your help. Off to Ebay I go! Obviously this costume was supposed to happen because this is what I discovered:

http://www.sparkfun.com/tutorial/TrafficLight/FlightSuit.jpg
From Ebay: "Yellow Overalls - Sheriff's Squad Flight Suit, from the 1950s or 1960s."

http://www.sparkfun.com/tutorial/TrafficLight/FlightSuit2.jpg
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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-18.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-19.jpg
Do the magnetic snaps hold? Yep!

A quick dry run of the snap system and we were ready to test the electronics.

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.

http://www.sparkfun.com/tutorial/TrafficLight/MOSFET-Tutorial.jpg

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:

  1. MOSFETs are 'voltage controlled' devices.This means they don't require a current limiting resistor on the base like transistors do (more simple circuits).
  2. MOSFETs handle higher current but don't handle analog inputs gracefully. In other words they are very good at being on or off, but not in-between such as audio applications.
  3. Anything above 3V on the gate causes the MOSFET to turn on. This is handy because it allows you to control big stuff from a relatively low-power microcontroller.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-0.jpg

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-20.jpg

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!

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-21.jpg

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 Software

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:

  • Change to green, wait for a 8 seconds.
  • Change to yellow, wait for 2 seconds.
  • Change to red, wait for 10 seconds.
  • Repeat

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.

Lessons Learned

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.

http://www.sparkfun.com/tutorial/TrafficLight/StopLight-22.jpg
A walk button you say? Maybe next year.

http://www.sparkfun.com/tutorial/TrafficLight/stoplight1.jpg

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!

-Nathan

Comments 17 comments

  • Member #282584 / about 13 years ago / 1

    Could you reply with a link for the exact green control boards you used? Thanks!

  • JKWON / about 13 years ago / 1

    is there a document that contains the list of things we need to buy?

  • Vert / about 13 years ago / 1

    First off, AWESOME costume!Really love it!
    Second, just a small suggestion. If you two are together then make them opposite of each other. When you are red she is green like in an intersection. Timing would change and one xbee would send a trigger to the other to keep them in sync. Say red for 10 sec, green for 8 and yellow for 2. Red should stay on for the duration of green and yellow.
    Not only is it pratical but ironic as well. Showing how man and woman are so opposite!
    Great job!

  • Mark D. / about 14 years ago / 1

    I would like to point out a problem with your terminology:
    "... Where a transistor can turn on/off a motor or an LED of reasonable size (let's say 200mA max) a MOSFET is capable..."
    MOSFETs are a kind of transistor. It stands for Metal Oide Semiconductor Field Effect Transistor.
    What you are referring to when you just said transistor is "BJT" (Bipolar Junction Transistor).

  • Colecago / about 14 years ago / 1

    I know its immature but, seeing a giant light over your crotch is hilarious. Great job otherwise.

  • rene_bohne / about 14 years ago / 1

    Nathan,<br />
    <br />
    I guess you were inspired by the LumiNet jackets at sketching09, but this is the next level! Amazing tutorial and great project!

  • Calif / about 14 years ago / 1

    You know you're dying alone when even electronic geeks go to dive bars for fun.

  • Davidjh / about 14 years ago / 1

    Second half of the message:
    2) How FAST you can drive the gate determines how fast the mosfet switches, and how long it stays in the linear reagion, dissapating much power. Keeping it simple, the gate of a mosfet looks like a capacitor more than anything else. It takes time to charge AND discharge this capacitor--when the cap is charged it turns fully on, when it is fully discharged, it is fully off. When you are charging or discharging this cap, you are in the "linear" region, and dissapating power in the mosfet, which can overheat and destroy them, so you want to minimize this time. In this application, you don;t need high speed switching, so you can mosty neglect this property---you start trying to switch too fast, and you start getting in trouble. I realize there are a lot of oversimplifications here, but this is just a "get your feet wet" tidbit that hopefully will clear up some confusion without adding a bunch more. :) Awesome costume, Nathan--you rock, your company rocks, and I hope your coffers will always be overflowing! Thanks for making a GREAT company!

  • Davidjh / about 14 years ago / 1

    Mosfets, like any other piece of thecnology, can be either easy or hard--it all depends on the application. Using a mosfet as a low speed switch, like in this application, is fairly trivial. Using a set of N-channel mosfets in a high speed high power H-bridge to power a polyphace AC servo motor is hard. :) There are a couple of main points to remember when using mosfets:
    1) To turn on an N channel mosfet, you have to bring the gate voltage ABOVE the drain voltage. In this application, most of the voltage is dropped across the LED's and the resistors, so raising the gate to above 3 volts (there is a minimum "threshold" voltage, that is dependant on the semiconductor properties) is enough to fully turn on the Mosfet. If you had swapped positions of the mosfet and the LED and resistor pair, it wouldn't work, unless you used some other tricks to raise the gate voltage above the drain voltage (Vdd, in this configuration). For those cases, that is why they make special mosfet drivers to make life easier.

  • rjimenez / about 14 years ago / 1

    Nate, congrats on another very cool project. I can't agree more when you say it's no the technology but how you use it.
    I have a question on the technology though :) The MOSFET. You say that bringing the gate to about anything above 3 V will turn it fully on. Is that also the case if the drain is set to a different voltage, say 12 V, or is it because it is close/same as Vcc?
    The product page for the MOSFET seems to imply it would still work ("drive a car headlight lamp from your Arduino!" :)) but I know very little about teorethical electronics, and Wikipedia's entry on MOSFETs remains a bit cryptic to me (perhaps a few more reads at earlier times of the day may help :)) So any kind of confirmation/clarification would be greatly appreciated.

  • Scott14 / about 14 years ago / 1

    I watch the new products list pretty often just to get new ideas for projects. Most of the time, it's pretty easy to figure out why they chose the new products. Once in a while you see something that makes you go Hummm.
    So, now I have an answer to why MOSFETs. It seemed rather random to me at the time. Who would have thunk - wearable stop lights !!!

  • dargs / about 14 years ago / 1

    Love it... How about some LDRs sensing the light output of an actual set of traffic lights and transmitting that to your costumes.
    When you walk past the intersection, you could sync up with the other (16 odd) sets of real lights! :)

  • N.Poole / about 14 years ago / 1

    so much good...
    and now I know that next Halloween, I must be a wearable drum machine.
    thank you.

  • dksmall / about 14 years ago / 1

    No audible signal change indicators for the blind????? :-)

    • Dah! Not this time :) Maybe I could add a MP3 theme song for next years suit...

      • Member #715005 / about 9 years ago / 1

        Hey Nate,

        My wife and I are going to see Widespread Panic for Haloween this year. They have a great song called "Stop-Go," and were thinking along these lines when I stumbled upon your awesome costumes.

        Do you still have them?

        I couldn't make these myself; want to loan or rent them? Seriously.

        Hope to hear from you either way.

        aikox2 AT G mail

  • AndrewOrtman / about 14 years ago / 1

    Thats amazing! I always have problems with prototyping with wires, and it seems to get a little messy with the electronics. Maybe Im just a bit OCD. Why not fab out a board for the electronics (xbee, microcontroller, battery connection, etc.) instead?
    I think it would be a neat teaching kit for microcontrollers and simple wireless communication too :)