Christopher Mendez Martinez
Published © GPL3+

DIY ECG Heart Monitor | Analog Interface + Arduino

Monitor your heart precisely with this DIY electrocardiograph

IntermediateFull instructions provided2 hours2,728
DIY ECG Heart Monitor | Analog Interface + Arduino

Things used in this project

Hardware components

Raggibb electrodes
×1
JLCPCB Customized PCB
JLCPCB Customized PCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

oscilloscope

Story

Read more

Schematics

Schematics

Code

Code

Processing
#define Buzzer 13

float raw,mini, count, tiempo, segundos;
bool control = 0, one = 0;
int bpm;
int baud = 115200;
int muestras = 100000;
int Vref = 3.33;
int Steps = 4095.0;
int range = 0.95;
int offset = 1.60;
int pulsos = 10;
int seguro;

void setup() {

  Serial.begin(baud);
  pinMode(Buzzer, OUTPUT);

}

void loop() {

//Se analiza la seal de entrada en busca del valor mximo (R)

  if (one == 0) {
    for (int i = 0; i < muestras; i++) {
      raw = (analogRead(A0) * Vref / Steps)-offset;
      if (raw < mini) {
        mini = raw;
      }
    }
    one = 1;
  }

  raw = (analogRead(A0) * Vref / Steps)-offset; //se convierte la lectura del ADC en un voltaje.
  //Serial.println(analogRead(A0));
  if (raw < range * mini) {
    
    if (seguro == pulsos) {
      Serial.println(bpm);
      tiempo = millis();
      seguro = 1;
      
    } else {
      
      segundos = (millis() - tiempo) / 1000.0;
      bpm = (1 / (segundos/pulsos)) * 60;
      seguro++;
      
    }
    
    digitalWrite(Buzzer, HIGH);
    delay(60);  //30ms con el Buzzer o Buzzer ON.
    digitalWrite(Buzzer, LOW);
  }

}

Credits

Christopher Mendez Martinez

Christopher Mendez Martinez

35 projects • 74 followers
Electronic Engineer and Tech YouTuber who loves automation, programming and sharing his knowledge with everyone.

Comments