Design and Development of ECG Simulator and Microcontroller Based Displayer

Cardiovascular disease is one of the major causes of mortality among developed societies. Therefore, an Electrocardiograph (ECG) device is one of the most important diagnostic devices in the medical field. Using this device, can be record and analyse electrical waves created in the heart and treat and treat cardiovascular disease. An ECG recorded electrocardiogram contains P wave, PR interval, QRS complex, ST segment, T wave, QT interval and U wave. Any changes in the ECG chart represent a type of cardiovascular disease. Using the ECG simulator, can be simulate the vital signal of the human heart and use it to inspect the correct functioning of the ECG device. Due to the fact that all medical devices are directly related to the patient, they should be checked for safety and accuracy, so that there is no risk to the patient and no problem to the diagnosis of heart disease. This article examines the Manufacture of an ECG simulator with an LCD (liquid-crystal display) that can display heart signals using this simulator. Figure 1: Systemic and pulmonary circulation system. Citation: Shirzadfar H, Khanahmadi M (2018) Design and Development of ECG Simulator and Microcontroller Based Displayer. J Biosens Bioelectron 9: 256. doi: 10.4172/2155-6210.1000256


Introduction
The circulatory system releases the substances and gases that the body needs to circulate to the cells and eliminate the excreted metabolites from the cells. This system includes the heart, arteries, veins, capillaries and blood [1]. The circulatory system has two systemic and pulmonary circulatory systems that circulates the systemic circulation, the blood passes through the heart to the whole body, and the required materials are fed to the whole of the cells, and in the pulmonary circulation, the blood is transmitted from the heart to the lungs and It can be oxygenated ( Figure 1) [2].
The heart in this system, like a pump, causes blood to be pumped into the veins, which results in the movement of blood in the veins. In the systolic phase the volume of the ventricles contracts and the blood pumping into the systemic circulation system. In the diastolic phase, there is also a compression in the arteries, which is the resting phase of the cardiac cycle [3,4].
Cardiac Output is an important parameter in describing the function of the cardiac. The first symptoms of any disease are a change in the heart's output, which is very important for the prevention and treatment of cardiovascular disease. The result of multiplying the stroke volume in the heart rate is the Cardiac Output, which is the amount of blood that goes out of the heart at any beat [5].
The human heart located in the middle chest consists of two cavities on the right and two cavities on the left, each side having a ventricle and an atrium, which are located on the left and right sides of the heart by a wall. The septum muscle is separated from each other. The task of the atrium is to pump blood into the ventricles and the ventricles' task is to remove blood from the heart. The outer heart is surrounded by a double-layer pericardial bag of fibrosis and the inner part of the heart, surrounded by a covering layer called an endocardium, and the heart also has an intermediate muscle layer called a myocardium [6].
The heart has four valves called mitral, tricuspid, aortic and pulmonary. These valves are elastic and covered with endothelium. The movement of these valves depends on the difference in pressure inside the heart cavity. The mitral valve and the tricuspid valve are one of the most important valves of the heart, whose function is to control the flow of blood into the ventricles, as well as two aortic and lung valves to control the flow of blood from the heart. The heart consists of aortic, carotid, iliac, subclavian, and pulmonary, and also has brachycephalic, pulmonary and iliac veins. The circulatory pathway in the heart is that the arteries transport oxygenated blood to other parts, and the blood in the vein is rich in carbon dioxide, from different parts of the body Collected ( Figure 2) [7][8][9].
The coronary arteries are small blood vessels that cover the heart, which sends oxygen and food to the cells, as well as exhaust waste. At intervals between the beats in which the heart is in rest, blood flows in these arteries. These vessels originate from the aorta and are the first arteries to receive blood that contains oxygen [10,11].
The heart tissue is composed of several cells that cause the contraction of the heart, and also the dedicated electrical cells of the heart conduction system act to initiate stimulation and electrical impulses in the heart [12].
The sympathetic and parasympathetic nervous system, which is the body's own nervous system, regulates heart rate. This nervous system during stress and intense activity causes the release of hormones of norepinephrine and epinephrine, which leads to an increase in heart rate. Parasympathetic nerves reduce heart rate and connect with the vagus nerve to the heart, but sympathetic nerves increase heart rate ( Figure 3) [13][14][15].
The electrical activity of the heart is due to the movement of ions including potassium, calcium and sodium through the cell membrane. The heart muscle cells are polarized at rest, and there is an electrical difference between the inside of the membrane and the outside of the membrane. The heart cycle begins with systolic, which results in increased ventricular pressure, which causes the mitral valve and tricuspid valve to close. This function causes the blood to enter the arteries of the aorta and lung, and also prevents the blood from returning to the atrium. During the diastolic phase, the venous blood enters the atrium and then into the ventricles, and in the end, the atrial muscle contracts, which increases the pressure in the atrium [16,17].
Cardiovascular disease affects the functioning of the circulatory and cardiac system and causes changes in the electrocardiogram chart. Atherosclerosis disease is a blood vessel disease caused by narrowing, tightness and blockage of blood vessels that are responsible for providing adequate blood to the heart and brain ( Figure 4) [18,19].
An irregular and abnormal heartbeat, as well as a disorder caused by conduction of electrical impulses, is called arrhythmia, which causes tachycardia and bradycardia in the heartbeat, and atrial fibrillation is a type of arrhythmia in the heart ( Heart enlargement involves two types of hypertrophy and dyslipidemia. In hypertrophy, the thickness of the heart muscle increases but in the dyslipidemia, the internal size of one of the heart cavities increases (Figure 8). The best way to examine the enlargement of the heart is to echocardiogram. The echocardiogram clearly identifies the exact size of the heart and the cavities as well as the function of the heart. The disease in the electrocardiographic wave changes the direction of the axis to the left and right or the peaks of these waves increase [25][26][27].
Willem Einthoven, the Dutch physiologist in 1903, invented the first electrocardiogram recorder, measuring electrical changes during heart rate. The words P, QRS, and T were used by Einthoven, and the term Einthoven's triangle was named for him ( Figure 9) [28-30].
Electrocardiogram can be used to record non-invasive electrical activity of the heart. Generally, electrocardiogram is a graphical representation of the electrical potential generated by the heart muscle. This device has 10 or 12 output leads, four or six of which are attached to the arms and legs, and six additional to the front of the chest [31].   This device displays signals from the heart in the form of waves on a chart and records on the heartbeat paper. The electrocardiogram has P wave, PR interval, QRS complex, ST segment, T wave, QT interval and U wave ( Figure 10). The wave P represents the first wave of the ECG, which transmits electrical current from the atrium, and depicts the atrial depolarization. The QRS complex represents the depolarization of the ventricles. The ST segment shows the early stages of ventricular repolarization. The wave T represents the end stages of the ventricular repolarization. The QT interval is the time it takes for the ventricles to function in a cardiac cycle ( Figure 11) [32].
The block diagram of the electrocardiograph device consists of components including transducer, high pass and low pass filters, radio frequency interference filter, Input Protection, Preamplifier, Slope limiter, Ultimate amplifier and Right Leg Driver.
Electrocardiographs for the diagnosis and evaluation of various cardiovascular diseases and the general examination of the heart and the circulatory system, including the evaluation of electrolyte disturbances such as potassium-calcium changes, pulmonary embolism, detection of syncope attacks, determination of the rate of progression of myocardial infarction, determining the effect Cardiovascular drugs such as quinidine and digestive, and determination of atherosclerosis and ventricular hypertrophy [33-36].     According to existing laws, all medical devices that are in direct communication with humans should be properly tested and safely tested. All measurement parameters must also be properly tested by the device to obtain the correct results when using the device. Therefore, the vast majority of medical devices should have a simulator to check their performance.
The ECG simulator is one of the essential equipment for an ECG device. This device can simulate the vital signals of the heart and accordingly, eliminates the possible defects of the ECG. By connecting the simulator to the electrocardiogram, the typical ECG signal should be displayed on the electrocardiographic device monitor. With this simulator, the ECG can be inspected and repaired, as well as the functions; device alarms settings, and terminal connections. ECG Simulator can simulate the signals from the electrical activity of the heart and can examine more than 30 types of arrhythmias, waveforms of varying frequencies, and linearity according to standards, as well as the number of ECG modulator lids from 3 Up to 12 leads are variable [37,38].

Method and Material
The elements required to build the ECG simulator are shown in Table 1. The schematic circuit of this device is depicted in Figure 12, each of which has its own function. Using quartz crystal, an ECG signal can be simulated and constructed to maximize and minimize heart rate.
IC1 consists of an oscillator and a register shifter. Output pin 10 is a 16-Hz signal for Triggering the IC2. IC2 is a counter with 10 outputs. When output 0 from IC2 is active (pin 3), the combination of resistance 8 and capacitor 5 produces P wave. When the counter jumps to output 3 (pin 7) IC2, the wave R is created by capacitor 4 and resistance 4. The negative part is reduced by two diodes numbers 1 and 2 and simulates the S wave. When the output 5 (pin 1) IC2 is activated, the wave T is generated by the resistor 7 and the capacitor 5. The IC2 outputs that are not connected cause interruptions between the signals. The signals are located on the sides through the resistors 3 and 6, which are aligned and assigned to the slopes respectively. When a sequence is completed, the register shifter stops. In IC2, the output 9 (pin 11) connects to the input EN (pin 13). Only when a reset pulse reaches the counter (pin 15), the counter is restarted, which is created by IC1. In addition to the 16-Hz Trigger signal, IC1 can provide a 1 Hz and 0.5 Hz signal at pin 14 and pin 13, which is related to the heart rate at the minimum and maximum (switch 2). The square signal is converted into a positive pinch of pulse, which is done by a combination of resistors 10 and 11 and capacitor 6 and diode 4. A small LED with a resistance 5 to output 3 is connected to IC2 (pin 7), which blinks during period R. The combination of Resistors 12 to 15 transforms the bipolar signal from the electronic board into the required three polar output signals [39,40].
The HEF4521B is a type of CMOS (Complementary metal-oxidesemiconductor) series for dividing the frequency from 2 to 18 or 2 to 24. The CMOS series ICs are simple and inexpensive, and their current consumption is still close to zero. These types of ICs have high input impedance and work with a wide range of power supplies. This IC is a type of oscillator that has a pulse production capability, also has 24 flip-flop chains, with an asynchronous reset input and an input circuit with three operating modes [41]. The pin configuration of HEF4521B is shown in Figure 13.
The HCF4017B is a counter, in fact a divisor of 10, which is active by the count of the number counted every clock. By applying the pulse to the IC clock input, the outputs from 0 to 9 go from logical zero to logical mode, and after this cycle, again, this repeats [42,43]. The pin configuration of HCF4017B is shown in Figure 14.
The 1N4148 diode performs rectifier operation at high switching rates up to a maximum of 4 nanoseconds. This type of diode is a type    of diode signal and is a small nonlinear semiconductor that is used at high frequency or interrupted and replaced by a short pulse waveform [44,45].
The LCD monitor was created based on the schematic circuit in the Figure 15, which can be used to display signals and waveforms using this displayer, and to use this monitor to display the heart signal created by the simulator. The overall circuit performance is such that it converts the analogue sample into a digital sample that is processed by the microcontroller and the result is transmitted to the LCD and the results are presented as a waveform on the graph.
The ATmega32 or ATmega16 microcontroller can be used in the circuit of this displayer, which was compiled using Bascom AVR 2.0.7.8 software with the BASIC (Beginner's All-purpose Symbolic Instruction Code) language. When a microcontroller receives a signal, it performs a function based on the type of signal, and the necessary processing is done. The microcontroller consists of CPU, RAM, ROM, and input / output ports embedded in a small chip [46][47][48]. The pin configuration of ATmega32 is shown in Figure 16.
The operating voltage of this circuit is 12 V DC, which can be converted to a voltage of 12 V to 5 V by placing the L7805 regulator and then transmits this voltage to the circuit components. This regulator is used to have a constant voltage without oscillation and does not enter harmful circuit components. Also, the L7805 has a tripod for input, output and ground ( Figure 17) [49].
By placing the LM358 Op-Amp, can be increase the amplitude range, which can amplify the signal using math operators and filtration. This operating amplifier has bases for power supply, input and output, one of these inputs being inverting and the other non-inverting ( Figure  18) [50][51][52].
In this circuit it is necessary that the oscillator has a stable and stable working frequency, so that a piezoelectric crystal of 16 MHz was used in this circuit.   Finally, by connecting the simulator device or the function to the inputs of the circuit board, the signal can be displayed on the LCD and using the switch 1, can be display the AC or DC signal. Also, with the potentiometers in the circuit, can be adjust the domain range and vertical range. And using this circuit can be set the Sweep and the sampling rate. Multiple capacitors in the circuit are used to eliminate ripples and disturbances in waveforms.

Results
First, in the form of a schematic circuit, the simulator circuit was closed for initial testing on the Breadboard and the results of this circuit were displayed on an oscilloscope (Figures 19 and 20). Then, after the initial test, the PCB (Printed Circuit Board) of this circuit was designed and printed in Altium Designer Winter 09 and the signals from the ECG simulator were recorded (Figures 21-23).
Based on the signal obtained, the heart rate can be measured. Here, using the small square method, the heart rate was measured, based on the waveform generated, the heart rate was estimated to be at an estimated maximum of 150 bpm and in the minimum state of 88 bpm (Figures 24 and 25).   Then the displayer circuitry was also designed and printed on Altium Designer Winter 09 (Figures 26 and 27). Eventually, the Simulator device was connected to the displayer inputs, and heart signals were displayed on the LCD (Figure 28).

Conclusion
An electrocardiograph device is one of the most important and vital medical devices for diagnosis of cardiovascular diseases. Therefore, the accuracy function of this device is very important. Simulator is used to check the performance of this device, by which it can simulate heart signals and evaluate the accuracy of the ECG device. In this paper, the simulator was designed and built in small size and low cost, which makes it easy to use and use this device. For more convenience, a monitor was designed for this device, which, at a very short time, can display heart signals on the displayer screen and make adjustments to these signals.