logo elektroda
logo elektroda
X
logo elektroda

Holter ECG (AD8232, Bascom, KokkeKat FAT)

saycomp  29 19626 Cool? (+47)
📢 Listen (AI):

TL;DR

  • A homemade single-channel Holter ECG recorder uses an AD8232 differential amplifier and an ATmega168 controller to log heart signals.
  • The design uses the AD8232 in the catalog's portable cardiac monitor configuration, feeds the signal directly to the ADC, and adds one TACT button plus three status LEDs.
  • It runs from a 250 mAh Li-Poly battery for about 5–7 days, samples at 250 Hz, and saves hourly 16-bit unsigned binary files as 000.PCM.
  • KokkeKAT FAT proved troublesome: documentation is poor, long 8+3 filenames failed, and reprogramming requires deleting all card files to avoid numbering issues.
Generated by the language model.
Hi!

I wanted to share with you the description of the construction that my life forced me to make.
I had some periodic heart problems and every time I got Holter it all calmed down ;)
If any of you have ever tried to sign up for Holter, you know that it is not easy. He waits and waits.
I decided to take matters into my own hands and build a simple, single-channel device.
While searching the internet, I came across a specialized differential amplifier (AD8232) with a filter, which is used in heart rate recorders. So I decided not to balance the open door by building a differential amplifier from scratch and ordered a few pieces of this circuit.
The layout is located on a double-sided PCB with dimensions of 42 x 32 mm. The use of the AD8232 chip requires a fairly precise PCB - the pins of the system are in a 0.5 mm raster. I make the tiles using photosensitive foil to expose screen printing screens. As a cliché, I use tracing paper printed on a laser printer and optically compacted in vapors of nitro thinner. The guides are Bungard 0.6 mm (O.D.).

Double-sided circuit board with electronics, including AD8232, card slot, and electrode. Electrocardiogram graph with distinct R waves. EKG graph with regular peaks indicating heart activity.

The system is powered by a small Li-Poly 250 mAh battery. Its capacity is enough for about 5-7 days of continuous operation.
The battery is charged via the microUSB socket and the MCP7381 system, and the power supply to the system is provided by the MCP1703 stabilizer (3.3 V).
The amplifier operates in the configuration shown in the catalog note in figure 68 (PORTABLE CARDIAC MONITOR WITH ELIMINATION OF MOTION ARTIFACTS).
The signal from the amplifier is fed directly to the ADC input of the Atmega 168 controller.
One TACT button is used to operate the recorder. Long (> 3 s) press turns on / off, short press is "event button" - it gives a characteristic, well recognizable pin in the record.
The blue diode shows that the button is pressed, the green diode shows active recording, the red diode shows a card error or the disconnection of one of the electrodes.
The recorder saves on the card hourly files in binary format, 16 bit unsigned and with the sampling frequency of 250 Hz. Numbering is automatic from "000.PCM"
The easiest way to preview a recording is to open it in an audio processing program (Audacity - free, Audition - paid), which allows you to preview the graph in a large window (Audacity: view -> vertically fit).

The construction of the Holter was also an opportunity to "face" an alternative to AVR Dos - the KokkeKat FAT library. KokkeKAT allows you to use a processor with less RAM than AVR Dos. And here, unfortunately, I must say that it is better to invest in a larger processor and use AVR Dos than to fight KokkeKAT. The latter is very capricious, poorly documented, and there are very few described structures operating with it. It is also not updated and corrected. Following the attached PDF file will result in either compilation errors or failure to read / write to the card. Until the end, I was unable to read the entire 8 + 3 file name. Only works for names no longer than 4 characters plus the extension. And not always. Reading the file name often fails and the processor (after a reset) writes the numbering over again, luckily without overwriting the existing files. Fortunately, this is not a big problem. You just have to remember to delete all files from the card in case of reprogramming the processor or disconnecting the power supply. If any of you want to bite into the program, I will be happy to find out where I made a mistake.

The plate design (Corel 9, PDF) and the program files are attached.

Best wishes
Attachments:
  • ECG.zip (1.73 MB) You must be logged in to download this attachment.

About Author
saycomp wrote 67 posts with rating 55 . Live in city Wrocław. Been with us since 2005 year.

Comments

hobbyelektronik 21 Oct 2020 17:45

Hello I can see one electrode in the photo, maybe I am wrong, while ECG uses 12-15 electrodes as standard, while checking the heart rate requires 3 to 5 leads. Each of them has a specific place on the... [Read more]

saycomp 21 Oct 2020 21:01

I only put one electrode in the photo to show that I used system solutions. There are actually 3 electrodes - one "zero" and two differential for one channel (you can see 3 wires coming from the recorder). ... [Read more]

LechU 21 Oct 2020 21:23

Yes, to be precise: the standard ECG test is performed with 10 electrodes - 4 limb electrodes ("R", "L", "F", "N") and 6 precordial electrodes ("V1" ÷ "V6"). Leads "I", "II" and "III" are obtained from... [Read more]

Janusz_kk 21 Oct 2020 21:34

But the Holter is not a standard EKG, it only has three electrodes and that's it. Apparently enough to see deeper heart disorders is enough, I also had it done and showed something. [Read more]

LechU 21 Oct 2020 21:55

YES, YES and YES again! My correction (?) Concerned post # 2 - which had some confusion with the nomenclature (leads vs. electrodes). In the simplest case, 3 electrodes are enough - 2 as a differential... [Read more]

kroolik1989 22 Oct 2020 12:38

Can you show the device operation graph? [Read more]

Piotrek1970 22 Oct 2020 14:38

From what I can see this is the second and third photo in the first message. [Read more]

