You might be an electronic engineer if… (V)

March 21, 2011

… you notice you have a slightly irregular heartbeat so (as well as obtain a doctor’s assurance that the condition is harmless) you design and build an electrocardiograph to see what’s going on.

ECG in operation

Building an ECG is such a common electronic hobby project that there are dozens of examples available, removing the need to reinvent the wheel.  I went for a three-lead reference design from Texas Instruments’ INA333 instrumentation amplifier datasheet and coupled this to my own digital interface.  The probes are standard ECG adhesive “dots” (thanks, eBay) with crocodile-clipped connections.  The probe leads have driven shields to reduce electrical pick-up — ECG signals are in the region of a few millivolts, from a source impedance of around a megohm, so care must be taken to shield interference.

The following picture shows the ECG trace obtained from the acquisition hardware, displayed on a digital storage oscilloscope before the digital side was populated.  It should be noted that using a mains-powered oscilloscope to probe the “patient side” of an ECG is dangerous because an electrical fault in the oscilloscope could connect the patient to a high voltage.  This risk is mitigated by the in-line ECG probe resistors and thorough pre-use checks of the oscilloscope.

ECG trace before digitisation

For safety reasons the patient side of the implementation is powered by a 9V battery. A simple 8-bit PIC microcontroller uses its built-in 10-bit ADC, sampling the analogue signal at 400 Hz (see the source code for more information) and passing the results across an optoisolation barrier to an AVR microcontroller on the PC-side.  The AVR acts as a simple UART-to-USB converter and was chosen for its simple USB connectivity.  PC Software translates the two-byte-per-sample frames into millivolt samples for analysis using any CSV-format friendly application, such as GNU Octave or Openoffice Calc.  In principle it would be fairly simple to write a real-time ECG graphical display but this was not considered a priority.

ECG data - Click for full resolution

The data could probably do with mains frequency filtering but does show a clear PQRST sinus rhythm.  For some reason the T peak seems somewhat exaggerated is actually what you’d expect for a 3-lead ECG (see comments).   The uneven spacing to the left of the trace shows my heart beating erratically.

The following is a photo of PCB with the 9V battery removed.  Note the isolation between the PC- and Patient- side ground planes, spanned by optoisolators in each direction.

ECG - PCB

The schematic is here: page 1 is the acquisition hardware, page 2 shows the micros and power supplies and the following are links to the PCB’s Top layer, Bottom layer and Assembly Guide.

3 Responses to “You might be an electronic engineer if… (V)”

  1. nickopotamus Says:

    T wave looks fine (modulo lead position). Take 12 leads and stick them up for us to look at :)

  2. Michael Says:

    Looks like a healthy sinus arrhthymia. Perfectly normal in young adults.


  3. [...] software is a simple add-on to the old byte-data-to-CSV-data converter mentioned previously.  Now the application renders samples as they arrive using a rather basic graphing library [...]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.