User:Eyabe20/New project/ENES100/Project 1

Project Preference
BioVest ,Smart shoe, wind turbine ,Autonomous power wheel

Problem Statement
Our group is going to work on Biovest project.Basically, we will try to add a sensor on a shirt which will be able to measure the pulse rate of our body.

Project Plan
Briefly describe your group's plan for the next 4 weeks, including major tasks that will be completed each week.

Week 1 Narrative
My task was to research what attachments and instruments we need to make a shirt with a sensor .So we need a shirt really light, an Arduino sensor, wires , computer , resistors. My second task was to find some Arduino sensors I found a lot of Arduino sensors but we are going to use some Arduino sensors for motion like :Grove - PIR Motion Sensor with grove compatible interface because it is cheap and it has really good specifications. For example, it is adjustable detection distance and response time and also detecting angle 120 degree, response time :0.3 to 25 s. Another Arduino that we can use is Parallax PIR Motion Sensor which is inexpensive and easy to use, simple 3-pin connection and Small size - easy to conceal.

Week 2 Narrative
This week my objectives was first to buy the materials - An EMG sensor:i saw a lot of sensor but i choose SHIELD-EKG-EMG Arduino Electrocardiography EKG and Electromiography EMG shield because it allows arduino like boards to capture  Electrocardiography Electromiography signals.We can also log your pulse rate which is our goal.I ask the teacher to order it. - An EMG electrode: i decide to ask the teacher to order the SHIELD-EMG-EKG-PA Arduino Electrocardiography EKG and Electromiography EMG Electrodes( -An Arduino : arduino UNO .we found in class -An audio jack :1/4" Stereo Panel-Mount Audio Jack (2-Pack).I order it . -An 9V battery : In class -3 pin female : we are going to find in class. -A A +/- 5V regulated supply board .We find that in class. basically, we have most of the materials . My second goal was to setup the code on arduino : i found a code for Arduino which i think it is going to work : /* EMG Biofeedback

Plays a beep that corresponds in legnth to the reading received from an EMG sensor. The more tense the muscle becomes, the longer the beep legnth.

Based on two Arduino examples by Tom Igoe

This example code is in the public domain.

*/

const int analogInPin = A0; // Analog input pin

int sensorValue = 0;       // value read from the sensor


 * 1) define NOTE_C4 262 //defines the note as middle C

int melody = NOTE_C4; //sets variable to middle C

