I J International Journal of lectrical, lectronics ISS o. (Online) : 2277-2626 and omputer ngineering 1(2): 83-87(2012) Special dition for Best Papers of Michael Faraday IT India Summit-2012, MFIIS-12 Development of an Analog G Simulator using Standalone mbedded System Sangita Das*, ajarshi Gupta** and Madhuchhanda Mitra** * Dept. of, amellia School of ngineering & Technology, West Bengal, India **Department of Applied Physics, University of alcutta, 92 A.P.. oad, Kolkata, (WB) (eceived 15 October, 2012 Accepted 01 ovember, 2012) ABSTAT: This paper describes the development of a microcontroller based hardware G simulator which generates real-time analog G signal in the range of 0-5 volt. The synthetic G signal generated by the simulator can be used for testing and calibration of medical instruments, biomedical experiments and research in laboratories. The PTB diagnostic database collected from Physionet has been used as the standard database to generate G signal. This database has a sampling rate of 1 khz. The G database is amplified and quantized in 8-bit resolution. A MATLAB algorithm has been used to serially transmit the quantized G data using S-232 protocol to an 8051 based stand alone embedded system where it gets converted into 8-bit parallel data and delivered to the digital to analog converter. At the DA output we get the analog G signal in 0-5 volt range. Index Terms G, mbedded system, S-232 protocol, Simulator. I. ITODUTIO The bioelectrical signal generated by heart muscles is known as lectrocardiogram. This signal is the electrical signature of functioning of heart. The G signal is picked up from body using biopotential electrodes. In clinical practice there are 12 conventional leads, which may be divided into two groups depending upon their orientation to the heart- i)the frontal plane leads ii)the horizontal plane leads. G has a great clinical importance for diagnosis of diseases related to the heart. Traditionally G signal is recorded by an G machine on a graph with time along the X-axis and voltage along the -axis. A typical G beat tracing of the cardiac cycle (heart beat) consists of a P-wave, a QS complex, a T- wave and an occasional U-wave. For biomedical research works as well as calibration of biomedical instruments various types of normal and abnormal G signals are needed. It is really difficult to collect human patients with various cardiac abnormalities. Moreover, collecting G samples from human patients would require bio-safe amplifier with proper safety certification. These problems may be easily avoided using a hardware G simulator, which eliminates the necessity of human patients as well as an G machine. An G simulator is a P-based system which generates synthetic G signal from standard database replicating the G signal from a human body. On the other hand it removes the difficulties of collecting real G signals with invasive and noninvasive methods. eal time G signal can be generated by maintaining the sampling rate same as the sampling rate of the standard database, so that the simulated signal replicates the original G database. G waveforms having normal and user specified heart rate can be generated by probabilistic method using stored G waveforms [1]. Microcontroller based G simulators are available in the market which can be used for virtual reality application [2]. Application of embedded system and computer in biomedical instrumentation is of intense important now a days [3-8]. This paper illustrates a real time G simulator using a P-based standalone embedded system. The simulator generates analog G signal in the range 0-5 volt using the standard ptb-db database collected from Physionet [9]. A MATLAB program is used for amplification and quantization of the G samples within (0-255) to be compatible with an 8- bit processor (Atmel 892051) system. Therefore these data are sent to the microcontroller based system by P com port (serial com port) using S-232 protocol. The microcontroller performs the job of serial to parallel conversion of the 8-bit G data. The simulator output is derived from the DA output in the range 0-5 volt. II. MTHODOLOG The block representation of the system is shown in the Fig-1. The first block is the software block. A single lead ptb-db data array in *mat format is used as the input data to a software program. ext, the data array is amplified and quantized with 8-bit resolution. After that the quantized data array is transmitted at a constant baud rate by the serial port of the personal computer using S-232 protocol. The next block is the standalone embedded system which consists of four components- (i) MAX232 level converter, (ii) Atmel 892051 Microcontroller unit (MU), (iii) digital to analog converter Das, Gupta and Mitra 84
(DA 0808) and (iv) current to voltage converter (using LM324). This standalone system converts the 8-bit serial data into 8-bit parallel data, then into an analog signal in the range of 0-5 volt. Serial Port Quantization ptb db data S-232 communication MAX 232 8051 MU A. Amplification and Quantization of ptb-db Simulated G signal (0-5 Volt) The ptb-db database is a standard G database having a sampling rate of 1 khz. Using a MATLAB program a single lead data samples are processed so that it generates an G signal from an G electrode system with certain amplification factor and a positive dc shifting. It is being observed that low amplitude G signal always ranges within ± 3-5 mv. The ptb-db database also contains data with amplitude with in ±5 mv. At first each sample array is amplified with a constant gain. Here the amplification factor is kept as 500 to get a value within ±2.5 volt. This process resembles an amplifier with a constant gain of 500. ow the derived value is dc shifted by a voltage 2.5 to generate an output of 0-5V, since most of the real life ADs accepts unipolar analog signals. After that the signal is multiplied by 51 (which is equal to 255/5, or quantization factor of AD) to quantize the database with 8-bit resolution, i.e., by the above processes milli volt samples are converted in 0-255 range. To summarize, three consecutive operations are performed to process the ptb-db for an 8bit system (i) A constant gain (500) is given to the data samples. (ii) D shifting of +2.5. (iii) Multiplied by 51 for 8-bit quantization. If X[i] is one G sample from ptb-db, then the quantized data is obtained as [ i] = { X [ i] 500 + 2.5} 51 (1) ptb-db A. Serial databasetransmission Gain=500 AD Quantized data (0-255 Fig. 2: Block representation of the amplifier with a dc shift. DA urrent to Voltage onverter Fig 1: Block Diagram of the system. 2.5 After 8-bit quantization of the data array, it is transmitted to the microcontroller using S-232 serial communication protocol. To transmit the data serially an event driven programming is used where 10000 quantized samples are delivered trough the output port using an appropriate buffer length using a baud rate of 9600 and no parity. At each occurrence of empty buffer event, the sample is replenished with new data using a data counter. Two pins i) TxD and ii) GD of the DB9 connector are used to send the data serially to the microcontroller. B. Serial to Parallel onversion An 8-bit microcontroller (892051) is used to receive the 8-bit quantized data transmitted by the serial port of the P through a level converter (MAX232), which converts the S-232 logic level into the TTL/MOS logic level. The main objective of the microcontroller is the serial to parallel conversion of the 8bit G data. The microcontroller serial data transmission mode is set as 8-bit variable baud rate universal asynchronous receiver transmitter (UAT) mode. The serial communication Baud rate is also set at 9600. So that it properly synchronizes with the incoming data sampling rate. The 8-bit serial data is received at microcontroller serial receive (xd) pin and hold by the SBUF register. After receiving a complete byte the microcontroller is interrupted by the eceive Interrupt (I) flag. With this interruption the microcontroller sends the received data byte from the serial buffer register to the 8bit parallel port. This process is continued until the last data byte is received. The parallel port of the microcontroller is connected to an 8-bit digital to analog converter (DA0808) input port. The 8-bit digital data is converted into an analog signal by the DA. The reception of the serial data and its conversion to an analog signal is almost a simultaneous process and the G simulator can be called a real time G simulator. As the DA output is a current signal, it is converted into a voltage signal in the range 0-5 volt using a current to voltage converter. For this purpose LM324 is used. The output of the current to voltage converter is the desired simulated G signal which is an analog signal of 0-5 volt. III. SULTS The experimental hardware setup and the digital storage oscilloscope output of the simulated G signal is shown in Fig 5 and Fig 5 respectively. The PTB database is used to test the performance of the G simulator by calculating the ratio of important parameters of G waveform both for original ptb-db database and quantized database. By this process the capability of the simulator to replicate the original ptb-db at the simulator output can be determined. The percentage error between the ptb-db data and the 8-bit quantized data is calculated to examine the distoriton of the quantized G waveform due to amplification and 8-bit quantization.
Start Input Ptb-db database Set serial port settings 9600,,8,1 Transmit one byte ount full? Stop Update next byte Das, Gupta and Mitra 85 This error is calculated for different G leads (e.g. Lead I, avl, av, V3 etc.) by determining the QS complex height and T-wave height from the original ptb-db waveform and quantized G waveform by plotting the wave forms using MATLAB simulation program. The % error is calculated using the equation: ptb Q % error = 100 (2) ptb Where, ptb = QS ht /T ht for ptb-db data, Q = QS ht /T ht for quantized data, QS ht = Height of the QS complex of G waveform and T ht = height of the T- wave of G waveform. Here the % error is calculated using the ptb-db database for Lead I, avl, V3, V4 for P1/s0014 and Lead I, V3, V6 for P2/s0016. Table 1: The % error between the PTB data and the quantized data. Start Set serial port settings 9600,, 8, 1 Is I=1? Send data to DA input nd of data? Stop Fig 3: Flowchart for serial data transmission using MATLAB Flowchart of serial to parallel data conversion at embedded system.
Das, Gupta and Mitra 86 P S-232 GD TX I Fig 4: ircuit diagram 4 16 2 6 5 1 3 MAX 232 8 9 15 10 µf OUT 1 20 1 19 AT892051 12 4 5 10 1 MSB LSB 5 3 6 16 7 8 DA 0808 9 10 14 11 12 4 2 15 VB=-15V 1 1 2 3 LM 324 Vref=5V.01µF 1 =10µF 1=33pF =10K 1=5K \ I. HLPFUL HI Fig 5: xperimental esults Hardware setup for G simulator, DSO output of Simulated G signal for p2/s0016_v3. Fig 6: wave forms for ptb-db and quantized data for p1/s0014 V3 & p1/s0014 V4.
Das, Gupta and Mitra 87 IV. OLUSIO 8-bit resolution has been used for the quantized G database, 10-bit resolution can also be used. For 8 bit quantization all the databases are given a constant gain (500) and constant dc shift (+2.5). So, the wave form is not deformed and the clinical information is not affected by this manipulation. This is an 8051 based system so it is very much economical. Here 12 lead G signals are used to generated simulated G signal. Both normal and abnormal G signal can be generated by this simulator. The serial communication protocol (S-232) is the simplest communication protocol and the connector (DB9) is available with almost all Ps. This system is also capable of generating other types of biomedical signals like G, MG using proper amplification factor for the database. The noisy effect is not removed from the simulated G signal so whenever clean signal is required de-noising has to be done. Multi lead G signal for a 12 lead system can be generated by slightly modification of the developed software programming and hardware circuit. The ptb- db database for multi lead G signal can be send over the same serial communication line, in time multiplexed technique. In this case the serial communication baud rate or the data sampling rate (both for the S-232 protocol and the microcontroller) has to be increased by multiplying with a number which is equal to the number of leads used. And also a multichannel DA is required at the output. FS [1] I. Sadighi and M. Kejariwal, A generalized G simulator an educational tool, Proc. Of the Annual International onference of the I on ngineering in Medicine and Biology Society, Vol. 6, 9-12 ov. 1989, pp. 1963-1964. [2] B.. Demir, F. orulmaz, I. Guler, Microcontroller controlled G simulator, 15 th ational Biomedical ngineering Meeting, (BIOMUT), Apr. 21-24, 2010, pp.1-4. [3] W. H. ighter, Portable G monitor/recorder, United States Patent, Patent o. 5226425, 1992. [4]. Gupta, J.. Bera, M. Mitra, Development of an embedded system and MATLAB-based GUI for online acquisition and analysis of G signal, Measurement, Vol. 43, o. 9, ov. 2010, pp. 1119 1126. [5] D. Bansal, M. Khan, A.K. Salhan, A computer based wireless system for online acquisition monitoring and digital processing of G waveforms, omputers in Biology and Medicine, Vol. 39, o. 4, Apr. 2009, pp. 361-369. [6] L. A. Geddes,.. Fearnot, Personal electrocardiogram monitor, United States Patent, Patent o. 4606352, 1984. [7] G.. Mills, H. Homayoun, Wrist-worn G monitor with battery end of life prediction, United State Patent, Patent o. 5317269, 1994. [8]. Oweis, and L. Hijazi, A computer-aided G diagnostic tool, omputer Methods and Programs in Biomedicine, Vol. 81, o. 3, Mar. 2006, pp. 279-284. [9] www.physionet.org.