ECG Necktie

Introduction: ECG Necktie

project goals
to create a circuit-connected necktie
containing a light up heart which can
blink based on a wearer’s input. The
input can either be based on detecting
a subject’s heart-rate or can be based
on bending a flex sensor.

Step 1: Materials and Sensor Set-up

Step 2: Circuit Construction and Crafting

Step 3: Arduino Code

const int heartSig = A1; // output from ECG circuit
const int beatLight = 9; // 3 ultrabright LEDs in center
const int rimLight = 11; //10 LEDs around edge of heart
const int switchHigh = 5; //high comparator for switch
const int switchLow = 3; //low comparator for switch
const int switchVal = 4; //switch read pin
const int bendVal = A0; // output from flex sensor
const int speakerPin = 10; // positive lead fromspeaker
int bend = 1000; //initialize delay to 1000

void setup() {
  // initialize pins:
  pinMode(bendVal, INPUT); //flex sensor
  pinMode(beatLight, OUTPUT); //center LEDs
  pinMode(rimLight, OUTPUT); // rim LEDs
  pinMode(switchHigh, OUTPUT); //pin HIGH
pinMode(switchLow, OUTPUT); //pin LOW
pinMode(switchVal, INPUT); //switch comparator
pinMode(heartSig, INPUT); //ECG signal
pinMode(speakerPin, OUTPUT); //tone output
digitalWrite(switchHigh, HIGH); //initialize switch comparators
digitalWrite(switchLow, LOW);

void loop() {
switch(digitalRead(switchVal)) // read the function switch
case HIGH: //if the switch is in HIGH mode
tone(speakerPin, 50, 50); //low beat sound
digitalWrite(rimLight, HIGH); //initialize down beat lights
digitalWrite(beatLight, LOW);
delay(bend); //wait one second

bend = analogRead(bendVal); //get flex sensor data
bend = map(bend, 700, 250, 1500,50); //map observed sensor range to delay
tone(speakerPin, 70, 70); // high beat sound
digitalWrite(rimLight, LOW); //initialize up beat lights
digitalWrite(beatLight, HIGH);
delay(bend); //delay again

case LOW: //if switch in low position
digitalWrite(rimLight, LOW); //turn off all lights
digitalWrite(beatLight, LOW);
//would like following line to map the signal from the mean to the max of the signal
int heartMod = map(analogRead(heartSig), 650,700, 0, 1024); //read signal and map
Serial.println(heartMod); //output for setting threshholds above

while(heartMod > 40) { //if the signal is greater than the mean (with error)
digitalWrite(rimLight, HIGH); //set lights on
digitalWrite(beatLight, HIGH);


Step 4: Working ECG

Step 5: Working CardioCraft!

3rd Epilog Challenge

Participated in the
3rd Epilog Challenge

1 Person Made This Project!


  • Pets Challenge

    Pets Challenge
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest
  • Build a Tool Contest

    Build a Tool Contest



8 years ago on Introduction

Cool project.

Just a question: Is there a way to drive this project directly with 5V or 3.3V? So that you only need one voltage? Would be a lot easier to provide one voltage via one step up / down generator while "on the run" :).


10 years ago on Introduction

Hey, thanks so much for sharing this, I'm a complete n00b to Arduino and electronics in general, I think I have most of the circuit figured out but I'm still unsure of what "U1A" and "U3A" stand for, could you please clarify that? Also, I could only find "AD623ANZ" ( and "LMC6484AIN/NOPB" (, would those be ok? Thanks again!


11 years ago on Introduction

Very simple & easy, Thank Your for taking the time =)
it looks great.
I´ll post pictures when I finish it.


11 years ago on Introduction

Great! You may want to check out Heart Spark. It also detects your heart rate but has a custom PCB in the heart. 


11 years ago on Introduction

This looks like an AWESOME project. One problem is that I can't read the Arduino code at all. Can you retype that, or make the picture bigger? This looks like a lot of fun!


Reply 11 years ago on Introduction


Code now included as text.

Also if you click the 'i' in the upper left corner of any picture you can choose to view it as its original size by clicking 'original' on the left hand side!