ARDUINO BLUETOOTH HEARTBEAT
A pulse wave is a change in the volume of a blood vessel that occurs when the heart pumps blood, and a detector that monitors this volume change is called a pulse sensor. Heart rate can be measured in many different ways. The figure below shows the different ways of measuring the heart rate.
The two most common techniques are electrical and optical methods. In principle the heartbeat sensor is based on the principle of photoplethysmography, whereby the heart rate is measured by sensing the changes in blood flow through the index finger. The flow of blood volume is decided by the rate of heart pulses and since light is absorbed by the blood, the signals are equivalent to the heartbeat pulses. There are two types of photoplethysmography:
Transmission : Light emitted from the light-emitting device is transmitted through any vascular region of the body like the earlobe and received by the detector.
Reflection : Light emitted from the light-emitting device is reflected by the regions.
The below image illustrates how these two methods are applied.
A plot for this change recorded against time is named as photoplethysmographic (PPG) waveform.
Generally, by looking at the period of fluctuation from the waveform obtained by measurements of the pulse wave sensor and observing the pulsation (variation) using the heart rate along with both red and infrared waves, it is possible to measure the arterial blood oxygen saturation (SpO2). Now let's look into how the heartbeat sensor works. The basic heartbeat sensor consists of a light-emitting diode and a light detecting sensor. The heartbeat pulse cause a variation in the flow of blood to different regions of the body. When tissue is illuminated with the light source, i.e. light emitted by the led, it either reflects or transmits the light. Some of the lights is absorbed by the blood and the transmitted or the reflected light is received by the light detector. The amount of light absorbed depends on the blood volume in that tissue. The detector output is in the form of the electrical signal and is proportional to the heartbeat rate, as shown in the above figure.
This signal is a DC signal relating to the tissues and the blood volume and the AC component synchronous with the heartbeat and caused by pulsatile changes in the arterial blood volume is superimposed on the DC signal. We will later look into more details of the pulse sensor in Part 2.
The main sensor that we will be using in this project, is the pulse sensor. Before going further, let's look into the details of this pulse sensor. Below is the figure of the pulse sensor
|Front view of the pulse sensor||Rear view of the pulse sensor|
And below is the schematic of the pulse sensor
The schematic and PCB file is open source and can be downloaded from here. To explain more on the pulse sensor, on the front of the sensor is the heart logo. This is the side that makes contact with the skin. On the front, you see a small round hole, which is where the LED shines through from the back, and there is also a little square just under the LED. The square is an ambient light sensor, similar to the one used in laptops, tablets, and cellphones, to adjust the screen's brightness in different light conditions. The LED shines a light into the fingertip or other capillary tissue and the sensor reads the light that bounces back. The back of the sensor is where the rest of the parts are mounted. That's a very brief idea of the pulse sensor. This sensor can be directly connected to Arduino or any other microcontroller. This sensor comes with three pins. The figure shows the name of each pins.
And the spec of the sensor is as shown in the table below
That's about the pulse sensor. Next, we shall see our next component/device which is the microcontroller. For this project, i have decided to use the Arduino Nano. The reason for me to choose this model is due to its small form factor. The figure below shows the image of the Arduino Nano and its corresponding pin.
We will like to display the heartbeat in a cool way, hence decided to use the 1.44" tft display and their respective pin layout.
And the next device/component that we would like to see is the Bluetooth device. We would like to send the data from the pulse sensor to mobile devices. The type of bluetooth devices which we have decided to use is the HC05. The figure illustrates the HC05
In this part, we shall look into the software that we use to build our project. Definitely we use the Arduino IDE, and apart from that, we shall use other software as well. Firstly we would like to calibrate our sensor. For this, we will use the sample code and view it in the serial monitor. First step is to ensure that we have installed the pulse sensor library. If not installed yet, please follow the steps below
Once the library is installed as shown in figure above, we can try to run the first example as shown in the figure below
As can be seen from the figure above there are a lot of examples provided within the library. The image below shows a better view of the examples
We will first run the "Getting_BPM_to_Monitor". Below is the snapshot of the code.
Basically, the code is from the pulse sensor example. The pin number for the pulse wire is changed from A0 to A6 to suit our design. Next, we upload the code to the board and see the serial output.
And the video below shows the heartbeat in the serial plotter.
The default threshold value is 500. And it can be changed to suit our sensor based on the reading we get through the serial monitor. Next, we shall move on to design the display for the TFT display. As we have seen in part 3, we are using a 1.44" TFT display. In order to get this running, we will be using the Adafruit_GFX.h and TFT_ILI9163C.h library. And to test that our display is working fine and wired properly we will try to run the sample code as shown below
Once the code is successfully compiled and uploaded to our board, the display should display as shown in the video below
Next, we shall move on to design the display which portrays the heartbeat on the TFT LCD. For this project, we will display the same value which is displayed in the serial monitor on the screen.
In this part, we shall see how to integrate the software and the hardware which we have developed previously and of course with some modification. Below is the video of the result of the interfacing between the hardware and the software.
Currently, this is the progress of this project. As for the Bluetooth part, I am still working on it and will update it the soonest time. Hope you enjoy this blog.