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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- IIC Chinese version (free).pdf
- Does anyone have a heating circuit and a 37-degree constant temperature circuit for smart toilets or hand warmers? Share it (or exchange one for another)...
- A brief discussion on the synthesizability of VHDLVerilog and some suggestions for beginners
- 28335 Program automatic upgrade solution
- [Xianji HPM6750 Review] Testing the Ethernet Controller ENET
- Designing a compact, efficient and high-performance multi-parameter patient monitor
- USB Type-C Connector Introduction
- Fly-Buck Converter PCB Layout Tips
- Problem with connecting the resistor between BE when the transistor is used as a switch.
- PCB layout and wiring - If there are any problems with the crystal oscillator PCB design in the figure, please feel free to discuss.