Introduction: ECG Logger - a Wearable Cardiac Monitor for Long-Term Data Acquisition and Analysis
Status : 3.2.1.5 Beta
Latest version : 3.2.1.5 (13 Mars 2022)
First release : Oct 2017
Difficulty : Medium
Prerequisite : Arduino, Programming, Hardware building
Documentation : Read the Help available from the ECG Logger Viewer application software
Support : Forum only, no PM
New V3 Version
From v3.1.0, versions include a Hardware improvement with a RTC module and a Buzzer for the user interface. Now the Holter device can be run without the need to connect the device to a PC before use. The ECG Logger Viewer application since V3.1 provides a HRV (Heat Rate Variability) distribution chart.
ECG Logger is a Wearable Cardiac Monitor for Long-Term Data Acquisition and Analysis. The ECG Logger Project is aimed for providing a very low-cost (~35$) open-source (GPL3 license) hardware device and freeware (CC-BY-NC-NA license) application software for a Rhythmic Holter. The hardware has been made very simple and is based on an “Arduino Nano” with companion boards for the SD card, RTC and the instrumentation differential amplifier. It helps monitoring arrhythmia syndromes such as bradycardia, tachycardia, extra-systoles, pause or flutter.
ECG Logger Viewer is the companion software for reading ECG data from the ECG Logger device
In no case it can be use to replace a professional medical examination.
DISCLAIMER: *** RISK OF ELECTRICAL SHOCKS AND DEATH ***
Safety rules related to electrical devices must be complied and no connection direct or indirect* shall be made between the Holter device and appliances connected to mains (* e.g. when the device is connected to the USB port of a PC powered from the mains).
Persons unskilled, not familiar or unaware of electrical risks are discouraged to get involved. This project is provided for training/education and in no case for commercial purposes or medical diagnostics. Use of this project information is under the ENTIRE and SOLE RESPONSIBILITY of the USERS. It has not been approved for any kind of applications.
ELECTROSMOG FREE SYSTEM: This Holter project was developed without using WiFi or Bluetooth systems which could have speed-up the data transfer but turned out to be unhealthy when worn for 24 hours.
Note : "ECG Logger Viewer_setup_x.x.x.x.hex" is the Windows setup executable file to be renamed with .exe. The Arduino HEX file is included inside the setup file.
Step 1: ECG Logger - a Holter Device
Short description
ECG Logger make available a complete solution including a pocket-size ECG recorder hardware device with embedded firmware and an ECG analysis software application. The ECG signal is recorded onto a SD card memory at high frequency (250Hz sampling rate). The device is backed by the recent technology offering more freedom and accuracy for up to 24 hours continuous recording.
The system is based on an “Arduino Nano” microcontroller, an AD8232 Heart Rate Monitor amplifier board and a SPI SD card module with absolute minimum extra components
Features
- Stable and reliable recorder, based on state-of-the-art and most recent technology
- Anti-jamming and anti-shock
- Small in size
- Waveform record and event marking
- Accurate start time record and sampled data
- Built-in SD card for storage (can be plug-in and pull-out)
- No need to compress original data, thanks to the large storage capability
- USB 2.0 interface
- Record waveform details based on high precision and sampling frequency
- Record the state of pacemaker using higher sampling frequency.
- Automatic R-R peaks detection using Pan-Tompkins.
- International standard of 3 leads. Record up to 24-hour of ECG signal.
- Very simple and ergonomic user interface
- Real time clock for time time stamping
IMPORTANT:
Parts of this project are Open-Source (Hardware) or Common Creative (Firmware and Software) licensed for educational purposes only and none of its components can be used or reused for commercial purposes or applications.
USB driver must be installed on the computer prior to Holter (Arduino Nano) connection. Some Arduino use the FTDI chipset whereas some Chinese products require the CH340 chipset. The corresponding driver must be downloaded and installed on the computer. Click Start >> Control Panel >> Device Manager, and in the device list look for Com Ports (e.g. USB-SERIAL CH340).
Specifications
- Number of Channels: 1
- Lead:standard 3-lead
- Sampling Rate: 250 Hz
- Sampling Accuracy: 10-bit / 8-bit selectable
- Recording Time: up to 24 Hours
- Time accuracy: +/- 1 minute per day
- Interface: USB 2.0 (230 kbauds)
- Scale Voltage: 1 mV ±5%
- Sensitivity valve: ≤20μV
- Lowest voltage signal: 50 μ Vpp
- Input Impedance: ≥ 1GΩ
- Input circuit bias current: ≤ 0.1 μA
- Noise level: ≤ 10 μ Vpp (0.1 Hz to 40 Hz)
- Common-Mode Rejection Ratio: >= 60 dB (DC to 60Hz)
- Electrode offset rejection: ± 300 mV
- Voltage tolerance: ± 500 mV
- Time constant: > 3.2 s (0.3Hz)
- Frequency response: 0.05 ~ 125 Hz
- Filter: AC, EMG, Drift Filter, RFI
- Complex QRS detection: Pan & Tompkins algorithm
- Safety Human Body Model: 8 kV ESD (HBM)
Physical Parameters:
- Type B: internally powered
- Size (L x W x H) : 100 x 60 x 25 mm
- Net weight (w/o battery): 65 g
- Weight with batteries: 111g
- Total weight: 195 g (incl. carrier/electrodes)
- Power: 4 x AAA batteries
- Autonomy: >30 hours with Alkaline batteries
Average consumption:
- Normal mode: 17 mA (Standby)
- Sleep mode: 6.2 mA
- Recording mode: 31 mA (~36 hours - depend on SD Card)
Step 2: ECG Logger Viewer - a Data Analyzer
Short description
ECG Logger Viewer is the Holter device companion application for downloading, analyzing data and managing patients.
- NEW: Version 3 with drastically improved performances (requires ECG Logger FW v1.6.0+)
- Heart rate variability processing (HRV)and graph distribution
- R-peak detection and arrhythmia classification
- Arrhythmia : Bradycardia, Tachycardia, Extra-systoles, Pauses or Flutter
- Support ECG analysis for Holter signals, precordial V1 to V6 and Derivations (I,II,III)
- Detection of ECG artifacts
- Preview and print of ECG signal and statistics
- Data export in EDF/BDF formats
- Interface in English, French and Chinese
- Automatic firmware update
- ECG navigation by arrhythmia types or time position
- IMPORTANT: runs only with the "ECG Logger" Holter device.
- Requires "ECG Logger" Holter device version 1.6 or above
- Portable supported since v2.0
- Full documentation in the Help (Hardware and Software)
SOFTWARE
Software runs under Windows and support 3 different languages. Run the installer and read the Help file.
DOWNLOAD
You can also visit "ECG Logger Viewer" at SF.
Attachments
Step 3: Building the Device
Short description
HARDWARE
The electronics has been made as simple as possible and does not require a PCB. A simple piece of Veroboard can do the job.
FIRMWARE
You must upload the Arduino Nano with the HEX file. The code use 100% of the FLASH memory and new bootloaders could prevent uploading the firmware if there are bigger.
The device Firmware file (e.g. ECG Logger v3.1.3.hex) is copied into the Arduino subfolder under the application. Hardware can be flashed using 3rd party utility or the ECG Logger Viewer application. Pay special attention to your chip bootloader.
Note about HEX file and Arduino bootloader:
The Arduino Nano has a 32K Flash memory and the bootloader uses 2K. From the remaining 30K (30 720 B) of Flash, the firmware uses 30 692 Bytes leaving very few bytes free!
There are two different bootloaders (selectable from Arduino IDE >> Tools >> Processor ):
- ATmega328P (Old Bootloader) is the "ATmegaBOOT" bootloader and expects the upload communication at 57600 baud.
- ATmega328P is the "Optiboot" bootloader expects the upload communication at 115200 baud.
Whereas genuine Arduino Nano are provided with the Optiboot bootloader, the chinese versions (using the USB chipset CH341) are loaded with the ATmegaBOOT bootloader. Programming communication speeds is different !
NOTE : The current HEX file have been developed for Arduino with "ATmegaBOOT" bootloader but also runs with the Optiboot too.
16 Comments
10 months ago
I made it!
Excellent!!
1 year ago
I built this on breadboard, having assembled most of the components previously for use with sketches widely available and easily modified. One feature that attracted me to this project was the ECG paper background. However, my computer is not a laptop, and the app has a built-in safety feature that will not allow it to record when computer is connected to mains even though I have taken other steps for electrical isolation. I tried to install ECG Logger Viewer on the Pi400 using Wine without success. The Arduino code in this project is hidden from the user. If it were visible, no doubt some users would come up with interesting modifications and additions.
Reply 1 year ago
Dear Beachbum975,
Thanks for your interest about my Holter recorder.
The limitation only affects the Live mode and does not restrict the Holter mode. I'm sorry for the inconvenience but the built-in safety is necessary because in Live Mode the system is directly connected to the human body. Only battery operated systems can provide sufficient protection as there is no guarantee that all user electronics builds will be safe.
Again, there is no limitation using the ECG logger in Holter mode and I hope you will find a solution for running the application on a portable computer if you wanna use the Live Mode.
Regards
Reply 1 year ago
Many thanks for your kind reply. Unfortunately my portable computer is a pi and thus runs on Linux. It does not seem that a Linux version of the Logger-Viewer is available.
While the hardware side of of the Logger-Viewer is open source, the software side is not since the code is not visible to the user.
On the other hand, when using widely available Arduino sketch for the AD8232, It is not too difficult to add led, buzzer, SD and a button (for intermittent SD recording). I always find RTC more challenging because I am not a skilled programmer. Artifact is a problem when the system is connected to the mains and of course there is the safety objection to running the AD8232 with the computer plugged in. I get the least artifact with AD8232 connected to a Nano run on Arduino via the pi with the latter supported on battery pack. The logger-viewer interested me primarily b/c of the ECG paper background.
I do have a "trick" that might interest other hobbyists who play with the AD8232. It is easy to share the analog input from AD8232 with 2 Nanos attached to the same breadboard. That permits 2 sketches to be run simultaneously (although only one will be able to use the serial monitor at any time). If both sketches employ an SD, one can be used to record continuous ECG while the other might serve as a pushbutton-controlled event recorder or to record only when R-R interval meets user-specified criteria.
Lastly, when pi is used as the host for Arduino, VNC can be used to view the serial monitor on smartphone. This requires that the pi is a VNC server and the phone is a VNC client.
1 year ago
I made it. The firmware version 3.1.3 is a little buggy. Can't save parameters and sometimes there is difficult to launch holter mode. Version 3.1.2 work like a charm.
Reply 1 year ago
Great news! and thanks for sharing.
I'm still improving this project and working on firmware v3.1.5.
For the time being, please stay with 3.1.2 if it works and visit the website from time to time. I have optimized the code and tried to speed-up the file download but speed limitation comes from the SD card system rather than the Serial system.
Next SW and FW versions will slightly change the file format so until it has not been fully tested I cannot release it. It can take several months before releasing as this is an hobby.
New SW/FW features are :
- slight increase in file speed transfer
- Poincaré graphic possibility
- Print possible directly from the Preview screen
- cosmetic and bug fix
Question 1 year ago
Adding to my previous comment, there is one more issue. Whenever i press the "Holter Mode" option under Device menu, the following error pops up(see attached image).
The contents of that error reads as follows
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Convert.ToDecimal(String value)
at ECG_Logger_Viewer.frmHolter.FrmHolterLoad(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4400.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
ECG Logger Viewer
Assembly Version: 3.1.2.4
Win32 Version: 3.1.2.4
CodeBase: file:///C:/Program%20Files%20(x86)/AdNovea/ECG%20Logger%20Viewer/ECG%20Logger%20Viewer.exe
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4360.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4400.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 14.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Windows.Forms.DataVisualization
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4200.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.DataVisualization/v4.0_4.0.0.0__31bf3856ad364e35/System.Windows.Forms.DataVisualization.dll
----------------------------------------
ECG Logger Viewer.resources
Assembly Version: 3.1.2.4
Win32 Version: 3.1.2.4
CodeBase: file:///C:/Program%20Files%20(x86)/AdNovea/ECG%20Logger%20Viewer/en-US/ECG%20Logger%20Viewer.resources.DLL
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
ECG Logger Viewer.resources
Assembly Version: 3.1.2.4
Win32 Version: 3.1.2.4
CodeBase: file:///C:/Program%20Files%20(x86)/AdNovea/ECG%20Logger%20Viewer/fr-FR/ECG%20Logger%20Viewer.resources.DLL
----------------------------------------
ECG Logger Viewer.resources
Assembly Version: 3.1.2.4
Win32 Version: 3.1.2.4
CodeBase: file:///C:/Program%20Files%20(x86)/AdNovea/ECG%20Logger%20Viewer/zh-TW/ECG%20Logger%20Viewer.resources.DLL
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Management
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Reply 1 year ago
Dear sureshkumar_puthanveetil,
Regarding your issue due to the FREE command reading the free space on the SDC, I was not able to reproduce the failure.
Nevertheless, I changed the way I processed the returned string. I hope this will work with the new version 3.1.2.5_BETA available on source forge.
Reply 1 year ago
Thanks.
1 year ago
Hi,
Thank you for an excellent project and the steps to recreate it. I was successfully able to make the device and record and visualize the ECG signal. However i have one problem. I am not able to view the "Live Mode". That option under the Device menu remains in a disabled state. If i go to the console and change the mode to "ECG" then I am able to see the live signals there as ADC values but the Live mode in the software is not working. Any help towards solving that is much appreciated. I am using the Firmware V 3.1.3 and the Viewer software V 3.1 Build 2.4.
Also if there is an option to change the time from UTC to local time, please let me know how it is done. Thank you.
Reply 1 year ago
Dear sureshkumar_puthanveetil,
Thanks for your message.
From the screenshot, I can see that your computer is powered from the mains and does not run on battery.
For security reason, the Live ECG mode remains DISABLED for this configuration.
To enable the Live ECG mode, you must connect the holter device to a computer powered from battery only.
About the local time : the holter device run in UTC time (epoch) and the ECG Logger Viewer makes the conversion to local time based on Windows time configuration (timezone and daylight saving). Therefore there is no timezone or daylight saving time parameters.
To "force" the date-time, you may try entering the corresponding epoch (there are online epoch converters) into the device using the Txxxxxxx command but this will not be permanent and be reset when using the Holter mode dialog box.
Reply 1 year ago
Thank you! Solved the problem. It is an excellent project.
Question 2 years ago on Step 3
I built this ECG on a breadboard. I used a clone nano (old bootloader).
Problem: When I push the button the serial monitor shows: "Start recording, ERR2"
The source code is not available so I cannot determine what is causing this error. Any help would be much appreciated.
thanks
Reply 2 years ago
ERR0 SD card failed! Check SD,
reformat SD card
ERR1 Cannot rename temp file. Extract
the SD and delete the dataxx.hlr file. Clear all files (CLEAR), reformat SD
card
ERR2 “createContiguous” function
failed
ERR3 “contiguousRange” function
failed
ERR4 “cacheClear” function failed
ERR5 File erase failed
ERR6 “writeBegin” function failed
ERR7 Write data sample failed
ERR8 Missed timer event – sampling
rate is too high
ERR9 “writeStop” function failed
ERR10 Can't truncate file
ERR11 Can't rename file
ERR12 More than 100 files already on
SDC!
ERR13 Parameters string is invalid. Check the
PARAMS command syntax.
There is a problem with the SDC. The speed of the SDC may be too slow or the format is corrupted.
I guess you already have tried different SDCs? There are big differences between SDCs. Some are really poor and other require lot of current. It could take time -and a bit of luck - to get the right SDC (avoid cheap chinese ones). I use Samsung 2GB SDC.
Here are the results of some tests I had conducted on SDC :
Measured overall current along with SD card
type (recording):
- Mobizen
Micro SD 4GB (46 mA)
-
Samsung 2GB (27 mA) but about 20/25 overruns/min
-
SanDiskUltra 8GB (31 mA and rec. 48.35 mA)
-
SanDisk 4GB class 4 (31 mA)
SD card stop working
around 3.8-3.9V
Reply 2 years ago
THANK YOU 😘
2 years ago
has anyone built this sucessfully?