Thursday, 4 July 2019

operational amplifier - Arduino - Cannot get ECG readings from heart, but I do when I poke at the leads


I have a minor issue with my ECG. When I poke at the leads, I get a reading. But when I hold the leads or place it near my heart, I don't get anything. I'm pretty sure this is hardware related, but I don't want to completely rule out a potential software problem. I used this YouTube video as a guide: https://www.youtube.com/watch?v=NDjRg-KgIXY, with their circuit show below.


circuit from linked video


My breadboard almost looks exactly the same as that, but with a couple of changes. Instead of connecting the ECG to the computer via a audio cable, I used Bluetooth to transfer it to my phone. Here is my schematic diagram.


1 http://i60.tinypic.com/29leq9k.jpg


Here is my breadboard diagram.


2 http://i62.tinypic.com/5lcpzc.jpg


In my breadboard, I used three LM358 op-amps. Here is my Arduino code (if you need it):



const int  signal = 7;    // Pin connected to the filtered signal from the circuit
unsigned long currentBeatTime;
unsigned long previousBeatTime;

unsigned long frequency;

// Internal variables
unsigned long period = 0;
int input = 0;
int lastinput = 0;



void setup() {
pinMode(signal, INPUT);
Serial.begin(9600);

previousBeatTime = millis();
}

void loop() {

delay(100);
input = digitalRead(signal);

if ((input != lastinput) && (input == HIGH)) {
// If the pin state has just changed from low to high (edge detector)
currentBeatTime = millis();

period = currentBeatTime - previousBeatTime; // Compute the time between the previous beat and the one that has just been detected
previousBeatTime = currentBeatTime; // Define the new time reference for the next period computing
}


lastinput = input; // Save the current pin state for comparison at the next loop iteration

// Detect if there is no beat after more than 2 seconds
if ( (millis() - previousBeatTime) > 2000 )
{
//Serial.println("dead");
}
else
{

if (period <= 0)
{
frequency = 0;
}
else
{
frequency = 60000/period; // Compute the heart rate in beats per minute (bpm) with the period in milliseconds
}

Serial.println(frequency);

}
}

Any help regarding this issue is highly appreciated. Thank you!




No comments:

Post a Comment

arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...