A few months ago, MobilECG wowed us with a formidable electrocardiograph (ECG, also EKG) machine in the format of a business card, complete with an OLED display. We’ve seen business card hacks before, but that was the coolest. But that’s peanuts compared with the serious project that it supports: making an open-source ECG machine that can actually save lives by being affordable enough to be where it’s needed, when it’s needed.
The project, MobilECG, is an open-source, wearable device that supports all of the major ECG modes. In their talk, [Péter Isza] and [Róbert Csordás] taught us a lot about what that exactly entails and how the heart works. We learned a lot, and we’ll share some of that with you after the break.
ECG
The heart has four chambers, and driving these different muscles in sequence produces tell-tale electrical signals. When measured in the right places, with the right resolution, these signals tell a doctor a lot about the heart’s functioning. [Péter] laid it out for us.
For instance, measuring the electrical potential between two thumbs yields a signal of approximately a millivolt which lasts for around 80 milliseconds. The technical challenge here is to discriminate the 1 mV signal from the roughly 300 mV baseline, without accidentally introducing noise that would drown out the tiny signal. MobilECG approaches this problem by throwing 24 bits of ADC resolution at the problem and doing the filtering in software where it’s noiseless. This is what their business card does.
But there are a couple more tricks available if you’re willing to hook up more electrodes, and a medical ECG has twelve signals measured from ten electrodes across the body. Four of these are on the hands and feet, while six more leads are located on the chest near the heart.
“Wilson’s central terminal” is a derived voltage that’s computed from the hand and foot electrodes. It’s the average of the three others relative to the right foot. This voltage is used as a baseline for the other measurements, and because it’s an average reading across the whole body, it’s relatively immune to all but common-mode noise. The voltages from the chest leads, measured in reference to Wilson’s central terminal, give particularly detailed information about heart function, including precursors to heart attacks.
The trick to get rid of the common-mode noise is to re-introduce the opposite of the noise back into the body. Called “right-leg drive”, this method essentially cancels out the results of the body being a big antenna.
The biggest source of interference, which you’ve noticed when you touch an oscilloscope probe, is the roughly one-volt 50/60 Hz power line signal pulling your body voltage up and down at all times. Right leg drive cancels this out, and gets rid of other common-mode signals.
Signal Processing
With these signals in mind, [Róbert] came on and walked us through the design of the credit-card demo, which is essentially just a precise ADC. All of the magic takes place in firmware, and most of that is in filtering. Basically, they need to use an IIR filter for computational complexity reasons, but they can’t afford the distortion that introduces. If you run an IIR filter on the data backwards, it cancels out this distortion, but that means keeping the data around in a buffer and running the IIR on overlapping sections. The rest of details are technical, so see the talk or their GitHub if you want to know more.
These filters are applied to all of the signals. Then to detect a heartbeat, they need to look for a peak in one of the signals; it’s called “QRS detection”. It’s a very clever peak-detection algorithm with a dead-time that’s proportional to the current heart rate, and a decaying threshold thereafter until the next peak is detected. Making the algorithm adaptive like this helps cancel out the effects of the patient or the electrodes moving.
The Hardware
To wrap up the talk, [Róbert] provided us with an overview of the main unit’s hardware design. Of course, it’s all open so you’re free to dig into the details yourself.
Where the business-card version uses a general-purpose ADC, the full-fledged device uses a special-purpose analog front-end, based on the Analog Devices ADS1298, that is designed specifically for ECGs. It digitizes eight channels simultaneously, and calculates the Wilson’s central terminal and right-leg drive voltages in hardware. The rest of the hardware design is an STM32F4 microcontroller and a Bluetooth module to get the data out. Measuring all of the signals, the device should run on its built-in battery for a day. That’s pretty impressive for something that’s smaller than a cell phone.
The Future
We think that making low-cost, open-source medical devices is fantastic. It’s a way to get medical care to the most people for the least cost. Thanks, [Péter] and [Robert] for sharing your project with us!
Filed under: cons, Hackaday Columns, Medical hacks
No comments:
Post a Comment