Top Banner

of 19

Appnote Ambulatory Ecg

Apr 04, 2018

Download

Documents

masteratsiifsts
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 Appnote Ambulatory Ecg

    1/19

    UNIVERSITY OF BUENOS AIRESFaculty of Engineering

    Embedded Systems Laboratory

    Ambulatory ECG Monitor System designusing LPC1768

    Azcueta, Mario Martn

    Kharsansky, Alan

  • 7/31/2019 Appnote Ambulatory Ecg

    2/19

    Abstract

    We developed a complete ECG portable monitor system (usually known as Electrocardiogra-

    phy Recording Device, or simply Holter) based on the recently released platform LPC1768 by

    NXP. In this report we comment on the key aspects of our design, mainly on those concerning

    software, and we also give a brief description of the hardware we designed in order to help the

    reader to get a global view of the system. The hardware and software presented are a reduced

    version of the actual system, which nevertheless make up to a complete device.

  • 7/31/2019 Appnote Ambulatory Ecg

    3/19

    Contents

    1 Introduction 1

    2 The ECG signal 12.1 Temporal and spectral analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    2.2 Leads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    3 Description of the device 3

    3.1 Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    3.2 Implemented functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    4 Hardware description 4

    4.1 Power Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    4.2 Analog Front-End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54.3 Digital/DSP hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    4.3.1 Touch-GLCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    4.3.2 SD card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    4.3.3 Wired interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    5 Firmware description 8

    5.1 System initialization and basic operation . . . . . . . . . . . . . . . . . . . . . . . 8

    5.2 FreeRTOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    5.3 GLCD library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    5.3.1 Basic operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    5.3.2 Framebuffer mode of operation . . . . . . . . . . . . . . . . . . . . . . . . 10

    5.3.3 Organization of the library . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    5.3.4 Graphical User Interface (GUI) . . . . . . . . . . . . . . . . . . . . . . . . 12

    5.4 QRS detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    5.5 SD recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    5.6 Firmware organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    6 Screenshots and additional resources 13

    6.1 Additional software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    6.2 Screenshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    7 Conclusions 15

  • 7/31/2019 Appnote Ambulatory Ecg

    4/19

    2 THE ECG SIGNAL

    1 Introduction

    A Holter is a medical device used for the acquisition, monitoring and recording of bioelectrical

    signals coming from the heart. It is commonly used by cardiologists to monitor their patients

    for a long period of time (usually 24 to 48 hours) and is considered to be the standard reference

    for the diagnosis and monitoring of cardiac arrhythmias. Generally speaking, a Holter can be

    thought of as a portable digital recorder of the heart signals, which uses electrodes as means to

    acquire this signals.

    The devices use is quite simple. First, the cardiologist must place the Holters electrodes

    on specific spots on the patients body. After this step, the Holter device must be turned on

    and configured by selecting the studys duration (a study consists of an uninterrupted recording

    session of the heart signals that can last between 24 to 48 hours). Next, the Holter starts

    recording the signals until the selected time is hit, when it automatically turns off. The whole

    recording process is completely automatic, and requires no attention from the patient. When

    the study is completed, the information is usually downloaded to a computer where it can be

    analyzed by a professional using specialized computer software.

    2 The ECG signal

    2.1 Temporal and spectral analysis

    The ECG signal is the register, as a function of time, of the variation of electric potential caused

    by the ensemble of cardiac cells and measured on the surface of the body.

    By placing electrodes on specific spots of the body, the variations of potential during thecardiac cycle can be measured, producing the characteristic ECG wave as shown in the figure.

    Figure 1: Characteristic ECG signal. (From Wikimedia Commons)

    The typical signal is composed of 3 characteristic sections, namely a P wave, a QRS complex,

    and a T wave.

    1

  • 7/31/2019 Appnote Ambulatory Ecg

    5/19

    2.2 Leads 2 THE ECG SIGNAL

    In a nutshell, the P wave shows the depolarization of the auricles, which in turn causes

    the ventricles to fill (this is called systole). The QRS complex shows the depolarization of

    the ventricles (called diastole), which impulses most of the blood stored in the heart to the

    circulatory system; the generated wave causes a stronger deflection than the P wave, mainly

    because more mass displacement is involved in this step of the cardiac cycle. Finally, the Twave shows the repolarization of the ventricles.

    The QRS complex lasts about 60 to 100 milliseconds, and has a period of roughly one per

    second (which corresponds to a heart beating at 60 beats per minute). Concerning the spectrum

    of the ECG signal, it is usually considered in medical the literature to have a useful bandwidth

    of about 50 to 100 Hz, (disregarding power line, muscular noise and other commonly found

    artifacts.)

    The detailed physiologic bases for the formation of this signal can be found in any standard

    book on the subject, and we will not comment further here.

    2.2 Leads

    In electrocardiography, the term lead refers to the measurement of electric potential between

    two electrodes. The electrodes are placed on the patients body (typical Holter electrodes consist

    of self adhesive disposable patches) and connected to the Holter using shielded cables. Different

    combinations of electrodes can be used to show particular aspects of the ECG signal that may

    be of interest to the cardiologist.

    In a complete ECG study, it is typical to place 10 electrodes from which 12 leads can be

    obtained. Holter devices often use less electrodes, ranging from 3 to 6 typically. In this work,

    we used a standard 3-electrodes in a configuration known as Einthovens triangle, measuring thepotential between the left arm (LA) and right arm (RA) using the left leg (LL) as reference:

    Figure 2: Einthovens triangle, showing the placement of the 3 electrodes.

    2

  • 7/31/2019 Appnote Ambulatory Ecg

    6/19

    3 DESCRIPTION OF THE DEVICE

    This particular way of measuring is known as lead I, although from this configuration it is

    possible to get two other measurements, namely lead II from the right leg (RL) to RA, and lead

    III from LL to LA. The typical lead I signal we register is shown in the next figure. The other

    signals shown correspond to the same portion of the cardiac cycle, but measured using the other

    leads 11 possible leads.

    Figure 3: Different leads drastically affect the shape of the measured signal. Lead I (upper left)is the usually registered signal. (From Wikimedia Commons)

    3 Description of the device

    3.1 Block diagram

    The basic block diagram of the complete device consists in three main parts, as shown in the

    following figure:

    /

    >W ^

    t

    W

    & ^W

    d

    '>

    WD

    Z^

    h^^

    Figure 4: Block diagram of the complete device.

    3

  • 7/31/2019 Appnote Ambulatory Ecg

    7/19

    3.2 Implemented functionalities 4 HARDWARE DESCRIPTION

    The Power Management block consists of the batteries and a switching step-up regulator. Its

    function is to energize the whole system.

    The Analog Front-End takes in the signals carried by the patients electrodes. The signals are

    amplified by an instrumentation amplifier and bandpass-filtered to remove DC and band-limit it

    for digitization. As commented in section 2.2, from the 3 electrodes only 1 output signal (lead)is obtained, subtracting the RA from the LA signal, using LL signal as reference.

    The Digital/DSP block is the main part of the system, with LPC1768 being its core. The

    conditioned signal from the Analog Front-End is digitized by one of the LPCs ADC, and also

    some DSP operations are performed on the digitized signal such as notch filtering and QRS

    detection for calculating BPM. The signal is stored in an SD card, and can be optionally sent

    via an RS-232/USB wired interface to be shown in real time on a computer screen. The LPC

    microcontroller also controls the operation of the touch-GLCD and coordinates the user interface.

    3.2 Implemented functionalitiesThe basic functionalities provided by this device are:

    Recording of 1 lead at 200 Hz sampling frequency using 12-bit LPC1768 ADC.

    Graphical user-friendly menu on touch-GLCD monochrome screen with a resolution of

    128x64.

    Information storing using SD card and FAT32 filesystem.

    ECG signal shown on screen in real time, allowing to check whether the received signal is

    OK or not.

    Detection of the patients BPM.

    Selection of the study duration between 24 or 48 hours.

    Shows elapsed time from the beginning of the study.

    Possibility to send the received ECG signal through the wired interface to a computer in

    real time.

    4 Hardware description

    4.1 Power Management

    The Power Management block consists of 2 AAA batteries and a switching step-up 3V to 5V

    regulator. The 5V output is used to get 2.5V by means of a virtual ground circuit, and this

    bipolar power supply is used to energize the whole system (especially the operational amplifiers

    from the Analog Front-End block which require a bipolar power supply).

    4

  • 7/31/2019 Appnote Ambulatory Ecg

    8/19

    4.2 Analog Front-End 4 HARDWARE DESCRIPTION

    Figure 5: Power management block, consisting of a switching step-up regulator and a virtual

    ground circuit.

    4.2 Analog Front-End

    The Analog Front-End consists of an instrumentation amplifier (IA) followed by a bandpass

    filter, with adjustable DC level and gain. The reason why an IA is needed is because the signal

    coming from the electrodes is a very weak (~1mV) differential signal, usually contaminated with

    power line noise, so a high-gain amplifier with high CMMR is needed, in order to amplify this

    signal reducing common-mode noise at the same time. Also, the high impedance of the human

    body requires the IA to have a very high (~109) input impedance.

    The signal coming out of the IA has an amplification factor of 200, so its value varies around

    200mV. This signal is band-limited by the bandpass filter, removing the DC component and

    band-limiting the signal, with a gain of about -20dB at 100 Hz. The BP filter also has an

    adjustable gain (of about 10 to 15) to adapt the signal level to the ADCs input dynamic range

    (0 to 3.3V).

    Finally, DC offset is adjusted and the signal is fed into the LPCs ADC input to be digitized.

    5

  • 7/31/2019 Appnote Ambulatory Ecg

    9/19

    4.3 Digital/DSP hardware 4 HARDWARE DESCRIPTION

    R1

    10k

    R2

    2M2

    C1

    1n

    0

    LL

    0

    RA

    LA

    C3

    220n

    LM358

    +5

    -6

    V+8

    V-4

    OUT7

    LM358

    +3

    -2

    V+8

    V-4

    OUT1

    LM358

    +5

    -6

    V+8

    V-4

    OUT7

    R4

    10k

    C2

    100u

    CMAX

    R3

    10k

    0

    -

    +

    INA326

    GS11

    GS28

    -2

    +3

    OUT6

    V+

    7

    V-

    4

    REF

    5

    0

    Rgain

    50k

    -2.5V

    +2.5V

    R5

    1k

    R7

    1k

    0

    ADC

    Rdc

    10K

    DC adjustment

    Bandpass

    Gain adjustment

    Instrumentation

    Amplifier

    R6

    1k

    Lead I

    ECG

    +2.5V

    -2.5V

    -2.5V

    +2.5V

    +2.5V

    -2.5V

    +2.5V

    -2.5V

    Figure 6: Analog Front-End circuit. The signal coming from the 3 electrodes is taken as adifferential lead I signal, amplified and conditioned to be digitized. The 0V referencecorresponds to the virtual ground.

    4.3 Digital/DSP hardware

    The hardware presented in this section uses LPCXpresso1768 from Embedded Artists. This

    board comprises a target board with an LPC1768 microcontroller, combined with a JTAG

    debugger for easy debugging of the system.

    6

  • 7/31/2019 Appnote Ambulatory Ecg

    10/19

    4.3 Digital/DSP hardware 4 HARDWARE DESCRIPTION

    Figure 7: Hardware corresponding to the digital part of the system, showing LPCXpresso,GLCD, touchscreen and SD card.

    As described in section 3.1, the LPC drives 3 main blocks: the touch-GLCD, the SD card andthe wired interface.

    The ECG signal coming from the Analog Front-End is directly fed into the ADC0 pin of LPC.

    4.3.1 Touch-GLCD

    The touch-GLCD block can be divided into its 2 components, touchscreen and GLCD. The

    GLCD (KS0108 driver) is driven using 13 lines (8 data, 5 control) from port PIO2 of the LPC.

    This connection requires a buffer to adjust levels between these two, since the output voltage

    level from LPC is 3.3V and the GLCD used has 5V inputs 1. The buffer was implemented using

    simple ULN2803 inverters, because the interface is unidirectional.The touchscreen used is a 4-wire resistive touchscreen. It is connected in differential mode, so

    2 ADC (ADC2 and ADC3 from LPC) were used to read the Y and X coordinates respectively.

    While reading the Y coordinate, the two leads from the X coordinate operate in digital mode,

    causing a voltage difference across the screen that is read by ADC2. The same happens while

    reading the X coordinate.

    4.3.2 SD card

    The SD card was connected to the standard 5 SPI bus pins MISO, MOSI, SCK, SSEL and

    MOSI0 (the last one used for card detection). We used a standard SD card slot, and the

    1Nowadays, there are many GLCDs with 3.3V inputs. In that case, the buffer would simply have to be bypassed.

    7

  • 7/31/2019 Appnote Ambulatory Ecg

    11/19

    5 FIRMWARE DESCRIPTION

    connections are straightforward as shown in the schematic. Also, SD and SDHC through SPI

    port are supported.

    4.3.3 Wired interface

    The wired interface is an UART interface. It consists of 2 standard lines Tx and Rx for datatransmission (USB_D- and USB_D+ in LPCXpresso) and 2 lines for Vcc and GND connection.

    The connection is also straightforward, with no interface in between except possibly for an FTDI

    serial-to-USB converter.

    5 Firmware description

    5.1 System initialization and basic operation

    When the system is powered on, a startup logo is shown. Next, the screen switches to the main

    menu, waiting for the user to choose an option. The options available in this version are:

    1. Start a study. It will further ask for the studys duration, and then it starts recording the

    ECG signal, displaying it and the elapsed time on screen.

    2. Monitor the signal that is going to be registered.

    3. Go to the credits screen.

    Figure 8: Basic flowchart of the systems operation.

    5.2 FreeRTOS

    The core of the systems software is based on a real time operating system (RTOS) calledFreeRTOS [5, 4] ported to run on LPC17xx platform. It was configured to run in preemptive

    8

  • 7/31/2019 Appnote Ambulatory Ecg

    12/19

    5.3 GLCD library 5 FIRMWARE DESCRIPTION

    mode, allowing us to run several task in parallel. Some tasks were required to run in background

    all the time (e.g. reading the touchscreen, refreshing the screen), while other tasks are run for

    certain operations only (e.g. signal recording, plotting the signal).

    We used the LPCs real time clock (RTC) to keep track of the elapsed time during a study;

    it is not used as a real clock. An alarm event was also set up, to finish the study when theconfigured time is hit.

    The background running tasks are:

    GLCD: refreshes the screen, loading the framebuffers contents into the GLCDs RAM every

    time it is called. This is a periodic task with a period configurable in the config files.

    Touchscreen: reads the touchscreen values and converts them to X-Y coordinates. Then

    it checks if any button has been pressed or released.

    SD timers: keeps track of different timers used for the SD FatFs library as timeouts.

    These functionalities will be improved in future versions, to remove the need of this extra

    task and make the library more RTOS compatible.

    For the Monitor and Study, the tasks are:

    DAQ: acquires a new sample from the DAC every 5ms, achieving a 200 Hz sampling rate.

    Then sends this value to different queues, that are used by different tasks being run by the

    RTOS. For testing purposes, it also sends the value via UART for graphing and storing

    on PC (if required).

    DSP: runs the QRS detection algorithm every time a new sample is read. With the infor-mation of previous samples, the algorithm determines if there has been a QRS complex,

    and how many samples have passed since that event.

    Signal Plot: adapts the signal levels and interpolates samples to plot it on the GLCD

    screen.

    GUI: shows the studys elapsed time and the patients current beats per minute (BMP).

    SD Record: if a study is being run, it waits for a chunk of signal data to be gathered, and

    saves it on the SD card.

    Only the DAQ task executes periodically. The other tasks are woken up every time a new sample

    is loaded into their queues, but since this is a periodic event, they too behave like periodic tasks.

    5.3 GLCD library

    We implemented an ANSI-C library for controlling the GLCD. This library can be used with

    any KS0108 controller compatible GLCD.

    9

  • 7/31/2019 Appnote Ambulatory Ecg

    13/19

    5.3 GLCD library 5 FIRMWARE DESCRIPTION

    5.3.1 Basic operation

    Our GLCD library can handle monochrome graphic displays based on the KS0108 controller or

    similar. While this library was originally designed to be used with this controller, it can easily

    be adapted to other kinds of graphic displays. The GLCD we used is 128x64 pixels, and has

    an internal RAM memory divided into 8x128 pages of 8 bits (1 byte) each, so that each page

    represents an 8-pixels column in the screen. The display has a total of 1KByte of RAM.

    The KS0108 controller can actually handle 64x64 pixels only, so displays bigger than this size

    (as ours) are individually handled using several controllers that are independently driven using

    Chip Select control lines (CS1, CS2, etc.)

    Typically, to write one pixel, one must point to the memory address where the pixels page

    is held, read the entire pages value, change the pixel and rewrite. This operation, while very

    memory efficient, has the drawback of being extremely slow, causing an important bottleneck

    in the operation of the entire system. To overcome this issue, we designed the library using a

    framebuffer approach, as we explain next.The basic functions of library are based on the GLCD library that can be found in http:

    //www.arduino.cc/playground/Code/GLCDks0108 . We modified that library to achieve:

    Faster operation.

    Framebuffer-based mode of operation.

    ANSI C portable.

    New primitive functions for easily implementing the GUI.

    5.3.2 Framebuffer mode of operation

    The framebuffer mode of operation requires the microcontroller to have available the same

    amount of RAM memory the GLCD uses for video displaying. This amount of RAM used for

    video is called a framebuffer. All the video writing operations are performed on the microcon-

    trollers framebuffer, which is orders of magnitude faster than reading and then writing on the

    GLCDs memory. Periodically, a routine is called to refresh the screen, overwriting the GLCD

    video RAM with the information stored in the framebuffer.

    Despite needing a high amount of RAM for the framebuffer, this approach has many advan-

    tages:

    Several routines can access and modify the video memory at the same time, without using

    mutexes or other techniques required to overcome concurrent access problems.

    Only one routine has access to the hardware, which is executed periodically. This dimin-

    ishes the probability of having the system blocked due to hardware access problems, and

    makes the code more easily maintainable.

    No reading from the GLCD memory is required (the operations are write only), which

    speeds up the whole operation.

    The resulting code is more portable.

    10

    http://www.arduino.cc/playground/Code/GLCDks0108http://www.arduino.cc/playground/Code/GLCDks0108http://www.arduino.cc/playground/Code/GLCDks0108http://www.arduino.cc/playground/Code/GLCDks0108http://www.arduino.cc/playground/Code/GLCDks0108
  • 7/31/2019 Appnote Ambulatory Ecg

    14/19

    5.3 GLCD library 5 FIRMWARE DESCRIPTION

    5.3.3 Organization of the library

    To make the code more portable, the library was organized in the following way:

    Figure 9: Organization of the library, showing the name of the implemented functions for each

    abstraction layer (see description in text).

    The HAL (Hardware Abstraction Layer) is the linking layer between the GLCD and the

    library. This layer depends on the controller used by the GLCD and must be adapted to the

    device in use. It implements the basic write operations, at the hardware level.

    The Low Level layer initializes the GLCD with the basic routines, and performs the swapBuffer

    function (overwriting GLCDs RAM with the contents of the framebuffer).

    The Upper layer consists in three sections as described below:

    Primitives

    GLCD_SetDot: draws a dot in a selected coordinate.

    GLCD_DrawLine: draws a line between two selected coordinates.

    GLCD_DrawRect: draws a rectangle of selected width and height, starting upper left in

    selected coordinate.

    GLCD_DrawRoundRect: same as GLCD_DrawRect but with rounded corners.

    GLCD_FillRect: same as GLCD_DrawRect but filled.

    GLCD_DrawCircle: draws a circle with selected radius, starting upper left in selected

    coordinate.

    11

  • 7/31/2019 Appnote Ambulatory Ecg

    15/19

    5.4 QRS detection 5 FIRMWARE DESCRIPTION

    Text

    GLCD_SelectFont: selects a font to be used with the following functions.

    GLCD_PutChar: draws a character using selected font.

    GLCD_PutS: draws a string using selected font.

    GLCD_CharWidth: returns the width of a certain character to be drawn on screen.

    GLCD_StringWidth: returns the width of a certain string to be drawn on screen.

    GLCD_CursorTo: moves the writing cursor to a selected coordinate. Coordinates are mea-

    sured in the selected font dimensions.

    GLCD_CursorFreeTo: moves the writing cursor to any selected coordinate.

    Images

    GLCD_DrawBitmap: draws a complete bitmap stored in memory.

    5.3.4 Graphical User Interface (GUI)

    The GUI was developed as a separate library. Its purpose is to simplify the way the user interface

    is drawn and managed by the microcontroller. Basically, the GUI draws and keeps track of all

    the buttons that are being shown on the menu, so that they can be easily recognized when

    pressed using the touchscreen. Also, it associates each button with a handler, that triggers

    upon pressing the button.

    Next, we give a description of the primitives implemented:

    GUI_init: initializes the list of buttons shown in the screen.

    GUI_createButton: creates a new button with a selected text label inside, and associates

    a selected handler with the button.

    GUI_deleteButton: deletes a button.

    GUI_deleteAllButtons : deletes all buttons in screen.

    GUI_paintButton: paints a given button. Used when the button is being pressed.

    GUI_CheckButtonClick : checks if a button has been pressed.

    GUI_ButtonEvent: calls the handler of the pressed button.

    5.4 QRS detection

    The QRS detector we used is based on the algorithm described in [1]. The one we used is Free

    Software, and can be downloaded from [2]. Only minor modifications were made to the original

    source code to adapt it to our system; the basic routines were left without modifications.

    The performance of the algorithm is excellent. It was tested onith the MIT/BIH arrhythmia

    database [3] achieving a 99.70% positive detection rate. The details about the performance and

    how the algorithm works can be found in the links listed in the references.

    12

  • 7/31/2019 Appnote Ambulatory Ecg

    16/19

    5.5 SD recording 6 SCREENSHOTS AND ADDITIONAL RESOURCES

    5.5 SD recording

    We used the FatFs Generic FAT File System Module layer, which can be downloaded from http:

    //elm-chan.org/fsw_e.html and is Free Software. FatFs is a generic FAT file system module

    for small embedded systems, written in compliance with ANSI-C and completely separated from

    the disk I/O layer. Therefore, it is independent of hardware architecture.

    Detailed information about this library can be found in the link given above.

    5.6 Firmware organization

    The firmware provided along with this report was written using the LPCXpresso Code Red IDE.

    The firmware is divided into several different projects, one for each library and one for the actual

    firmware. These are:

    ECG: this project is really the main software. It uses the other libraries for different func-

    tions.

    FreeRTOS_Library: FreeRTOS ported to run on LPC17xx.

    Lib_CMSIS: complete CMSIS from NXP ported to Code Red IDE. It includes hardware

    drivers.

    Lib_GLCD_GUI: Graphical User Interface library.

    Lib_KS0108_FB: GLCD framebuffer driver.

    LibFatFs_SD_LPC1768: Chans FatFs library ported for this microcontroller.

    The ECG contains several folders for a better organization. These are:

    Config: contains the configuration files for the whole system.

    Filters: different FIR filters used in DSP processes.

    Functions: several handy functions for some peripherals and other functions. Some pe-

    ripheral drivers should be implemented as gatekeeper tasks in future versions.

    Tasks: tasks that are used by the RTOS to run the system.

    Resources: graphical resources as fonts, icons and images.

    6 Screenshots and additional resources

    6.1 Additional software

    For testing and demonstration purposes, we implemented two different applications to be run

    in a PC.

    The first one is a very short and simple Octave [7] compatible code - called script - that reads

    the data from the SD card and plots it in an ECG style chart.

    The second one is a real time live viewer that reads data from the serial port and plots it

    mimicking a real ECG monitor (screenshots shown below). For simplicity, it was written in

    Processing language [8].

    13

    http://elm-chan.org/fsw_e.htmlhttp://elm-chan.org/fsw_e.htmlhttp://elm-chan.org/fsw_e.htmlhttp://elm-chan.org/fsw_e.html
  • 7/31/2019 Appnote Ambulatory Ecg

    17/19

    6.2 Screenshots 6 SCREENSHOTS AND ADDITIONAL RESOURCES

    6.2 Screenshots

    The following pictures are photographs that were taken while the system was being tested.

    Figure 10: Taken while the system was starting. Startup logo (top) and Main Menu (down).

    Figure 11: Taken while the system was in use. Menu for selecting studys duration (top) andtest signal shown in real time (down).

    The following picture shows a screenshot of the program written in Processing, showing a real

    ECG signal being registered by the Holter.

    14

  • 7/31/2019 Appnote Ambulatory Ecg

    18/19

    References

    Figure 12: Processing application screenshot, showing a real ECG signal being registered.

    7 Conclusions

    A complete ECG portable monitor system based on the recently released platform LPC1768

    by NXP was developed. We commented on the key aspects of our design, mainly on those

    concerning to software, and we also gave a brief description of the hardware we used.

    Many open source and free software resources were used, which in combination with LPCX-

    presso1768 shortened the development and debug time of the entire system to only a few months,

    starting our design from the very beginning and ending up with a complete system.

    Also, the use of the real time operating system FreeRTOS was a fundamental advantage due to

    the concurrent tasks this device must perform. The result was an easily maintainable, scalable

    and readable code which can be used as a basis to further develop the basic ideas presented

    here.

    References

    [1] Hamilton PS, Tompkins WJ. Quantitative investigation of QRS detection rules using the

    MIT/BIH arrhythmia database. IEEE Trans. Biomed. Eng., BME-33(12):1157-1165, 1986.

    [2] E.P. Limiteds Open Source ECG Analysis Software. http://www.eplimited.com/

    [3] MIT/BIH arrhythmia database. http://www.physionet.org/physiobank/database/

    mitdb/

    [4] Barry R. Using the FreeRTOS Real Time Kernel. NXP LPC17xx Edition.

    [5] Free RTOS official web. http://www.freertos.org/

    [6] Proakis J, Manolakis D. Digital signal processing. Prentice Hall, 4th Ed.

    [7] Octave, a high-level programming language. http://www.gnu.org/software/octave/

    15

    http://www.eplimited.com/http://www.physionet.org/physiobank/database/mitdb/http://www.physionet.org/physiobank/database/mitdb/http://www.freertos.org/http://www.gnu.org/software/octave/http://www.gnu.org/software/octave/http://www.freertos.org/http://www.physionet.org/physiobank/database/mitdb/http://www.physionet.org/physiobank/database/mitdb/http://www.eplimited.com/
  • 7/31/2019 Appnote Ambulatory Ecg

    19/19

    References References

    [8] Processing, an open source programming language. http://processing.org/

    16

    http://processing.org/http://processing.org/