Introduction: Wireless and Wearable Heart Rate Monitoring Device
Health monitoring has always been a promising application for the Internet of Things (IoT). By using the right technology we no longer have to depend on our general routine health check-up or our local physicians to assess our body. Sensors can be used to measure all your body vitals and this information can be shared remotely in real-time for a doctor from other parts of the world to diagnosis you or perhaps an AI could crunch all the numbers and diagnosis your problem.
Sounds futuristic, right?
But we are gradually moving towards it and we are not very far from having remote IoT Robotic Arms performing surgery on us.
Previously we built IoT Based Heartbeat Monitoring System using Raspberry Pi.
While we progress with that, in this session, we will build a wearable Arduino heart rate monitor to measure the heart rate of a remote patient.
Step 1: Components Required
The following are the components required to build your Wearable Arduino based Heart Monitoring System
All hard work is done by uECG - it measures data and calculates BPM on-board. But also, when it's switched into direct link mode, it sends all this information (together with high-resolution ECG data) via radio protocol that is compatible with the generic nRF24 chip. So the second critical component is the nRF24 module. And Arduino Nano has just the right size to fit underneath a small LED ring, so I'm using it as a controller.
Step 2: Circuit Diagram and Connections
Connecting the nRF24 module isn't simple, you have to connect all SPI wires (MISO, MOSI, SCK, CS), also chip enable wire and power supply. And if you want it in a reasonably small size - all pin headers have to be removed, and wires soldered directly to pads. So connecting nRF alone takes 7 wires, 14 soldering points. The good news is that everything else is simple: LED ring requires 1 data wire and 2 power wires, and another 2 power wires go into the battery connector.
Here I am showing you the connections so that it will be easy for you to perform the task.
nRF24 pin 1 (GND) - Arduino's GND
nRF24 pin 2 (Vcc) - Arduino's 3.3v
nRF24 pin 3 (Chip Enable) - Arduino's D9
nRF24 pin 4 (SPI:CS) - Arduino's D8
nRF24 pin 5 (SPI:SCK) - Arduino's D13
nRF24 pin 6 (SPI:MOSI) - Arduino's D11
nRF24 pin 7 (SPI:MISO) - Arduino's D12
LED ring Power - Arduino's 5V
LED ring GND - Arduino's GND
LED ring DI - Arduino's D5
Battery positive (red) - Arduino's 5V
Battery negative (black) - Arduino's GND
Important note: you can't connect MOSI, MISO, SCK wires to any other Arduino pins. SPI hardware sits on D11, D12, D13 and won't work if not connected there. All other pins can be changed but for that, you have to make corresponding changes in the program
Step 3: Let's Do Programming
The only complicated thing about software here is RF channel configuration. I spent quite a while trying to make it work before I realized that uECG and nRF24 use different bit orders for pipe addresses. When I fixed that, everything started to work immediately :) Basically, we just read incoming packets, use their 5th byte as BPM, and filter it (RF channel is noisy, so every now and then you get random value instead of correct reading, and hardware CRC is disabled for compatibility reasons). After that, BPM is converted into color and the number of active pixels, and that's it.
Complete Code for Arduino Heart Monitoring System can be found in the attachment.
Step 4: Testing Wearable Heart Monitoring System
When all wires are soldered, the program is flashed, and you confirmed that uECG data is received - it's time to get it all together.
I've chosen a very simple way to hold it all together - thermal glue. Since parts themselves are almost fitting already (Nano fits outer ring size, nRF24 module fits internal ring size, and battery, while not fitting any part, somehow doesn't get much in the way - not sure how it works, but I just glued it there and somehow it was really ok :) Then I sewed it to some random wristband I had at hand (leftover from soldering station pack, a band that is used for grounding while soldering), and that's it!
For testing, I went for a run, and it worked just fine except for one surprise. I've used such settings that at 192 BPM all LEDs were on since by all recommendations such heart rate is too high for my parameters. The surprise was that I've exceeded it in just a few minutes of running, without even noticing that. I even thought that it could be a sensor error, but no - when I stopped, it didn't immediately go down, instead, there was a slow relaxation (sensor is 100% reliable when there isn't much motion). So it turns out that for a while I'm training well above my healthy threshold. And now I have a question - is my BPM just higher than normal due to those heart problems in adolescence, or I'm really pushing too hard without realizing that? Anyway, I'll have to do something with it - either increase max BPM on the monitor, or train less intensively. :)
Whoa! Here we are done with this project.
I hope you enjoyed the tutorial and learned something useful. Share your thoughts on this project and let me know what we can do to make this project more advanced and interesting. if you have any queries, please leave them in the comment section below.
Also, follow us on Instructables for more such interesting projects.