Lab #5: Bio-Signals


ECG Tutorial


Heart rate from ECG in Arduino

- sketch that acquires the ECG signal via one of the analog inputs

#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"
Adafruit_LiquidCrystal lcd(0);
int pin = A0;
int count = 0;

void setup() {
  Serial.begin(9600);  // put your setup code here, to run once:
  pinMode(pin, OUTPUT);
  lcd.begin(16,2);
}

void loop() {
  // put your main code here, to run repeatedly:
int now = millis();
while (millis() - now < 10000) {
  int sensorValue = analogRead(pin);
  Serial.println(sensorValue);
  if (sensorValue > 116) {
    count++;
  }
  }
  int printed = count*6;
  lcd.print(printed);
  lcd.print("bpm");
  delay(300);
  lcd.clear();
  count = 0;
}

- devise a procedure to calculate the heart rate from the acquired ECG signal
- send the heart rate to the LCD

Pulse Sensor


Here is a screenshot of what the Pulse Sensor sketch returned as I held the sensor to my fingertip.



Comments

Popular posts from this blog

Lab #3: ColorPAL

Lab #4: Non-volatile memory, Servo Motors and MATLAB