Design of ECG Detection System Based on SPCE061

Publisher:梦回归处Latest update time:2016-10-17 Source: ofweekKeywords:SPCE061 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  Abstract: In view of the increasing concern of people about heart diseases, a new type of ECG detection system is introduced. It has the characteristics of small size, strong practicality and low price, and is particularly suitable for home use. At the same time, in order to solve the interface problem with the PC, according to the USB1.1 specification, the PDIUSBD12 interface chip of PHILIPS Company is used, which greatly improves the speed of data transmission. After experimental testing, the system runs stably and reliably.

  With the progress of society and the development of science and technology, people's health concepts, health methods and approaches have undergone profound changes. China is a high-incidence area for cardiovascular and cerebrovascular diseases. However, most hospitals have few ECG monitoring devices, which are not easy to move and are costly, and cannot meet the market demand. In order to meet the demand for ECG monitoring equipment and reduce medical costs, an ECG detection system combined with a PC is needed. The bus interface connecting the computer to the peripherals has many forms, among which the PCI and ISA buses are troublesome to plug and unplug, and the expansion slots are limited; the RS232 serial bus has a slow transmission speed and a small number of serial ports with the host. In recent years, the USB bus interface has emerged. It has significant advantages such as hot plugging, plug and play, convenient system expansion and configuration, and efficient data transmission. It overcomes the defects of the traditional bus interface. The ECG monitoring system designed in this article also adopts this method.

  1 Hardware Circuit Design

  1.1 Overall hardware structure

  The overall hardware structure of the ECG detection system designed in this paper is shown in Figure 1, which includes lead circuit, filter amplifier circuit, microcontroller, Flash memory, power conversion circuit and USB interface circuit. The ECG signal is collected from the human body through electrodes, enters the A/D of the microcontroller after the lead circuit and filter amplifier circuit, and then is processed by the microcontroller and stored in the Flash, thus completing the acquisition of the ECG signal. The system can communicate with the PC through the USB interface circuit, and transfer the ECG data stored in the Flash to the PC in file format, thereby realizing the unlimited storage function of the data. At the same time, the ECG waveform can be displayed on the screen through VC software programming. The power conversion circuit is powered by a 9V battery, which is compact and easy to carry.

Design of ECG Detection System Based on USB Bus

  1.2 USB interface circuit

  This article uses Philips' PDI-USBD12. PDI-USBD12 is a cost-effective USB device that fully complies with the USB1.1 specification. It is usually used as a high-speed universal parallel interface in microcontroller systems to communicate with microcontrollers and supports local DMA transfers. In addition, PDIUSBD12 integrates many features, including SoftConnetTM, GoodLinkTM, programmable clock output, low-frequency crystal oscillator, and termination register set. All of these features save a lot of cost for the system and make it easy to apply USB functions to peripherals.

  Figure 2 is the USB interface circuit. The USB interface uses a 4-wire cable. The two wires D+ and D- are used to send signals, and the two wires VDD and GND provide power to the device. The XTAL1 and XTAL2 pins of PDIUSBD12 are connected to an external 6M crystal oscillator. The data line and control line are respectively connected to the I/O port of the microcontroller. The commands and data are sent through SPCE061 to control the USB interface chip PDIUSBD12, realizing fast and efficient data transmission.

Design of ECG Detection System Based on USB Bus

  1.3 Single-Chip Microcomputer System

  This article uses the 16-bit SPCE061 microcontroller launched by Lingyang Company, which has a wide power supply voltage range (2.4~3.6V), a maximum CPU speed of 49.125MHz, 8-channel 10-bit ADC (the maximum A/D conversion speed is 96kbps), 2k RAM, 32k Flash, 32 I/O interfaces, etc. The Flash uses Lingyang Company's 512k*8-bit SPR4096, with an operating voltage of 2.25~2.75V, which has good mutual transmission capability with SPCE061.
 

  1.4 Amplification and filtering circuit

  The amplifier and filter circuit is shown in Figure 3. The preamplifier uses the AD620 from ANALOG DEVICES, which is a very cost-effective instrument amplifier with a maximum input offset voltage of 50uV, an input offset drift of 0.6uV per degree, a common film rejection ratio of 120dB (G=10), and a maximum supply current of only 1.3mA. The amplifier uses the low-power and low-noise TLC2254, with a supply current of 35uA per channel and a noise of 19nV/Hz (1kHz), which is very suitable for portable devices. Since most ECG signals are between 0.5 and 150Hz, filtering is required. A 0.48-159Hz bandpass filter is added to the TLC2254. For the power frequency 50Hz interference, in order to reduce hardware design and consider the problem of reducing power consumption, software filtering will be used. After Chebyshev secondary filtering and smoothing filtering, the effect is relatively ideal. Since the ECG signal has negative values, and the A/D range of the Lingyang microcontroller is 0-3.3V, the signal must be boosted. Here, the LM385 -1.2V precision reference voltage source is used and added to the signal, so that the values ​​of all signal points are positive.

