Introduction: ECG Based Heart Rate Indicator Ring
Blinking a bunch of LEDs in sync with your heart beats should be simple with all this technology around, right? Well - it was not, until now. I personally struggled with it for several years, trying to get signal from multiple PPG and ECG schematics, and it just wasn't reliable - the best PPG device I managed to make a couple of years ago missed one beat out of 5.
But check this out! This project is based on uECG device which is currently available at our team's crowdfunding page ( uECG campaign ) - and since I was developing it for a while, I'm eager to show how it works :) (device is already developed, crowdfunding is needed just for batch production).
UPD: I've made a 2nd iteration of this project, now it receives data via radio link.
- uECG device ( crowdfunding page, you won't need enclosure)
- Arduino (any type would work, I've used Nano)
- LED ring (I'm using 16 segments, but you can easily adjust program for smaller/larger versions)
- LiPo battery small enough to be taped to your shirt, but not less than 120 mAh. I'm using 240 mAh.
- Some wires and pin headers (and soldering iron at hand - since it's a wearable project, it won't work well unless most connections are soldered)
Step 1: Schematics
Schematics is very simple. The system will run from LiPo output used as 5V Arduino supply (please don't use uECG's built-in battery for this: it will distort readings). Strictly speaking, you can't connect unstabilized battery input there, but while battery voltage is higher than 3.4 volts, it will work fine (Arduino can stretch "5V" down quite a bit - at low voltage it would become unstable and you'll see strange behavior, but while battery is charged, it will work).
So you need to connect battery's red wire to Arduino 5V and to LED ring 5V (and make sure you have somewhere a connector - so you can disconnect and charge the battery).
Battery's ground should be connected to Arduino's ground, LED ring ground, and uECG ground.
LED ring's DI pin is connected to Adruino's D11.
uECG drv pin is connected to Arduino's D3.
Step 2: Arduino Program
When you connect pulled up pin to uECG's DRV pin, it changes state from HIGH when there is no beat to LOW when there is a beat. So you just need to read state of this pin in a fast cycle and calculate BPM from intervals. In my code, last 20 beats are used to average value over them. I also added some code to convert current BPM into color and number of used LEDs, so they blink when there is a beat. It looks nice, yet simple in programming - you can easily change it into pretty much anything.
Step 3: Putting It All Together
You need to fix LEDs, arduino and battery on a shirt - I simply used a tape, quick and dirty. Then I connected it via a wire to uECG on my chest, and that's basically it - went testing after that.
Test indicated that running with a bunch of stuff bouncing right over ECG sensor makes it work not as good as when it is there alone :) But when I'm walking or staying still, it works perfectly fine. Overall, I'd like to make indication more sensitive: since my BPM hardly ever gets lower than 60, 1 active LED could indicate that BPM instead of 6, this way changes will be much better visualized. But other than this, I'm satisfied with the result. After all, it was the first test of this uECG version (ok, technically second: first time I tried to record video late in the evening the day before, but at night LEDs are too bright for the camera).
Overall, I plan to place it all in a bit different way - so LED stuff won't prevent uECG from measuring while running - and use on streets ))
Step 4: Discussion
The main result of this project, of course, is my closure with LEDs and heartbeats )) And I didn't actually knew that once I step outside, my BPM raises by 30 points. But real analysis is yet to be done, this is only a start.
Other than that, if you are interested in how ECG analysis actually works - please visit hackaday page of uECG, it has a lot of info about this project, its schematics and PCB design, discussion of algorithms, team photos, usual stuff. Any and all feedback is really appreciated.
Participated in the