I can wear my heartbeat on my sleeve.
Actually, I meant to put it on my sleeve, but turns out that sewing something inside of a sleeve is colossally frustrating. So it's along the front zipper.
The heartbeat hoodie is a blend of two things I wanted to play with: Soft circuits and consumer heartbeat monitors. I first made the basic LED hoodie, and later added on the heartbeat feature. And since the basic LED hoodie is easy and fun in its own right, I'll describe how I made that first, followed by the heartbeat addition.
Part I: Basic LED Hoodie
It all started with a LilyPad Arduino prototyping kit, I picked up at a conference from the folks at Sparkfun. It comes with everything I needed to get started putting circuits into clothing, including a sewable Arduino (the LilyPad), conductive thread and needles.
To make a line of LEDs I could animate, I also got two bags of red, sewable Lilypad LEDs. Here's the whole parts list:
Basic LED Hoodie Parts
Sewing My Soft Circuits
At the wise suggestion of the Sparkfun folks, I made several drawings to figure out how I might run the conductive thread to each LED without crossing the wires -- which would short them out. It also helped make sure I had enough spots on the LilyPad for everything I wanted to add.
Here's a clear version of what I ended up with. Note that the LEDs are on the other side of the fabric, which is important to remember when you're wiring them up!
Each of the LEDs needed to be connected to the Arduino ground and one of the LilyPad's free "pins" (really they're holes, but in Arduino-speak they're called pins). I ran the ground thread from the LilyPad up the inside of the zipper to each LED. Each LED then got its own route to its controlling pin on the LilyPad.
I positioned the LilyPad behind one of the front pockets, which made for slightly trickier sewing but helped hide lots of the stitching.
Sparfun has a whole tutorial on soft circuits, or e-textiles. Some pointers I found helpful:
- Don't use more than an arm's-length of conductive thread. It gets unwieldy otherwise.
- Using hand stitch that didn't pick up much of the fabric helps hide the thread.
- Remember that LEDs are directional! Be sure the correct side is connected to ground (-).
You need to wire up your LilyPad to a computer to get the code on board. Sparkfun has great information about how to do that.
Here's the code I used to animate the LEDs:
Then I plugged in the LiPo battery and got it going!
Part II: Heartbeat Add-on
I've always wanted to play with a Polar heart rate transmitter, which I had heard was something one could get data from. Turns out, Adafruit provides a great little kit for doing exactly that, transmitter included.
The kit comes with "male" headers, or pins, that you solder onto the receiver board so it'll connect to a breadboard. But I wanted to connect simple jumper wires to the receiver, so I got a right-angle female header and pulled out three of the pins (you only need the remaining three).
Heartbeat Add-on Parts
- Heart Rate Educational Starter Pack
- Header 6-Pin Female, Right-Angle
- Bigger LiPo Battery (to last longer)
- Jummper wires
The heart rate receiver board requires a little soldering (great info on that here if you're just starting out) to get the header onto the board.
Also, that little board isn't really made for sewing onto fabric, but I got some thread through the holes on the surface and made it work.
I decoded some of the wiring details from one of the example projects on the Adafruit site. I connected the ground on the heart rate board with the ground (-) on the LilyPad, the center pin on the board with power (+) on the LilyPad, and the remaining pin on the board with the Pin 11 (really a hole) on the LilyPad. To make things secure, I soldered these wires onto the LilyPad.
Here's my wiring diagram, adding on to the one above:
The code below draws from the same example project, but modified for my setup. Also, I do some detecting at startup that checks to see if there are any heartbeats detected. If not it works as before with a simple LED animation.
I attached the battery, flipped the little power switch on the LilyPad and put on the Polar band. It's made for running, and assumes a certain amount of moisture on the skin, so I had to moisten the back of the strap and move it a bit to get it to register. But then it worked!
If I were doing this again, I'd probably consider stringing together a bunch of NeoPixel wearable LEDs. They link up in a a way that lets you address them with just one pin of the Arduino.