Design of ECG Detection System Based on USB Bus

  2 System Software Design

  The software design of the ECG detection system includes data acquisition and storage program design and USB data transmission program design.

  2.1 Collection and storage program design

  The acquisition and storage program design is shown in Figure 4. First, initialize the microcontroller and Flash chip, set the system clock, sampling frequency, pin definition, etc. Then filter each sampling data. Since a bandpass filter has been designed in the previous hardware design, the main consideration here is to remove the 50Hz power frequency and burrs. The use of Chebyshev I type 2 filtering can effectively remove the 50Hz power frequency and smooth the filtering, and can remove burrs. The formula is as follows:

Design of ECG Detection System Based on USB BusDesign of ECG Detection System Based on USB Bus

Design of ECG Detection System Based on USB Bus

  Considering that the coefficients generated by the Chebyshev filter are decimals, they are converted into integers for the convenience of calculation. Each coefficient is multiplied by 4096, and the integer part is taken. The calculated result is then right-shifted 12 bits to obtain the final result.

  Figure 5 is a comparison chart of ECG signals before and after processing, and it can be seen that the effect is quite obvious.

Design of ECG Detection System Based on USB BusDesign of ECG Detection System Based on USB Bus

  2.2 USB data transmission program design

  The purpose of USB data transmission program design is to make PDIUS-BD12 reach the maximum transmission speed on USB. PDIUSBD12 program design adopts interrupt drive. When CPU processes foreground tasks, USB transmission can be carried out in the background, which ensures the best transmission rate and better software structure. The data exchange between the background interrupt service program and the foreground main program loop is realized through event flags and data buffers. The host must first send a token packet to PDIUSBD12. After receiving the token packet, PDIUSBD12 sends an interrupt to the microcontroller. The microcontroller enters the interrupt service program, first reads the interrupt register of PDIUSBD12, determines the type of USB token packet, and then performs the corresponding operation.

  In the communication between SPCE061 microcontroller and PDIUSBD12, PDI-USBD12 is responsible for handling all tasks related to USB bus transactions, such as bus wake-up, data reception/transmission, packaging, CRC check, etc., but is not responsible for interpreting the meaning of these data; SPCE061 is responsible for processing data, responding to host requests, and controlling the work of PDIUSBD12. This is mainly achieved by the microcontroller sending commands and data to PDIUSBD12. The central processing unit (CPU) of SPCE061 controls the activities of PDIUSBD12 by executing the instruction set stored in the chip firmware. The CPU supports an instruction set including machine language instructions for moving data, performing mathematical and logical operations, program branching, etc. The command words of PDIUSBD12 are divided into three types: initialization command words, data flow command words, and general command words. PDIUSBD12 gives the codes and addresses of various commands. The microcontroller first sends commands to the command address of PDIUSBD12, and then sends or reads different data according to the requirements of different commands. Therefore, each command can be made into a function, and each command can be implemented by a function, and the function can be directly called later.

  Figure 6 is a hierarchical block diagram of the program design, in which D12CI.C, CHAP9.C and ISR.C can be used to transplant the firmware interface, and EPPHAL.C and MAINLOOP.C need to be designed by yourself. In MAINLOOP.C, it is necessary to design sending USB requests, reading test keys, controlling LEDs and handling USB bus events. In EPPHAL.C, it is necessary to design the control and data transmission of each I/O port to the 12 pins of PDIUSBD.

Design of ECG Detection System Based on USB Bus

  3 Conclusion

  The software and hardware design and development of the ECG detection system based on the USB bus fully reflects the convenience, low cost, and high anti-interference characteristics of USB. After testing, it works stably and reliably, and the ECG waveform is clear. It is an ideal ECG detection system. Due to the complexity of ECG interference and the limitations of software and hardware design, the noise reduction problem of ECG signals needs to be further improved.

Keywords:SPCE061 Reference address:Design of ECG Detection System Based on SPCE061

Previous article:Application of microcontroller in single chip microcomputer speech experiment
Next article:Using STM8's TIM1 to implement a running light experiment (using an external clock)

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号