A Simple Library for Getting ECG on Arduino
by the_3d6 in Circuits > Sensors
2363 Views, 7 Favorites, 0 Comments
A Simple Library for Getting ECG on Arduino
This project illustrates how to get raw and processed ECG data from uECG device using this library
Project requires:
- Arduino
- nRF24 module (any)
- OLED (for showing data, can print them to serial monitor instead)
- uECG device for measuring ECG and transmitting it via radio
Schematics
Arduino connections are standard: nRF24 module via SPI like in any other example (you can connect CS and CE wires to different pins if you want to, just need to adjust numbers in the code), OLED module via I2C also like in any other example :)
Code
Make sure you have installed RF24 library (for, well, nRF24 module) and Adafruit SSD1306 library for OLED.
Then install uECG device library: https://github.com/ultimaterobotics/uECG_library
Sketch code looks complicated, but in fact for getting ECG data you need only a few lines (uECG.begin() , uECG.run() and uECG.getBPM/steps/ECG/whatever - library provides a lot of options) - everything else is required to get these data displayed on screen with proper scrolling and scaling. You can find a much, much shorter sketch in library's examples that only prints stats to serial monitor.
Downloads
What to Expect
In addition to OLED displaying current data from the device, you can see ECG data in serial plotter. Since all data are transmitted via radio, and nRF24 is having hard time processing this data stream, it's normal to see some missed data points - but mostly stream should be fine at a close range. At longer range it would become less reliable, and from another room only few packets would arrive - still allowing to get BPM and other data calculated on the device, but no realtime ECG.