krzbor 22 Oct 2020 19:49

I didn't know there were such arrangements. As I read the article, I thought about an expensive and rare integrated circuit. I entered it in google and here's a surprise: https://obrazki.elektroda.pl/5603990500_1603388597_thumb.jpg... [Read more]

bar-t 22 Oct 2020 21:36

Where did your colleague get these leads with electrode connectors? Does this connector have a name? In my searches, I was able to find some ready-made sets of cables for several dozen euros. [Read more]

krzbor 22 Oct 2020 21:40

Tu oferta Banggood Link [Read more]

ostry_18 22 Oct 2020 23:35

A single-channel ECG will give the doctor the basic possibilities of recognizing the nature of an arrhythmia, sometimes it will answer the question of what type it is. Moreover, it is a completely objective... [Read more]

krzbor 23 Oct 2020 09:05

Question to the author of the thread - can you interpret the second graph? The first one is nice, almost textbook. The second is different - significant difference in amplitude - measurement error or actual... [Read more]

ostry_18 23 Oct 2020 14:48

Numerous additional supraventricular stimuli, artifacts. [Read more]

excray 24 Oct 2020 19:23

On Aliexpress, there is a plate with wires below PLN 20. [Read more]

saycomp 25 Oct 2020 20:44

This is atrial fibrillation. Cables - search on Allegro: tens electrodes in the same place: ecg electrodes The matter is very simple. The AD8232 outputs an amplified (and filtered) signal of... [Read more]

boreas9 26 Oct 2020 13:24

This is called atrial flutter, however irregular. [Read more]

Hanslik 06 Nov 2020 19:56

Hi By using this topic (hopefully neither the author, nor the administration, nor any of the users will be angry) as it is very topical, especially in the times we have today. First of all, I would like... [Read more]

saycomp 06 Nov 2020 21:49

Welcome. Long press turns the system on / off. Registration is continuous when the system is turned on. A short press gives a characteristic pin on the graph. In this way, you can mark the moment of problems,... [Read more]

Hanslik 06 Nov 2020 22:20

Hi Thank you for your answer. For me, you are a professional, unfortunately I can only call myself a beginner, especially in the field of electronics / automation. I do not want to take any steps rashly,... [Read more]

FAQ

TL;DR: DIY Holter logger captures 250 Hz, 16-bit ECG for up to 7 days on a 250 mAh Li-Po; “three electrodes are enough” [Elektroda, saycomp, post #18991503] Why it matters: lets makers run long-term cardiac checks without waiting weeks for a clinical Holter.

Quick Facts

• Sampling: 250 Hz, 16-bit PCM, single channel [Elektroda, saycomp, post #18991503] • Battery life: 5–7 days on 250 mAh (≈1.5 mA average draw) [Elektroda, saycomp, post #18991503] • AD8232 quiescent current: typ. 170 µA at 3.3 V [AD8232 Datasheet] • File size: ≈1.8 MB per hour (250 Hz × 2 bytes × 3600 s) – FAT16/FAT32 card • Cost of AD8232 module: US $5–11 retail [Banggood offer, 2020]

What hardware makes up the basic one-channel Holter logger?

Core parts are an AD8232 differential amplifier, ATmega168 MCU, MCP1703 3.3 V LDO, MCP7381 Li-Po charger, micro-SD socket and a 250 mAh cell [Elektroda, saycomp, post #18991503]

How many electrodes do I need and where do they go?

Single-lead logging uses three electrodes: two differential inputs on the chest and one reference (right leg). “Three electrodes are enough” for Holter diagnostics [Elektroda, Janusz_kk, post #18992231]

What resolution and sample rate are stored?

Data are saved as unsigned 16-bit little-endian samples at 250 samples/s, giving ~1.8 MB per hour [Elektroda, saycomp, post #18991503]

How are files named and organised on the card?

Each hour a new file named 000.PCM, 001.PCM … is created automatically. Lack of long-filename support in KokkeKAT forces ≤4-character names [Elektroda, saycomp, post #18991503]

How do I view or analyse the recordings?

  1. Copy the PCM file to a PC.
  2. Open it as raw audio (16-bit, 250 Hz, mono) in Audacity.
  3. Zoom vertically for ECG trace, mark anomalies, or export to CSV [Elektroda, saycomp, post #19210066]

Can I add an event marker during recording?

Yes. A short button press inserts a distinctive spike so you can later align symptoms with the timeline [Elektroda, saycomp, post #19026088]

What are common pitfalls with the KokkeKAT FAT library?

It fails on 8.3 filenames >4 letters, sporadically misreads directory entries and can restart numbering, risking overwrite. “Very capricious, poorly documented” [Elektroda, saycomp, post #18991503]

Is Arduino or ESP8266 fast enough to log 250 Hz to SD?

With SPI SD libraries, both ATmega328 (16 MHz) and ESP8266 (80 MHz) sustain >10 kB/s writes; 250 Hz ×2 bytes = 0.5 kB/s, so headroom is ample. Disable Wi-Fi to cut ESP power [“how2electronics ECG-ESP8266 guide”].

What edge-case might corrupt data?

If power is lost before FAT buffers flush, the hour file may stay zero-length, so use a low-battery shutdown or super-cap. A single corrupted sector renders that hour unreadable.

How much current does the AD8232 itself draw?

Typical quiescent current is 170 µA at 3.3 V, <12 % of total budget [AD8232 Datasheet].

Quick build checklist?

  1. Solder AD8232, MCU, LDO, charger, µSD on 42 × 32 mm PCB.
  2. Flash firmware; verify SD write at 250 Hz.
  3. Attach three ECG leads, press button >3 s to start logging.
Generated by the language model.
%}