Design of ECG Data Acquisition Instrument Based on STM32

Publisher:EnchantedBreezeLatest update time:2014-12-05 Source: dzscKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Nowadays, cardiovascular diseases have become one of the major diseases that threaten human health, and a clear and effective electrocardiogram provides a basis for diagnosing such diseases. The electrocardiogram acquisition circuit is the key part of the electrocardiogram acquisition instrument. The electrocardiogram signal is a weak signal with a frequency range of 0.03~100 Hz and an amplitude of 0~5 mV. At the same time, the electrocardiogram signal is also mixed with a large number of interference signals. Therefore, designing a good filter circuit and selecting a suitable controller are the key to obtaining an effective electrocardiogram signal. Based on this, this paper designs an electrocardiogram acquisition instrument with STM32 as the control core and AD620 and OP07 as the analog front end. This design is simple and practical, and noise interference is effectively suppressed.

  1 Overall design plan

  ECG acquisition includes two parts: analog acquisition and digital processing. This design collects human ECG signals through AgCl electrodes and three-lead ECG acquisition lines. After passing through the preamplifier circuit, bandpass filter circuit, 50 Hz double-T notch, the amplitude of the ECG signal is controlled within the A/D acquisition range of STM32 through the main amplifier circuit and level raising circuit. STM32 sets the A/D sampling frequency through the timer, processes the obtained digital signal through mean filtering, and finally depicts the ECG graph on the color screen. The overall block diagram of the system is shown in Figure 1.

  Figure 1 System overall block diagram

  2 Hardware Design

  2.1 Main control module circuit design

  The STM32F103VET microcontroller of the main control module is the core of the controller. This microcontroller is a 32-bit high-performance, low-cost and low-power enhanced microcontroller produced by STMicroelectronics. Its core adopts the latest Cortex-M3 architecture produced by ARM, with a maximum operating frequency of 72 MHz, 512 kB of program storage space, 64 kB of RAM, 8 timers/counters, two watchdogs and a real-time clock RTC. The on-chip integrated communication interface has two I2Cs, 3 SPIs, 5 USARTs, one USB, one CAN, and one SDIO, and is integrated with 3 ADCs and one DAc, with 100 I/O ports. The pin arrangement diagram of the main control microcontroller is shown in Figure 2.

  Figure 2 STM32F103VET MCU pin arrangement diagram

  2.2 Design of preamplifier circuit

  The preamplifier circuit is the front end of analog signal acquisition and the key to the entire circuit design. It not only requires accurate acquisition of weak ECG signals from the human body, but also minimizes interference signals. Since ECG signals are differential signals, the circuit should adopt a differential amplifier structure, and the system is required to have high common-mode rejection ratio, high input impedance, low drift and other characteristics. Therefore, it is crucial to choose a suitable operational amplifier. Here, the instrumentation operational amplifier AD620 is selected to achieve preamplification. AD620 has the characteristics of high precision, low noise, low input bias current and low power consumption, making it suitable for medical applications such as ECG monitors. The amplification factor of AD620 is determined by the feedback resistor between pins 1 and 8. The gain G=49.4 kΩRG+1. Since the ECG signal contains a large DC component, the amplification factor of the preamplifier circuit cannot be too large. Here, the amplification is about 10 times, so the feedback resistor R6 is about 5 kΩ. In order to improve the common-mode rejection capability of the circuit, an OP07 is used here to detect the common-mode signal on R10 and R4 to drive the wire shielding layer and eliminate the distributed capacitance. At the same time, another OP07 op amp and R5, C3, and R7 are used to form a right leg drive circuit. The common-mode signal detected on R10 and R4 is fed back to the right leg of the person through the inverting amplifier and R7, further suppressing the common-mode signal and 50 Hz power frequency interference. Here, the right leg drive has a feedback path to the alternating current. The interference of the alternating current may cause harm to the human body. Therefore, it is necessary to take good insulation measures here, and the protective resistor R7 should be as large as possible, taking more than 1 MΩ. In addition, the instability of the system power supply also has a great influence on the collection of ECG signals. Therefore, in this system, the power pins of all op amps are connected in parallel with two 0.1μF and 10μF capacitors for decoupling to improve the stability of the system. The circuit diagram of the preamplifier circuit is shown in Figure 3.

  Figure 3 Preamplifier circuit

  2.3 Bandpass filter design

  The ECG signal output from the preamplifier circuit also contains large DC components and electromyographic signals, baseline drift and other interference components. The useful ECG signal to be collected is between 0.03 and 100 Hz. Therefore, a reasonable filter needs to be designed to allow the signal within this range to pass fully, while the signal outside this range is attenuated to the maximum extent. Here, two OP07 op amps with high precision, low offset and low power consumption are used to form a second-order active high-pass filter and low-pass filter respectively. The high-pass filter is composed of C11, C17, R7, and R10, with a cut-off frequency of f1≈0.03 Hz. The low-pass filter is composed of R8, R9, C10, and C13, with a cut-off frequency of about f2≈100 Hz. The circuit of the system bandpass filter is shown in Figure 4. [page]

  Figure 4 Bandpass filter

  2.4 50 Hz Double-T Notch Filter Design

  Power frequency is the main and most common interference source in ECG signals. Although the front right leg drive circuit has a certain inhibitory effect on it, a large part of it still enters the back circuit. Therefore, it is necessary to design a band-stop circuit with a cutoff frequency of 50 Hz to further filter out the interference. The band-stop circuit is also called a notch filter. As the name suggests, the band-stop circuit greatly attenuates the signal within a certain frequency range, while having almost no effect on the signal outside the frequency range. The double-T notch circuit is a typical band-stop circuit. In the double-T network, the parameters of the two T-type networks are symmetrical. In the 50 Hz double-T notch circuit shown in Figure 5, R13=R14=2R16=R=32 kΩ, C20=2C19=2C18=C=200 nF, which is essentially composed of two T-type high-pass filters and low-pass filters in parallel. The cutoff frequency of the circuit shown in Figure 5 is f0=1/2πRC≈50 Hz.

  Figure 5 50Hz band-stop filter

  2.5 Main amplifier and level-raising circuit design

  The amplitude of the ECG signal is about 0~4 mV, and the input level requirement of the STM32 AD converter is 3.3 V. Therefore, in order for the microcontroller to process the collected ECG signal, the collected analog signal needs to be amplified 800~1 000 times. The preamplifier circuit has been amplified 10 times, and theoretically the main amplifier circuit can be amplified about 100 times. To ensure that the signal is not distorted, the single-stage amplification is generally not more than 10 times. Therefore, a two-stage amplification method can be adopted to achieve the effect of amplification 100 times. U9 is fixed to amplify 10 times, and the feedback resistor of U11 uses an adjustable resistor, so that the effect of amplification 100 can be achieved by adjusting the variable resistor. In addition, because the A/D acquisition of the STM32 microcontroller cannot collect negative levels, a level-lifting circuit as shown in U7 is designed here to raise the ECG signal to above the 0 level, which is convenient for the microcontroller to collect.

  Figure 6 Main amplifier and level boost circuit

  3 Software Design

  After obtaining the ECG signal, it needs to be input into STM32 for AD acquisition and software filtering, and finally sent to LCD for waveform display. After the microcontroller is initialized, the program design timer interrupts once every 6 ms. In the interrupt function, the read A/D value is filtered out in the form of mean filtering to remove interference, and then converted into the coordinate value corresponding to the color screen, and lines are drawn on the color screen to realize real-time display of the waveform. The program flow of the whole system is shown in Figure 7.

  Figure 7 System software flow chart

  4. Test Results Analysis

  The ECG signals are collected from the left arm, right arm and right leg of a person through electrodes and three-lead wires. After being processed by the front-end analog circuit and STM32, the ECG signals finally obtained on the oscilloscope and color screen are shown in Figure 8.

  Figure 8 System effect display diagram

  Judging from the electrocardiogram obtained on the color screen and oscilloscope, the 50 Hz power frequency signal and baseline drift are well suppressed. It can be seen from the oscilloscope that the time between two adjacent peaks is about 900 ms, which is basically consistent with the real electrocardiogram signal. The image is clear and stable, and can better reflect the electrocardiogram characteristics of the human body.

  5 Conclusion

  This design implements a small ECG collector with STM32 as the control core and AD620 and OP07 as the analog signal acquisition end. The ECG waveform measured by this design is basically normal, noise interference is effectively suppressed, and the circuit performance is stable, which basically meets the requirements of home monitoring and pathological analysis. The whole system is simple in design, low in cost, and has certain medical value.

