Heartbeat Sweatshirt: Wearable

For my wearable project, I decided to expand upon the idea for displaying the heart beat with LEDs. The materials I used were a POLAR heart sensor (with a chip that hooks to the FLORA), a FLORA arduino, Adafruit neopixels, conductive thread, polymer lithium ionbattery, a black hoodie, and embroidery thread.

To start with, I chose to first embroidery the hoodie with a vein like pattern with the origination source at the top of the hoodie. I went with a mixture of three different blues in order to be compatible with the color of the neopixels.

Once I finished embroidering the hoodie, I took to sewing the entire circuit. I put several neopixels throughout the vein structure in order to keep that illusion. The conductive thread I worked with was very stiff and sometimes knotted around itself. The annoying part of working with thread and neopixels is that you have to keep the connections short in order for the circuit to work and you have to continuously tie it off. But the final result is worth it.

With the circuit sewed, I connect it to the FLORA and the FLORA to the computer in order to upload code that would allow the neopixels to flash when a heartbeat was detected.

Here is the final result. I had an incredible time working on this but did encounter a few issues that are enough to tear your hair out. The main issue was that when I first plugged the FLORA into the computer was that only the first neopixel lit up. I had to go in and restrengthen the first connection and had to hunt throughout the circuit in order to find where the connection was being led off course. Turns out, at the very bottom, a neopixel had it’s connection looped underneath the power side and I had to cut the connection and re-thread it. The conductive thread is also not meant to be used with extremely long circuits as the connection will not be as great as the beginning connection. Everything though works and while the lights do flicker when the sensor is not turned on, a beat is still detected and it works perfectly.

Video Demonstration

Arduino Sketch

/*
Heart Rate Badge with heart-shaped neopixel display
written by Becky Stern for Adafruit Industries
Based on sample code from 
http://learn.parallax.com/KickStart/28048
*/

#include 

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = 
Adafruit_NeoPixel(19, 12, NEO_GRB + NEO_KHZ800);

//Definitions
const int HR_RX = 2; //heart rate
byte oldSample, sample; //used to store the separate sources

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
colorWipe(strip.Color(0, 0, 20), 50); // BLUE

Serial.begin(9600);
pinMode (HR_RX, INPUT);  //Signal pin to input

Serial.println("Waiting for heart beat...");

// Wait until a heart beat is detected
while (!digitalRead(HR_RX)) {};
Serial.println ("Heart beat detected!");
}

void loop() {
sample = digitalRead(HR_RX);  //Store signal output
if (sample && (oldSample != sample)) {
Serial.println("Beat");
heartBeat();
}
oldSample = sample;           //Store last signal received

for (volatile int i=0; i<strip.numPixels(); i++){
strip.setPixelColor(i, strip.Color(0, 0, 20)); 
//set pixel color strip to blue
}
strip.show();
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

void heartBeat (){
Serial.println("heartbeat");
for (volatile int i=0; i<strip.numPixels(); i++){
strip.setPixelColor(i, strip.Color(0, 0, 255));
}
strip.show();
delay(10);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s