Introduction
In this article, I will explain how to correctly check the pulse in our body and sense the correct pulse signal in mobile or system. We will perform this using
Arduino Mega 2560.
Parts
- Arduino Mega 2560
- Pulse sensor
- Hookup Wires
Pulse sensor
Figure 1: Pulse Sensor
- Pulse Sensor is a plug-and-play heart-rate sensor for Arduino Mega 2560
- It can be used to check the pulse in our bodies.
- It can be used by students, artists, and developers.
Connection
In the pulse sensor, they can have the 3 pins,
- The first can be a negative pin connected to the Gnd of the Arduino Mega 2560.
- The second can be a positive pin connected to the 5V of the Arduino Mega 2560.
- The third can be an input pin connected to the Analog pin A0 of the Arduino Mega 2560.
Programming- int pulsePin = 0;
- int blinkPin = 13;
- int fadePin = 5;
- int fadeRate = 0;
-
-
- volatile int BPM;
- volatile int Signal;
- volatile int IBI = 600;
- volatile boolean Pulse = false;
- volatile boolean QS = false;
-
- void setup()
- {
- pinMode(blinkPin, OUTPUT);
- pinMode(fadePin, OUTPUT);
- Serial.begin(115200);
- interruptSetup();
- }
-
- void loop()
- {
- sendDataToProcessing('S', Signal);
- if (QS == true)
- {
- fadeRate = 255;
- sendDataToProcessing('B', BPM);
- sendDataToProcessing('Q', IBI);
- QS = false;
- }
- ledFadeToBeat();
- delay(20);
- }
-
- void ledFadeToBeat()
- {
- fadeRate -= 15;
- fadeRate = constrain(fadeRate, 0, 255);
- analogWrite(fadePin, fadeRate);
- }
-
- void sendDataToProcessing(char symbol, int data)
- {
- Serial.print(symbol);
- Serial.println(data);
- }
- Check the pulse in the monitor / smart mobile.
- When the pulse is normal the LED blinks.
- We can monitor the pulse with the correct data and symbols.
Read more articles on Arduino: