Measure heart rate with Arduino
FunduinoPublished on
Den eigenen Herzschlag als Kurve sichtbar machen
You need this
Pulse sensor - optical heart rate sensor, 0-5 V analog
3,03 € *Item no. F23106819About the product — Pulse sensor - optical heart rate sensor, 0-5 V analog
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
All 2 parts together 14,15 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
Material
How the pulse sensor works
Structure
Make the heartbeat visible
Sketch: Output a pulse signal and switch the LED in sync
int SensorPin = A0; // Signal line at analog input A0
int LED = 13; // The built-in LED on pin 13 is used
int Sensorwert; // Variable for the sensor reading
int Grenzwert = 520; // Threshold at which the LED should light up
void setup()
{
pinMode(LED, OUTPUT); // Pin 13 is an output
Serial.begin(9600); // Start serial connection
}
void loop()
{
// Read the sensor value and store it in the variable "Sensorwert"
Sensorwert = analogRead(SensorPin);
// Send the sensor value to the PC via the serial interface
Serial.println(Sensorwert);
// If the sensor value is above the threshold ...
if (Sensorwert > Grenzwert)
{
digitalWrite(LED, HIGH); // ... then the LED should light up
}
else // Otherwise ...
{
digitalWrite(LED, LOW); // ... the LED is off
}
delay(10); // Short pause so the readings are easier to see
}Set the threshold for the LED
Further information
Rate the instructions