Awareness of our body vital functions can help in detecting health problems. Current technology provide tools for taking measurements of a Heart Rate in domestic environment. As a part of the master course Advanced Concept Design (sub-course TfCD) at the Technical University of Delft, we created a bio-feedback device.
What do you need?
1 Pulse sensor
1 RGB LED
3 resistors (220 Ohm)
3D printed enclosures
Presenting measurement by a light colour is simpler to understand and interpret than raw numbers.
It could also be made portable. Using smaller micro-controller and breadboard will allow to increase the size of the enclosure. Our code use average values of the heart rate but by small changes in the code you can adjust the feedback to more specific values for your age group and health condition.
The main weakness is the responsivity of the heart rate sensor. It takes some time to detect heart rate and show desired feedback. That delay could be significant sometimes and may lead to the wrong performance.
Step 1: Preparing Electronics
The heartbeat sensor is based on the principle of photo plethysmography. It measures the change in volume of blood through any organ of the body which causes a change in the light intensity through that organ (a vascular region). In this project, the timing of the pulses is more important. The flow of blood volume is decided by the rate of heart pulses and since light is absorbed by blood, the signal pulses are equivalent to the heart beat.
Firstly, the pulse sensor is to be connected to Arduino to detect the BPM(beats per minute). Connect the pulse sensor to A1. The led on the Arduino board should blink in sync with the detection of BPM.
Secondly, place an RGB LED along with 3 resistors of 220 Ohm connected as shown in the schematic diagram. connect the Red pin to 10, Green pin to 6 and green pin to 9.
Step 2: Programming
Use the heart rate measurement to pulse the LED at the calculated frequency. Resting heart rate is around 70 bpm for most people. After you have one LED working, you can can use another fading off with IBI. A normal resting heart rate for adults ranges from 60 to 100 beats a minute. You can categorise the BPM across this range according to your test subject.
Here we wanted to test on resting persons and so categorised the BPM above and below this range into five categories accordingly.
Alarming ( below 40) - (blue)
Warning ( 40 to 60) - (gradient from blue to green)
Good ( 60 to 100) - (green)
Warning (100 to 120) - (gradient from green to red)
Alarming (above 120) - (red)
The logic for categorising BPM into these categories is:
if (40 < BPM < 60)
R = 0
G = (((BPM-40)/20)*255)
B = (((60-BPM)/20)*255)
if (60 < BPM < 100)
R = 0
G = 255
B = 0
if (100 < BPM <120)
R = (((BPM-100)/20)*255)
G = (((120-BPM)/20)*255)
B = 0
if (120 < BPM)
R = 255
G = 0
B = 0
You can make use of Processing Visualizer App to validate the pulse sensor and see how the BPM and IBI changes. Using the visualiser needs special libraries, if you think serial plotter is not helpful, you can make use of this program, in which processes the BPM data into a readable input for Visualizer.
There are several ways to measure heart beat using the pulse sensor without pre-loaded libraries. We used the following logic, which was used in one of similar applications, using five pulses to calculate the heart beat.
Single_pulse_time= Five_pusle_time /5;
where time1 is first pulse counter value
time2 is list pulse counter value
rate is final heart rate.
Step 3: Modelling & 3D Print
For the comfort of measurement and safety of electronics its advisable to make an enclosure. Moreover it prevents the components being short-circuited during the use. We designed a hold-able simple shape which follows the organic aesthetics. It is divided into two parts: bottom with hole for the pulse sensor and holding ribs for Arduino and breadboard, and a top one with a light guide to give a nice visual feedback.
Step 4: Electro-mechanical Prototype
Once you have the enclosures ready, place the pulse sensor into the guiding ribs in-front of the hole. Make sure the finger reaches the sensor and covers up the surface completely. To enhance the effect of the visual feedback, cover the internal surface of top enclosure with an opaque film (we used aluminium foil) leaving out an opening in the middle. It'll constrain the light into a specific opening. Disconnect the Arduino from laptop and connect a battery of more than 5V (we used 9V here) to make it portable. Now place all the electronics into the bottom enclosure and close with the top enclosure.
Step 5: Testing and Troubleshooting
Now its time to cross-check the results! since the sensor has been placed inside, just before the enclosure opening, there could be little change in the sensitivity of sensor. Make sure all the other connections are intact. If it seem to be something wrong, here we present few case to help you deal with it.
The possible errors could be either with input from sensor or output for RGB LED. To troubleshoot with sensor, there are few things you'll have to observe. If sensor is detecting BPM, there should be an LED on the board (L) blinks in sync with your BPM. If you don't see a blink, check the the input terminal on A1. If the light on pulse sensor doesn't glow, you've to check the other two terminals(5V and GND). Serial plotter or serial monitor could also help you to make sure the sensor works.
If you don't see any light on RGB, the first you've to check the input terminal(A1) because the code works only if there's a BPM detected. If everything from sensors seems fine, look for the overlooked short circuits on breadboard.
Step 6: User Testing
Now when you have a ready prototype you can measure your heart rate to receive light feedback. Despite receiving information about your health you can play with different emotions and check the response of the device. It could also be used as meditation tool.