Keywords:STM32 Reference address:Design of ECG Data Acquisition Instrument Based on STM32

Previous article:Dual-core intelligent electro-hydraulic servo controller using DSP and STM32
Next article:Design of wireless communication module based on STM32 and SIM900A

Recommended ReadingLatest update time:2024-11-16 15:52

STM32 controls the output count of 4-bit common anode digital tube
A total of 12 pins of GPIO port PA0~PA11 are used First, the schematic diagram Because it is a common anode, 12, 9, 8, and 6 are power inputs, and the other pins are grounded. So for the chip, 12, 9, 8, and 6 are high outputs, and the others can be set to low. //Set the GPIO port   void GPIO_Num_Init(void)   {
[Microcontroller]
STM32 controls the output count of 4-bit common anode digital tube
[STM32 Cotex-M3 processor series programming] time base timer
#include "stm32f10x.h"   void Delay(unsigned int x); unsigned int TimingDelay; int main(void) {     SystemInit(); //Configure system clock    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); //Enable APB2 peripheral clock    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_AP
[Microcontroller]
How to see the program occupying STM32 flash and SRAM from the Keil compilation result
Program Size: Code=114956 RO-data=20528 RW-data=808 ZI-data=702360   FromELF: creating hex file... "..\OBJ\MALLOC.axf" - 0 Error(s), 0 Warning(s). Build Time Elapsed:  00:00:05 From the compilation information above, we can see that the FLASH size occupied by our code is: 135484 bytes (114956 +20528), and the SRAM s
[Microcontroller]
USB design based on STM32
First, let's take a look at the working process of USB. When a USB device is connected to the host, the host begins to enumerate the USB device and sends a command to the USB device to obtain the relevant description information of the USB device, including device description (device descriptor), configuration
[Microcontroller]
Understanding of NVIC (Nested Vector Interrupt Control) in STM32
        NVIC, Chinese name Nested Interrupt Vector Controller, is a unique integrated unit inside the Cortex-M3 series controller, which is closely integrated with the CPU, reduces interrupt latency and can handle subsequent interrupts more efficiently. For example, when buying tickets at a train station, the rules and
[Microcontroller]
STM32 - DMA acquisition method for multi-channel ADC
Preface: Recently, I am debugging the STM32F205 chip ADC multi-channel DMA method to collect data. Here I summarize the usage of the STM32 multi-channel ADC DMA method for data collection. Hardware platform: STM32F205 Software platform: keil v5 Function library: standard library Configuration of multi-channel
[Microcontroller]
Errors in stm32 and how to solve them
1. error: #256: invalid redeclaration of type name "s32" (declared at line 470 of "C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h") Solution: Open the stm32f10x_conf.h file, comment out "#include "stm32f10x_type.h"" on line 21, save the stm32f10x_conf.h file, and recompile. 2. warning: #47-D: incompatible redefini
[Microcontroller]
【STM32】FSMC Application
【Time calculation】   From the formula: DATAST × HCLK = tWRLW, DATAST = 15/13.8 ns = 1.08, take 1.    Then, from the formula ((ADDSET + 1) + (DATAST + 1)) × HCLK = max(tCYC, tCYC(READ)), that is, ((ADDSET + 1) + (DATAST + 1)) × HCLK = 66, we can calculate ADDSET = 66/13.8 - 3 = 1.7, which is 2.     Finally
[Microcontroller]
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号