LED Matrix Shirt

by GeekMomProjects in Circuits > Wearables

4700 Views, 13 Favorites, 0 Comments

LED Matrix Shirt

LED_Matrix_Shirt.gif

The LED Matrix Shirt uses soft circuits components to create a low resolution scrolling message board and video game platform that can be controlled with a joystick onto a T-shirt. It was one of my earliest experiences with Arduino and my first time working with multiplexing LEDs. It was a lot of fun to build and I've worn it several times since on different costume occasions. This project definitely pushes the limits of what is practical with conductive thread, but It has held up remarkably well with careful storage.

Components and Planning

led_shirt.jpg

For the basic LED Array:

  • Arduino Lilypad 328 Main Board as a controller(Sparkfun)
  • Rechargeable Lithium Polymer Battery (Sparkfun)
  • Lilypad Simple Power Board (Sparkfun)
  • 50 LilyPad LEDs (we used 48, but they come in 5-packs) (Sparkfun)
  • FTDI Breakout board (for programming the Lilypad) (Sparkfun)
  • USB to Mini USB connector (to connect the FTDI board to the computer)
  • Conductive thread (we went through several bobbins full, and could probably have ordered a larger spool) (Sparkfun)
  • Needle with a large eye to hold the conductive thread
  • A sharpie
  • Fabric to hold the LED Array (we chose medium-weight denim to make sure it was thin enough to sew easily, but thick enough to prevent short-circuiting through the fabric).
  • Thin black fabric to sew over the array, so that we can see the lights flashing, but hide the circuitry.
  • Fabric glue
  • Inexpensive t-shirts (Target!)
  • Black Velcro to attach the LED Array fabric, thin cover fabric, and T-shirt together

For the joystick:

  • Sparkfun Thumb Joystick (Sparkfun)
  • Sparkfun Breakout Board for Thumb Joystick (Sparkfun)
  • Breakaway headers to connect the cable to the Joystick Breakout Board (Sparkfun)
  • 5-pin connector and cable to connect the joystick to the Lilypad (the connector we purchased came with both male and female connectors. We only used the female half) (AllElectronics)
  • Soldering iron and fine-gage solder (to connect the joystick and breakaway headers to the breakout board)
  • Wire cutter to strip the ends of the connector so they could be sewn into the project

Instead of sewing the array directly to the t-shirt, the array gets sewn onto a fabric panel that is attached to the front of the t-shirt with Velcro. It's much easier to sew onto a flat fabric panel than a curved t-shirt, and this allows us to remove the panel and use it in other projects as well.

I decided that an 8 x 6 LED array would be manageable to program with an Arduino. The Arduino LilyPad has only 20 output pins, so controlling all 48 LEDs individually requires a technique called "multiplexing". There are several different multiplexing methods that allow control of multiple LEDs by a smaller number of outputs. This method requires sewing all of the LED cathodes together in rows and connecting all of the LED anodes in columns. To turn on a particular LED in the array, set its row voltage low (ground) and column voltage high. The trick with multiplexing is that, unless the LEDs are in the same row or column, you can only turn on one LED at a time. If you attempt to turn on two LEDs that are in different rows and columns at once, you will end up turning on additional LEDs unintentionally. To get around this problem we can take advantage of a phenomenon called "persistence of vision". The human eye will retain the last image it has seen for some period of time, so flashing a pattern of individual LEDs on rapidly and repeatedly in a sequence will create the appearance of the entire pattern being illuminated at once.

Mark Out the LED Spacing

led_array_fabric.jpg

To keep the array neat, first mark out the positions of the LEDs with a ruler, and cut a piece of denim fabric large enough to hold them. I went for a 1-inch spacing between LEDs. When my son made his version, he opted for 3/4 inch spacing, which I think looks neater, but since the rows and columns are closer together, it makes it harder to avoid short circuits.

Adding the LEDs

Using fabric glue, lightly glue down the LEDs on the marks, so that they will stay in place while sewing them. It is best to align the LEDs at a 45 degree angle to help avoid crossing threads when sewing the columns and rows. I opted to orient the positive sides of the LEDs up for the columns and negative sides of the LEDs downwards for the rows (see pictures in next section).

Sewing

led_array_two_rows.jpg
matrix_array_complete.jpg
lilypad_closeup_sewing.jpg
cover_panel_front.jpg
LED_panel_and_cover_panel.jpg

The LEDs:

