For the first theme of my education we had to make a heart rate sensor. my group made one with arduino. here are the results

Technical report Healthcare project Group 6: Karlis Mendzins, Kees Renting, Yuzhen Kang and Frank de Boer Project tutor: Adriana Mattos


Many people are getting nervous when they are going to have an operation. The anxiety can influence the operation. It is needed to know what the level of anxiety is, so that the operation may go good. What are we going to do is build a “measuring device” using some sensors. This device could measure the level of anxiety, so we can get the specific data about “nervousness”. The body temperature and heart rate is changing when people is getting nervous. So we use temperature sensor and heart rate sensor to measure the data from people. We set up two group data (experiment group and control group ) and found out which level of scale is for normal condition which one is for anxiety. We built “a measuring device” on the breadboard. In the same time we made a code for “ArduinoUno” . Finally, before patients are going to have the operation, we can use this device to measure the level of anxiety.


For the health-care project we had to build an installation that can measure the nervousness of a patient before an operation. Before we can start, of course, we need to know what would happen if a person gets nervous. Firstly, we have to look at the patients vital function and see if they change and, if so, how. the most prominent is the heart rate. After that comes the temperature, breathing and sweat. the reason why heart rate is most prominent is because it is most easily to measure reliable data. It is known that a healthy heart rate for an adult is between 60 and 90 beats per minute. But the breath rate is different for each person. The body temperature (taken internally) is average 37 degrees by Celsius. But it is not easy to measure. Our hypothesis is that the heart rate will go up when the patient is nervous. Also that their will be temperature changes in body parts, the sweating of the patient will increase and the breathe rate is expected to increase. We decided to concentrate on only heart rate and temperature. We decided to do so, because they are most easy to measure and therefore can give us a more reliable data.
Our goal is to find a way to measure these two body functions and display them as accurate as possible. There are many ways to measure these functions. For example, we can use “Coachlab” with its features or we can use the “ArduinoUNO” and program our own installation. We decided to use “ArduinoUNO” because of the following reason, we think that coach lab is too basic and not reliable enough. While “ArduinoUNO” is more complex to program, when we finally programmed it, it will work more reliable. There is also on more reason why we have chosen “ArduinoUNO”. With “ArduinoUNO” we can make it to not only measure the data, but also and display the data. This gives no need for computer. Only thing that is needed for it is a power source and a display.


After the completion of Task 2, we were given the explanation for Task 3. Johan explained the goal and that we could order sensor for “Coachlab”. All the sensors would work with “Coachlab”. That made “Coachlab” as the most logical option to work with. But, because of our bad experience with it in Task 2, we decided to look for a different option. We heard from another student, who is now in Masters program, that they had made an infrared heart rate sensor. As we were interested, they gave us some ideas to work with. They told us that it is possible to make an infrared heart rate monitor with “ArduinoUno”. We decided to make our own heart rate measuring device. First, we started by doing some research on Internet. And we found a workable example. Only thing was, we could not make it to work. So we than tweaked the circuit and set out on making a workable code. After a while we got a workable prototype. It still had some bugs but it worked. Heart rate monitor works in the following way - an infrared led emits an infrared light, then the light will be caught by a photo resistor, then, when you would put your finger in between the infrared led and the photo resistor, the infrared light that arrives at the photo resistor will be less intense. And we can measure the difference in blood flow through the veins of the finger. From that we can find the heart rate. We than set out in perfecting our creation - added a display for the heart rate and put the the sensors in a comfortable compartment for your finger.
Even though our heart rate monitor was finished and working, we decided to ad a temperature sensor. With this we had a dilemma because we could technically plug in our sensor that we have gotten from Johan. But the problem remained, it still was impractical to use. We decided to make another our own one with “ArduinoUno”. We looked on the Internet for good examples, set out to improve it. The most trickiest part was getting the two systems to work in one circuit and getting the code to work together. Integrating the circuit was not hard to do. We needed to find a way to get both code to work together in one code or make it so we can easily switch between the two different codes. The problem in a long period was that the heart rate was not accurate. It showed two heart rates. One which was accurate and other that was higher and inaccurate. The reason for this we could not explain. But we did know which one was the real heart rate, because the value of the lower measurements was similar to the measurements from the biology practical. Where we measured our heart rate with a real retail device. So we had to find a way for the device to ignore the inaccurate measurements. We changed the code for that. The easiest way was to put a maximum value on the code. On the other side, this could only work to some extant because a heart rate of 200 is possible so that would be our maximum. Meanwhile, in rest the inaccurate measurements would be somewhere between 100 and 200 while the real heart rate would be between 50 and 100. While a nervous person could have a higher heart rate than 100, even up to 200. The way we finally got over this problem was to put a small measurement delays so it would only measure the first (accurate) measurement and ignore the second measurement. But after the completion of the code and when the display would work correctly the device would be fully working. Also we added a timer so we can see how long we have measured the patient. Plus it makes an average form the heart rate. Our measuring device measures heart rate and temperature. Those are two main measurable changes if a person gets nervous. We have to note that, if there is a malfunction, then we should focus on the heart rate sensor and leave out the temperature sensor.

