# Heartrate LED tutu skirt

My concept for the final project is inspired by the costumes from the VS fashion show, I think it would be interesting to incorporate the user’s heart rate and LED light into the costume. I designed and made the bustier top, tutu skirt and a long tulle train as the costume. By attaching the heart rate sensor onto the user’s fingers, the sensor will detect the user’s heartbeat, and using the LED light as the output, they should blink frequently as the user’s heart rate become faster. So the audience can tell how nervous or excited is the performer by reading the LED light on the tutu.

I used mostly lace and tulle for the costume, because I found those fabric are commonly used for most of the lingerie from the  VS fashion show (lace and tulle are elegant and sexy!) The theme of my costume would be called “The Bloom of Dark Nature” because of the roses and vines on the skirt and my arm, the heart rate sensor is connected to my finger, which looks like my blood is making the roses bloom. I also decided to add artificial black roses and ribbon to the costume so they can hide some parts of the circuit and to make it looks more visually pleasing.

Coding:

/*
This Arduino program reads data from the pulse sensor and outputs flashes to the open heart LED display.
*/

#include <avr/pgmspace.h>

//Defines the pins used for Heart
int pin1 =6;
int pin2 =10;
int pin3 =11;
//Sets how long in Microseconds each LED is on for.

//Sets how many times each frame repeats. The larger
//the number, the longer each frame is displayed
//before moving onto the next one.
int runspeed = 5;

const int pins[] = {
pin1,pin2,pin3};

const int heartpins[27][2] ={
{pin3, pin1},
{pin1, pin3},
{pin2, pin1},
{pin1, pin2}

};

byte heart[][27] PROGMEM ={
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};

// Pins
//const int ledPin = 13;
const int sensePin = 5;

int ledState = LOW;
long ledOnMillis = 0;
long ledOnInterval = 50;

// Hearbeat detect variables
int Delta = 0;
int historySize = 8;
int recentTotal = 0;
boolean highChange = false;
int totalThreshold = 2;

// Heartbeat Timing
long lastHeartbeatTime = 0;
long debounceDelay = 150;
int currentHeartrate = 0;

void setup() {
// initialize the serial communication:
//Serial.begin(9600);
// initialize the digital pin as an output:
//pinMode(ledPin, OUTPUT);
}

void loop() {
// Turn off LED
//digitalWrite(ledPin, LOW);

//Calculate Delta

// Find new recent total
// replace indexed recent value
// increment index

//Debug
//Serial.println(recentTotal);

// Decide whether to start an LED Blink.
if (recentTotal >= totalThreshold) {
// Possible heartbeart, check time
if (millis() – lastHeartbeatTime >= debounceDelay) {
// Heartbeat
//digitalWrite(ledPin, HIGH);
currentHeartrate = 60000 / (millis() – lastHeartbeatTime);
lastHeartbeatTime = millis();
// Print Results
Serial.println(“Beat”);
if (currentHeartrate <= 200) {
//Serial.println(currentHeartrate);
play();}
}
}
delay(10); }

void turnon(int led) {
int pospin = heartpins[led][0];
int negpin = heartpins[led][1];
pinMode (pospin, OUTPUT);
pinMode (negpin, OUTPUT);
digitalWrite (pospin, HIGH);
digitalWrite (negpin, LOW);
}
void alloff() {
for(int i = 0; i < 6; i++) {
pinMode (pins[i], INPUT);
}
}
void play() {
boolean run = true;
byte k;
int t = 0;
while(run == true) {
for(int i = 0; i < runspeed; i++) {
for(int j = 0; j < 27; j++) {
if (k == 2) {
t = 0;
run = false;
}
else if(k == 1) {
turnon(j);
alloff();
}
else if(k == 0) {
}
}
} t++;
}
}
alloff();
for(int n = 0;n < numblink;n++) {
for(int i = 0; i < runspeed; i++) {
for(int j = 0; j < 27; j++) {
turnon(j);
alloff();
}
}
delay(500);
}
}
void sequenceon() {
for(int i = 0; i < 27; i++) {
turnon(i);
delay(800);
alloff();
delay(800);
}
}