When connecting the LEDs, we started sewing the first two rows with the conductive thread - looping several times through each LED anode to ensure a good connection. We also attached the power supply to the "+" and "-" pins on the Arduino. The conductive thread is fairly thick, so we used a needle with a large eye. We used a simple stitch to sew the rows primarily on the top side of the fabric, planning to cross the columns under the rows to avoid short circuits. When tying off the thread at the end of a row or column, I tied a small knot and used a drop of fabric glue on the knot, so I could trim the thread close to the knot without risk of it unraveling. Before sewing the rest of the rows, we sewed two columns and ran a test on the completed circuits containing four LEDs. The test worked well, so we glued the rest of the LEDs and sewed the rest of the columns. I wrote a simple program to turn each LED on in turn, and we periodically tested the LEDs as we sewed to make sure the connections were good and there were no short circuits. We sewed the power supply board with the LiPo battery to the fabric, and sewed the connection to the Arduino LilyPad. We wound up using pins {A0, A1, A2, A3, 3, 4} for the anodes (columns) and pins {5, 6, 7, 8, 9, 10, 11, 12, 13} for the cathodes (rows).

The Fabric Panel:

Up until now, we’d done all sewing by hand with needle and thread. For this next part, I brought out my sewing machine. After all of the circuits were sewn onto the denim fabric panel, I hemmed the edges of the panel for neatness, and sewed Velcro strips along the top and bottom edge of the front of the denim fabric. I then sewed a cover panel for the LED array out of sheer black fabric, attaching two sets of Velcro strips to the cover panel to hook into the Velcro on the LED array. This allows the LEDs to shine through the cover panel while concealing the circuitry. I happened to have some silver edging in my sewing box, so I sewed a rectangular “window” on the cover panel around the area covering the LEDs. This emphasized the LED panel and gave it some visible boundaries.

The Joystick

joystick_breakout_board.jpg
joystick_connector_cable.jpg
joystick.jpg

Once the LEDs and power supply were in place, we decided that we could make games if we had a controller, so we found a small joystick, the Sparkfun Thumb Joystick, with two discrete directions and a center button. To make it easier to attach to the shirt, we soldered it to the Sparkfun Breakout Board for Thumb Joystick. Then we had to figure out how to attach the joystick breakout board to the LilyPad. We didn't want to sew the joystick directly to the shirt, but rather leave it attached by wires for accessibility, and so that the wearer wouldn't end up getting groped by someone who wanted to play games with the shirt. We searched around until we found a 5-pin cable to attach to the 5 pins of the breakout board. (The 5 pins represent power, ground, xpos, ypos and button pressed). To make sure we could read the full range of x and y positions, we attached the x and y position inputs to the analog inputs on the LilyPad (the digital inputs can only read HIGH or LOW as an input). The 5-pin cable had a female connector, so we soldered 5 breakaway header pins to the female outputs on the breakout board. The connector then attached snugly to the header pins. We stripped the wires on the other end of the 5-pin cable, and rolled them into small loops (see picture) and sewed them to the shirt, then connected them to appropriate output pins on the power board and LilyPad with conductive thread. We attached the joystick button to Pin 0, the x controller to Pin A4 an the y controller to Pin A5. In the programming we wound up polling Pins 0, A4 and A5 for input in the main loop. I found out later that the Arduino LilyPad has hardware interrupts on Pins 2 and 3, so if I did this project again, I might have used a hardware interrupt to process button pushes.

Coding

When the sewing is complete, it's time to download the program to the Arduino LilyPad. When deciding what the display should do, we knew that we definitely wanted to be able to scroll text, and also add some games or animations that would look good at the relatively low 8x6 resolution. In the end, we made a game of "Pong" which worked in either automatic or interactive mode, a simple game of "Snake" and a feature that allowed the shirt to display the phrase "Ask me a question", and then display "Yes" or "No" depending on which way the joystick was pressed.

Programming an Arduino board is easiest with the Arduino IDE Software. I wrote the code in C++, creating a base class with some basic matrix display properties and to handle the multiplexing, and create a child class for each game function of the shirt. To make scrolling text work, I found a low-resolution 5x5 font here. My coding was a little rusty for this project, but it works.

The code contains a chooser function that allows the user to select which feature to run, and the looping function (standard in Arduino) polls the joystick for button presses to toggle the chooser. If no button is pressed, it loops through whichever led matrix game/feature is being run at the time. You can download the code I wrote from the link in this step.

Downloads

Results!

Arduino LilyPad LED Matrix T-Shirt