Code: //Includes

// Pins const int ledPin = 13; const int hartPin = 0; const int tempPin = 1; const int verschilPin = 2;

// Hardslag LED int ledState = LOW; long ledOnMillis = 0; long ledOnInterval = 50;

// Hardslag detectie variabelen int newHeartReading = 0; int lastHeartReading = 0; int verschil = 0; int metingen[8] = {0,0,0,0,0,0,0,0}; int historySize = 8; int recentTotal = 0; int index = 0; boolean highChange = false; int minimaalVerschil = 5;

// Hardslag timing long lastHeartbeatTime = 0; long debounceDelay = 150; int currentHeartrate = 0; int lastHeartrate = 0;

// Debugging string String debugOutput = "";

void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); }

void loop() { // LED UIT digitalWrite(ledPin, LOW); // Lees de sensorgegevens uit newHeartReading = analogRead(hartPin); minimaalVerschil = analogRead(verschilPin); minimaalVerschil = 2;//(minimaalVerschil-403)/100;

//Bereken verschil tussen nieuwe en laatste meting verschil = newHeartReading - lastHeartReading; lastHeartReading = newHeartReading;

// Find new recent total recentTotal = recentTotal - metingen[index] + verschil; // replace indexed recent value metingen[index] = verschil; // index + 1 index = (index + 1) % historySize;

if (recentTotal >= minimaalVerschil) { // Mogelijke hartslag bekijk de timing if (millis() - lastHeartbeatTime >= debounceDelay) { // Hartslag digitalWrite(ledPin, HIGH); currentHeartrate = 60000 / (millis() - lastHeartbeatTime); lastHeartbeatTime = millis(); if (currentHeartrate <= 200)// && currentHeartrate > 20) {
LCD_CMD(0x80); Serial.print("Heartrate=>" + String(currentHeartrate) + " "); } LCD_CMD(0xC0); Serial.print("Hand Temp=>" + String(recentTotal));


} delay(10); } void LCD_CMD(int Command) { Serial.print(0xFE, BYTE); Serial.print(Command, BYTE); }


As we were not searching for a measurement in an experiment but in an equally made a device, we decided it would be best to explain how it works. First of all, as we mentioned before, the device is build on “ArdiunoUno”. The infrared sensor works by sending an infrared light to a photo resistor which is measuring the amount of infrared light that is going through the surface (in our case - finger). The infrared light and the photo resistor are parallel each to other on the circuit board. Photo resistor sends a signal to an analog input from the “ArduinoUno” board. It also has a light standing serial to it. The measurements are sent to “ArduinoUno” for calculation and it can be seen on a LED, that is blinking according to the heart beats tempo. The “ArduinoUno” then is calculating the raw data and will send it to a display. The display is connected to a digital pin on “ArduinoUno”. The LCD display shows the average heart rate and the time that it is showing and process measurements. Besides all this we have a temperature sensor. It is plugged directly into “ArduinoUno”. It has a ground, 5V and a analog pin input. The data is also sent to the display. We also have a variable resistance parallel to everything. Therefore it is helping us to control the scale of the measured data.

  1. Conclusion

Our goal was to measure heart rate and body temperature. The reason for it was to measure persons anxiety before an operation. These body function are linked to a nervousness of a person. That is why we wanted to make a device that can measure both of them them. We made this device successfully on “ArduinoUNO”. The results of the measurements are shown on a small LCD display. Device measures patients heart rate. The heart rate is going up when a person gets nervous. Your body temperature also changes when you’re nervous. That is why we decided to put a temperature sensor on the device. They both are working in the same time on “ArdiunoUno”. The most important thing is that they measure the change in the patient. On our mind, it is more important to measure the changing in patients state. We put our measurements in a scale so we can easily see how big or small the changes are. also we added a timer so we can see how long we measured the patient. also it makes an average form the heart rates. But for the future we could make a chip for the circuit, so i would look a little bit nicer. because now it works perfectly but looks really confusing. but that is the only real problem i can find with it now.


Heart rate monitor example: Temperature sensor example: