{'fraction_non_alphanumeric': 0.027892639651154048, 'fraction_numerical': 0.019096308548229458, 'mean_word_length': 4.533277870216306, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Development of a Reflectance Photoplethysmogram Based Heart Rate Monitoring Device

This paper presents a method for users to monitor their heart rate conveniently. It becomes necessary for individuals to know their heart rate because of the fact that cardiovascular disease is the leading cause of death in the world, especially in developing countries. Heart rate measurement is an indication of how healthy the heart is. This heart rate monitor (HRM) uses the technique of reflectance photoplethysmography (PPG) to detect the pulse from the fingertip, filter and amplify the pulse using two-stage OP-Amp, count and decodes the pulse with the aid of a microcontroller and display the output in beats per minutes (BPM) on an LCD. The device is easy to use, cheap and portable compared to the expensive ones available that also requires medical expertise. It can be used by athletes and anybody to monitor the state of their heart rate with negligible error.


Introduction
The human heart pounds all the time to pump blood rich in oxygen to different parts of the body while also carrying waste products of the cells away from the tissues [1,2,3]. The heart beats continuously non-stop for every human alive whether one is awake or asleep. Heart rate indicates the number of heartbeats per unit time, it is expressed as beats per minute (bpm) [3,4]. Heartbeat rate varies significantly between individuals. Factors such as sex, age, genetics and fitness affect heart rate [4,5].
Heart rate is an important measure of the state of the cardiovascular system [4]. If the heart rate is abnormal, it shows that there may be a problem in the cardiovascular system. Once there is a problem, heart attack can occur. Heart diseases are major causes of death in the world especially in developing countries [4,6]. According to the fact sheet of the World Health organization (WHO) released in September 2016, cardiovascular diseases are the number one cause of death worldwide. It estimated that 17.5 million people died of cardiovascular diseases in 2012 and over three quarters of cardiovascular deaths occur in low-and middle-income countries, such as Nigeria [7]. As a result of this inherent danger, heart rate monitor is indispensable.
Heart rate monitor (HRM) is a device that measures the heart rate and records its value [2,4,5]. It gives an indication of the state of the heart. It is an important device in the medical field. Athletes also use it to monitor their heart rate to get maximum efficiency. Individuals can also use it at home for personal fitness measurement. Traditionally heart rate is measured by placing thumb over the subject's arterial pulsation and feeling it [2]. The pulse is counted in a 5 second period. Heart rate of the subject is then found by multiplying the number obtained by 12 [8]. This method is simple, but is prone to a lot of errors. Stethoscope is used by doctors to listen to patient's heartbeats, a process known as auscultation. It is an accurate method of measuring the heart rate [2,3,5]. Other methods of measuring heart rates are electrocardiogram (ECG) [9], Phonocardiogram (PCG), and blood pressure monitor but these methods are expensive and requires medical expertise [4,10].
The resting heart rate varies with age, sex and fitness level. The adult normal resting heart rate is from 60-100 bpm. If the heart rate is less than 60 bpm, a condition known as bradycardia will occur, whereas if it is greater than 100 bpm the condition is known as tachycardia [6,2]. The resting heart rate for humans is shown in table 1 below. Several works have been done and is still ongoing on heart rate monitor using different methods and principles. A head phone mounted photoplethysmographic heart rate monitor that measure the light absorbance through the concha of the ear had been developed [11]. This provides continuous health monitoring for sports exercise or personal health monitoring. Another work which also uses the technique of photoplethysmography (PPG) was done by Sharanabasappa Sali et al. [12]. It detects the heartbeats from the finger, displays the outcome on an LCD and sends the information to a family member or a healthcare agent via SMS, for remote monitoring especially for elderly people. Sanjay Verma, and Namit Gupta, developed a similar system for senior citizens but incorporated a temperature sensor to measure the temperature of the user and a GPS to indicate his/her position [13]. Bhattacharjee et al. designed a system based on purely electronic means to measure the user ECG [14].
In this paper, the heart rate monitor works on the principle of reflectance photoplethysmography (PPG). A plethysmograph is an instrument for measuring changes in volume within an organ or whole body (usually resulting from fluctuations in the amount of blood or air it contains). Different types of plethysmography exist such as impedance [15], air [16] and photoelectric [5]. Photoplethysmography is cheap and easy to implement. There are basically two types, the transmittance and reflectance mode [2]. In the transmittance mode PPG, the transmitter and receiver are placed opposite each other [3,17] while in the reflectance mode PPG, the transmitter and receiver are place side by side [5,17]. Photoplethysmography is the process whereby the volumetric measurement of an organ is estimated optically [12].

System Description
The HRM system consists of five units as shown in figure  1. The sensor unit senses the heart rate by emitting bright red light through the finger to the blood vessels which then reflects it back. This variation in light pulse is picked up by the amplification unit to amplify the signal as well as filter out unwanted signals, then the microcontroller processes the signal and the result is displayed on an LCD.

Sensor Unit
This stage is where the human pulse is detected. It is made up of a light emitting diode (TCRT 1000) and a light dependent resistor.
A limiting resistor of value 100Ω is connected in series with the LED to protect the LED. The LED is positioned directly opposite a light dependent resistor. The value of the LDR greatly varies with light supply. LDR has a very high resistance in the dark and very low resistance in the presence of light. When a finger is placed between the LED and the LDR, it causes variation in the value of the LDR due to variation in blood pressure in the finger at different period. This variation in the LDR is referred to as the pulse signal. As shown in figure 2, R 3 is used to reduce the current drawn by the pulse detection section and to prevent shunting the power supply when no light is detected by the LDR.  The value obtained for = (75Ω) is the minimum value. Hence, for better protection of the LED and for long lasting performance, a higher value of 100Ω resistor was chosen.
The photo sensitive region detects the alternating changes in the capillaries in the finger through change in the light received by the LDR. The LDR is a resistor whose resistance varies with light falling on its window.
LDR Properties Brightness (bright light) =Low resistance about 100Ω or less Darkness (total darkness) = high resistance about 100kΩ or more The V out obtainable is calculated thus: In bright light: LDR 1 =100Ω, R 3 =10kΩ = 100 (10000 + 100) × 5 = 0.0495 In total darkness: LDR 1 =100kΩ, R 3 =10kΩ = 100000 (10000 + 100000) × 5 = 4.545 A coupling capacitor is used to filter of any dc signal present and passes only the pulse signal on to a non-inverting operational amplifier, resistor R 1 and R 4 serves as a potential divider to reference the positive input of the amplifier. Hence this stage gives a voltage gain of 11 Another operational amplifier is employed in other to add flexibility to the system. This has a variable resistor connected to its shunt arm; this gives room for varying the gain i.e. better amplification of the signal.

Amplification Unit
This stage is also an AC amplifier, but the gain of this amplifier can be varied through RV 1 (1kΩ) a variable resistor.
The gain can be varied between R8 + RV 1 = Rx=100Ω, when RV 1 =0Ω, and R8 + RV 1 = Rx=1100Ω when RV 1 =1kΩ. R7=10kΩ The LM358 is chosen because of its high gain, which could be used in amplifying the pulse signal which is in microvolt, it also has a low power drain. The gain of this amplifier is then passed to a cascaded amplifier whose gain can be varied by connecting a resistor RV1 in series to the shunt arm of the amplifier. Thus the gain of the amplifier can vary from 110 (11 x 10) to 1111 (11 x 101). The amplified pulse signal is then sent to the microcontroller.

Processing Unit
The PIC16F876A features 256 bytes of EEPROM data memory, self-programming, an ICD, 2 Comparators, 5 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a Universal Asynchronous Receiver Transmitter (USART) [18].
PIC16F876A performs the operation of counting, decoding and driving its output signal to the LCD screen.
The PIC16F876A is operated in the crystal operation mode as it has a crystal oscillator of 4MHZ connected to the OSC1 (pin 9 clock input) and OSC2 (pin 10 clock output) pins to establish oscillation. The values 4MHZ crystal oscillator and capacitors 22pF are manufacturers' specifications. The Timer module timer/counter counts the pulses. The Timer0 module/counter is an 8bit timer/counter that is readable and writable. It has internal or external clock select and there is edge select for external clock.
Pulses to be counted enters the microcontroller through the input/output RA0/ANO (pin 2) while the clock input is from OSC1. The clock input is generally divided by four to generate four clocks. For every clock pulse, the input frequency is received by the counter. Counting stops at the end of each clock input which serves as an instruction cycle.
The result of the counted pulses is binary coded decimal form which is then decoded into appropriate signal waveform. This waveform is then driven to the LCD. The PIC is capable of taking a high sampling rate of the pulse signal in few nanoseconds thereby reducing the time taken in detecting the heartbeat per minute. The design also contains a buzzer which triggers once the PIC detects an abnormal heartbeat rate.
The PIC16F876A microcontroller was programmed using microC to convert the analog signal to digital, calculate the heart rate per minute and send the output to the LCD to display.

Display Unit
The display unit is a 20x4 LCD which displays the output of the heartbeat in digital format so that it can easily be read by the user.

Power Supply Unit
The system is designed to run on a 9V battery source. However, since the components can be powered by 5V, LM7805 voltage regulator is used to regulate it to 5V before supplying the system.

Principle of Operation
The sensor unit consists of an infrared light-emitting-diode (IR LED) and a photo diode, placed side by side and the fingertip is placed over the sensor assembly. The IR LED transmits an infrared light into the fingertip, a part of which is reflected back from the blood inside the finger arteries. The photo diode senses the portion of the light that is reflected back. The intensity of reflected light depends upon the blood volume inside the fingertip. So, every time the heart beats the amount of reflected infrared light changes, which can be detected by the photo diode. With a high gain amplifier, this little alteration in the amplitude of the reflected light can be converted into a pulse. The reflected IR signal detected by the photo diode is fed to a signal conditioning circuit that filters the unwanted signals and boost the desired pulse signal. The circuit diagram in figure 4 shows the IR LED and the photo diode along with the signal conditioning circuit made up of two stage operational amplifiers configured as active low pass filters. The gain of the filter is about 101, which shows that the signal has been amplified. This is good enough to convert the weak pulsating signal into a TTL pulse. Note that at the input of each Op Amp filter stage, there is a 1uF capacitor to block any DC component in the signal. The amplified pulse is then processed by the microcontroller which does the counting of the pulse and the output is displayed on the LCD.

Test/Results
The constructed Heartbeat Monitor and a Conventional medical analog stethoscope were used to measure the heart rate per minute of a number of male and female volunteers and the values were compared. The error rate was calculated using. = = (100 × |? − @|) ÷ ?
Where, A= Heart rate measured with the constructed Heartbeat Monitor M= Heart rate measured with the medical analog stethoscope E= Error rate

Conclusion
In this paper, a heart rate monitor based on the technique of PPG was developed. The device was able to detect the human pulse from the blood flowing in the capillaries of the finger. It was also able to amplify the pulse detected and send the amplified pulse to the microcontroller. The programmed microcontroller was able to count the pulse and convert it to a digital signal which was sent to the liquid crystal display to display the output.