void setup { // initialize serial communications at 9600 bps: Serial.begin(9600); }

void loop { // read the analog in value: sensorValue = analogRead(analogInPin);

// print the results to the serial monitor: Serial.print("sensor = " ); Serial.println(sensorValue);

int noteDuration = (sensorValue); //states the note duration is the sensor reading tone(8, melody,noteDuration); //plays note for legnth of sensor reading on pin 8

// to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8);

}

We hope that we are going to get through all of those things this week.

Week 3 Narrative
First, i found another arduino code via https://www.sparkfun.com/products/11574. This code is :

volatile int rate[10];                   // used to hold last ten IBI values volatile unsigned long sampleCounter = 0;         // used to determine pulse timing volatile unsigned long lastBeatTime = 0;          // used to find the inter beat interval volatile int P =512;                     // used to find peak in pulse wave volatile int T = 512;                    // used to find trough in pulse wave volatile int thresh = 512;               // used to find instant moment of heart beat volatile int amp = 100;                  // used to hold amplitude of pulse waveform volatile boolean firstBeat = true;       // used to seed rate array so we startup with reasonable BPM volatile boolean secondBeat = true;      // used to seed rate array so we startup with reasonable BPM

void interruptSetup{ // Initializes Timer2 to throw an interrupt every 2mS. TCCR2A = 0x02;    // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE TCCR2B = 0x06;    // DON'T FORCE COMPARE, 256 PRESCALER OCR2A = 0X7C;     // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE TIMSK2 = 0x02;    // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A sei;            // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED }

// THIS IS THE TIMER 2 INTERRUPT SERVICE ROUTINE. // Timer 2 makes sure that we take a reading every 2 miliseconds ISR(TIMER2_COMPA_vect){                        // triggered when Timer2 counts to 124 cli;                                     // disable interrupts while we do this Signal = analogRead(pulsePin);             // read the Pulse Sensor sampleCounter += 2;                        // keep track of the time in mS with this variable int N = sampleCounter - lastBeatTime;      // monitor the time since the last beat to avoid noise

// find the peak and trough of the pulse wave if(Signal < thresh && N > (IBI/5)*3){      // avoid dichrotic noise by waiting 3/5 of last IBI if (Signal < T){                       // T is the trough T = Signal;                        // keep track of lowest point in pulse wave }      }

if(Signal > thresh && Signal > P){         // thresh condition helps avoid noise P = Signal;                            // P is the peak }                                       // keep track of highest point in pulse wave

// NOW IT'S TIME TO LOOK FOR THE HEART BEAT // signal surges up in value every time there is a pulse if (N > 250){                                  // avoid high frequency noise if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ){ Pulse = true;                              // set the Pulse flag when we think there is a pulse digitalWrite(blinkPin,HIGH);               // turn on pin 13 LED IBI = sampleCounter - lastBeatTime;        // measure time between beats in mS    lastBeatTime = sampleCounter;               // keep track of time for next pulse

if(firstBeat){                        // if it's the first time we found a beat, if firstBeat == TRUE firstBeat = false;                // clear firstBeat flag return;                           // IBI value is unreliable so discard it            } if(secondBeat){                       // if this is the second beat, if secondBeat == TRUE secondBeat = false;                // clear secondBeat flag for(int i=0; i<=9; i++){        // seed the running total to get a realisitic BPM at startup rate[i] = IBI; }           }

// keep a running total of the last 10 IBI values word runningTotal = 0;                  // clear the runningTotal variable

for(int i=0; i<=8; i++){               // shift data in the rate array rate[i] = rate[i+1];             // and drop the oldest IBI value runningTotal += rate[i];         // add up the 9 oldest IBI values }

rate[9] = IBI;                         // add the latest IBI to the rate array runningTotal += rate[9];               // add the latest IBI to runningTotal runningTotal /= 10;                    // average the last 10 IBI values BPM = 60000/runningTotal;              // how many beats can fit into a minute? that's BPM! QS = true;                             // set Quantified Self flag // QS FLAG IS NOT CLEARED INSIDE THIS ISR } }

if (Signal < thresh && Pulse == true){    // when the values are going down, the beat is over digitalWrite(blinkPin,LOW);           // turn off pin 13 LED Pulse = false;                        // reset the Pulse flag so we can do it again amp = P - T;                          // get amplitude of the pulse wave thresh = amp/2 + T;                   // set thresh at 50% of the amplitude P = thresh;                           // reset these for next time T = thresh; }

if (N > 2500){                            // if 2.5 seconds go by without a beat thresh = 512;                         // set thresh default P = 512;                              // set P default T = 512;                              // set T default lastBeatTime = sampleCounter;         // bring the lastBeatTime up to date firstBeat = true;                     // set these to avoid noise secondBeat = true;                    // when we get the heartbeat back }

sei;                                    // enable interrupts when youre done! }// end isr

-I already try the first code and it works .This one is in case that the previous one is not working like we want. You can see that we need some modifications on this one starting by changing the LED by an Audio jack.

Second, i had to find any necessary extra software to read data or graph of pulse rate,i not think that we need that but i found an application able to measure it which is call Runtastic Heart Rate Monitor & Pulse Tracker PRO via itunes apple store. We can measure the pulse rate via iphone or smartphone with the camera .To find it go to https://itunes.apple.com/us/app/runtastic-heart-rate-monitor/id586956623?mt=8. Another application called Cardiograph an do also the same thing https://play.google.com/store/apps/details?id=com.bigdreams.cardiographheartbe.

-I finally bought the audio jack which will helps us to hear the pulse. I decide that we are going to use this type of shirt because it is really tie on your body. -For the design, we finally agree to this

Week 4 Narrative
This week was based to finish our design and do the CDIO report .After finding a lot of possible design for the Biovest, i decide to use the a design inspired by a team of students at Northeastern University in Boston http://www.designnews.com/document.asp?doc_id=244644. As you can see the shirt has a heart-rate monitor to provide a more holistic view of activity level.They are using the same type of shirt like us. The name of their shirt is Squid and they are using wearable compression shirt that integrates with a smartphone and Web database to monitor resistance exercises. Squid's "tentacles" are strategically placed EMG (electromyography) sensors that monitor the user's muscle activation levels. The solution also includes a heart-rate monitor for a more complete view of fitness activity.