Design of ECG monitor based on Linux and MCU

Publisher:lqs1975Latest update time:2023-01-12 Source: elecfansKeywords:Linux Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  As people's pace of life accelerates and the population gradually ages, heart disease has become one of the major diseases that endanger human health and life. The ECG monitoring system provides an effective means for the diagnosis and treatment of heart disease patients, and is of great significance to the prevention, treatment and diagnosis of heart diseases. This article introduces an ECG monitoring system based on Linux and MiniGUI, which can satisfy patients anytime and anywhere. Electricity can be monitored conveniently and quickly, abnormal situations can be discovered in a timely manner and effective measures can be taken to better protect people's health.


  1 Hardware system design

  This system uses S3C2440 processor as the control center. S3C2440 is a 16/32-bit RISC embedded processor based on the ARM920T core. The maximum frequency can reach 532MHz. It provides 64MSDRAM, 64M Nand Flash and 2M Nor Flash storage devices, independent 16kB Instruction cache and 16kB data cache, LCD controller, 3-channel asynchronous serial port, SPI synchronous serial port, 117-bit general-purpose I/O port, 1 internal clock, 8-channel 10-bit ADC, touch screen interface, Ethernet controller, PCMCIA interface, USB interface, etc., have the characteristics of high performance, low power consumption, and high cost performance. They are mainly used for video conferencing, network monitoring, GPS positioning/navigation, etc., especially medical electronic equipment. The overall hardware structure of the system is shown in Figure 1, which can realize functions such as ECG signal collection, processing, display, and storage.

  Figure 1 Overall hardware structure of the system

  Figure 1 Overall hardware structure of the system

  2 Software system design

  2.1 Building embedded Linux

  The development of the ECG interface is based on the MiniGUI embedded Linux system. Among various embedded operating systems, Linux is characterized by its clear structure

  It is clear, open source code, powerful, easy to transplant and is widely used. The kernel of this system adopts 2. 6 version of the kernel, Linux 2. 6 kernel has been greatly improved in terms of performance, module support, usability, scalability, etc. A complete embedded Linux system mainly includes three aspects: BootLoader (boot program), kernel and root file system. In this system, the bootloader uses ViVi and the file system uses Yaffs. According to the actual needs of the target platform, the boot program, kernel and file system are cut and configured. Finally, the compiled ViVi and the generated image files of the Linux kernel and file system are burned into the platform and run. The embedded Linux is built. .


  2.2 Graphical user interface MiniGUI

  MiniGUI is a lightweight graphical user interface support system based on Linux. It was developed under the leadership of Wei Yongming, a former Tsinghua University teacher, and follows the GPL convention. The supported operating systems are not limited to Linux, it can also run on systems such as uClinux, uC/OS-Ⅱ, eCos and Vx-Works. Verified hardware platforms include Intelx86, ARM (ARM/AMR9/StrongARM/xScale), Power-PC, MIPS, M68K (DragonBall/ColdFire), etc. To transplant MiniGUI, first download the source code of MiniGUI libminigui-1. 6. 10. tar. gz (MiniGUI function library source code) and minigui-minigui-res-1. 6. 10. tar. gz (resources used by MiniGUI, including basic fonts, icons, bitmaps and mouse cursors), then compile and install and copy MiniGUI resources to the target platform, and finally modify /etc/MiniGUI of the target platform. cfg file to configure the running environment of the target platform MiniGUI.


  2.3 ECG collection interface design

  2.3. 1 Main interface

  There are three window types in MiniGUI: main window, dialog box and control window. The ECG acquisition interface is designed using dialog boxes. Dialog programming is a technology for quickly building user interfaces. MiniGUI provides a template-based mechanism. , represented by two structures, DLGTEMPLATE and CTRLDATA. DLGTEMPLATE is used to define the dialog box itself, and the structure CTRLDATA is used to define the control. Using these two structure templates, users can define their own dialog boxes and controls in the program as needed. The dialog box of the main interface is defined as follows:

  staTIc DLGTEMPLATE DlgInitProgress =

  {

  WS_BORDER WS_CAPTION,

  WS_EX_NONE,

  0,0

  , 240, 320,

  "Welcome to use the ECG signal acquisition system",

  0,0

  ,

  10, NULL,

  0

  } ;

  Use CTRLDATA to define all controls in the dialog box and use arrays to represent them. Dialog boxes often use controls to implement functions such as prompts or settings. The control array model is defined as follows:

  staTIc CTRLDATA CtrlInitProgess[]=

  {

  {CTRL_STATIC,

  WS_CHILD|WS_VISIBLE| SS_NOTIF

  |WS_BORDER,

  0,0

  , 240, 30

  IDC_STATIC1,

  "Welcome to use the ECG signal collection system",

  0

  } ;

  {

  …

  } ;

  …

  } ;

  The main interface of the ECG monitor generated by the above method is shown in Figure 2. The ECG collection interface mainly has functions such as ECG data collection and display, storage, and analysis. It uses multi-thread programming to establish a dedicated thread for collection, display, storage, and analysis. Multi-threading of data collection can effectively speed up the response speed of the program and increase the efficiency of execution.


  In MiniGUI, message driver is used as the application creation framework. In message-driven applications, events occurring in computer peripherals are collected by the support system and translated into specific messages in a pre-agreed format. Applications generally include their own message queues, and the system sends messages to the application's message queue. These messages are read from the message queue and processed by the window procedure function. The interface of this system translates the mouse button into a specific message. If a control message is received, the ID is determined and the corresponding message is processed according to the application program.


  2.3.2 ECG collection and display

  ECG data collection uses a timer for collection and display. The timer is created using the SetTimer function. When creating, you need to specify the timer identification number and timing time. When the timing time arrives, the timer will generate a MSG _ TIMER message. This system The ECG collection frequency is 200Hz.


  Read the three-channel data from the A/D register and store it in the array, and draw the data in the array on the LCD. Real-time drawing in MiniGUI uses GDI. An important part of the GUI system is GDI, that is, Graphics Device Interface. Through GDI, GUI programs can perform graphical output, including basic drawing and text output, on the computer screen or other display devices. All drawing-related functions require a device context. In order to improve drawing efficiency, a private device context is established here. The established device context is valid throughout the window lifetime, thus eliminating the acquisition and release process. Use hdc =GetPrivateClientDC(hDlg) to obtain the private device context. Then call MoveTo (HDC hdc, int x, int y) and LineTo (HDC hdc, int x, int y) to draw lines on the data in the array. Since the collected ECG data is small, it is drawn after All data are appropriately amplified according to the display area before the line is drawn, so that the ECG waveform can be displayed intuitively on the LCD monitor.


  2.3.3 ECG data analysis

  In the ECG data display and analysis thread, since the ECG signal is easily affected by various interferences, in order to filter out the interference components in the ECG signal, digital filtering must be performed first, using FFT filtering and sliding average filtering methods to make the image It is smoothed and the differential method is used for R-wave detection. When 5 seconds of data are collected, the program starts the ECG data analysis thread to analyze the ECG data stored in the array, mainly detecting R waves and displaying them on the LCD.


  2.3.4 Compilation of ECG interface program

  The ECG interface program is first written on the PC. In order to run on the target platform, it must be cross-compiled and compiled.

  as follows:

  #arm-linux-gcc -I /home /include -L/home /lib-O2 -oxindian xindian. c -lminigui -lmgext -lm -ljpeg-lpthread-lpng

  At this time, the executable file of the ECG interface program is generated and downloaded to the target platform to run.


  3 Conclusion

  The ECG monitor developed in this article uses a high-performance ARM9 microprocessor as the core, transplants the Linux operating system on it, and uses MiniGUI for ECG interface development. It can collect, waveform display and process ECG signals to realize ECG The purpose of real-time monitoring of signals. This ECG monitor combines the advantages of existing ECG monitors. It is small in size and light in weight. It also has the advantages of simple operation interface and strong scalability. It has a high effect on various arrhythmias and various heart diseases. diagnostic value.


Keywords:Linux Reference address:Design of ECG monitor based on Linux and MCU

Previous article:Design of video surveillance system based on 3G mobile phones
Next article:Embedded system VGA interface design based on ADV7125

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号