My Box Shaped Heart

09Dec06

Here it is: a box, yes, ladies and gentlemen, a box that can read your pulse and displays it visually as well as auditory. All of this in one simple box. The wireless aspect is still to come, this is the 1.0 version – wired. Look for the 2.0 wireless version next Xmas.

finalbox_top.jpg

top view: red power on led, green beat1(lub), yellow beat 2(dub), speaker and cord with strap for finger.

finalbox_back.jpg

back view: usb port, 5v dc power, and 1/8″ mini headphone jack.

finalbox_lid.jpg

under the hood: toward the back and underneath(unseen) sit an Arduino Ng board, underneath that is a powered amp. top(visible) is a breadboard and RF receiver, as well as LEDs and speaker.

final-schematic.jpg

The Box Shaped Heart was originally conceived as an alternate means of reading ones pulse or heart rate through auditory stimuli rather than numeric. The user, when presented with numeric representations of their pulse, must interpret them into conditions of the heart with the help of a manual, where as an auditory approach would provide immediate feed back as well as recognition as to the state of their heart rate.
The user places their index finger in a Velcro strap that contains an IR emitter and detector. The light emitted reflects at different rates based upon the presence and absence of blood supply moving through the finger. That rate change is picked up by the detector and is received and read by an analog pin on an Arduino microcontroller. These signals represent the varying voltages and thus resistance based upon the infrared light detected. These values can be read in the serial monitor and are then scaled to produce greater sensitivity; due to fact that the IR pair read only a three or four value difference based upon extreme rate changes at this point. These scaled values are then placed as a delay between two oscillating sine waves, one high and the other low, as well as turning a pair of LED’s on and off. The sine waves are produced in the Atmega 8 chip through pulse width modulation and then fed to a powered op-amp to boost the signal, which then goes out to produce sound from a small speaker. The speaker is mounted on the underside of the lid of the box. The enclosure/box itself is made of hand-molded styrene plastic and rivets. The back of the box exposes a power socket, 1/8” headphone jack, and a USB port.
The major problem that I’ve encountered in developing this idea has been working with wireless radio frequency communication. While using a general radio transmitter receiver pair at 434MHZ, the incoming code has been filled with a lot of background noise, either from other people working on the same frequency, or other low noise generated from A/C machines from the shop and the like. A small module is supposed to be worn on the arm that has a wire leading down to the finger of the user. The module, equipped with a mini Arduino and a transmitter, collects the data from the sensor and sends it out to the receiver. This provides the user with freedom to move and excursive with in the given confines of the radio transmitters strength – 150’. I spent days trying to filter the incoming data, limiting my data range, and giving it a header byte, but to no great improvement. The best solution, I have found, is to spend a bit more and place an addressable ZigBee radio into the device that would know exactly which receiver to send data to.
My Box Shaped Heart has since evolved from pure interpretation/translation to a device that carries the potential to function as a game as well as a music controller for the purpose of sustained elevated heart rate, thus better health. The next two instances of the prototype are to include better, more enjoyable sound and a game function. For better sound, I am either adding a low pass filter to the amplifier, or just connecting it the computer and running a Max patch via Arduino IDE. Secondly, I will add a button that will place a secondary beat, both light and sound, over the active beat. Each time the user presses the momentary switch, it will be read into a digital pin, where the code will look for high or low states, thereby having the secondary beat change tempo. The tempo will increase with each successive press so that the user can try to match it with their pulse reading. When the tempos have been matched, another light blinks and a musical note is sounded to let the user know that they have accomplished the goal.

Here is a sample of my code:

//int incomingByteArray[1];
//int incomingByte;
//int i=0;
int ledPin1 = 6;
int ledPin2 = 7;
int ledPin3 = 5;
int ledPin4 = 4;
int switchState=3;
int switchState2=2;
int speakerOut = 9;
int speakerOut2 = 10;
int button;
int button2;
//int wantedValue=0;
//int headerByte=0;
int IRvalue=0;
int IRvalueIN;
int analogin;
int start=0;// if start is high, put incomingByte into wanted value

void setup() {
pinMode(ledPin4, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(spaeker2, OUTPUT);
pinMode(swithState, INPUT);
pinMode(switchState2, INPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(speakerOut, OUTPUT);
Serial.begin(2400);
//int wantedValue=0;
//int headerByte=0;
}

void loop() {
IRvalueIN=analogRead(IRvalue);
Serial.print(“IRvalues: “);
Serial.println(IRvalueIN);
/* read in values, debug to computer
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.println(incomingByte,DEC);

if (incomingByte == 255){
start = 1;
incomingByteArray[0]=255;
Serial.print(“255start: “);
Serial.println(start);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, LOW);
analogWrite(speakerOut, 0);
}

if ((start == 1) &&(incomingByte>160)){
incomingByteArray[1]=incomingByte;
start=0;

Serial.print(“incomingByte: “);
Serial.println(incomingByteArray[1],DEC);
Serial.println(“*******************”);
Serial.print(“start: “);
Serial.println(start);
}
*/

if(IRvalueIN<45){
analogin=1035-IRvalueIN;
//analogin=1175-incomingByteArray[1];
analogWrite(speakerOut, 0);
analogWrite(speakerOut, 1960);
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
delay(analogin);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);
analogWrite(speakerOut, 960);
Serial.print(“analogOUT: “);
Serial.println(analogin);
delay(analogin);
analogWrite(speakerOut, 0);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, LOW);
}
swithState= digitalRead(button)
if(switchState==HIGH){
analogWrite(speakerOut, 1200);
digitalWrite(ledPin3, HIGH);
delay(900);
digitalWrite(ledPin3, LOW);
}
swithState2= digitalRead(button2)
if(switchState2==HIGH){
analogWrite(speakerOut, 1200);
digitalWrite(ledPin4, HIGH);
delay(800);
digitalWrite(ledPin4, LOW);
}
else{
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, LOW);
analogWrite(speakerOut, 0);
}
IRvalueIN=0;
}

About these ads


2 Responses to “My Box Shaped Heart”

  1. It’s cool that this made it into Makezine!


  1. 1 links for 2007-03-22 « Donghai Ma

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: