Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
1
1. INTRODUCTION
A normal fetal heart rate (FHR) usually ranges from 120 to 160
beats per minute (bpm) in the utero period. At about 5 weeks gestation, your
baby's heart begins to beat. At this point, a normal fetal heart rate is about the same
heart rate as the mother's: about 80-85 beats per minute (BPM). It is measurable
sonographically from around 6 weeks and the normal range varies during
gestation, increasing to around 170 bpm at 10 weeks and decreasing from then to
around 130 bpm at term. From this point, it will increase its rate about 3 beats per
minute per day during that first month. By the beginning of the 9th week of
pregnancy, the normal fetal heart rate is an average of 175 BPM. At this point it
begins a rapid deceleration to the normal fetal heart rate for the middle of the
pregnancy of about 120-180 BPM. Fetal heart rate monitoring is used in nearly
every pregnancy at prenatal visits. It is done to check on how the fetus is doing and
to look for any problems. Fetal heart rate monitoring is especially helpful if you
have a high-risk pregnancy. The pregnancy will be high risk if the patient is an
diabetian or have high blood pressure. It is also high risk if the fetus is not
developing or growing thus the results of fetal heart rate monitoring will be less
accurate. Hence continuous monitoring can ensure the safe pregnancy for the
mother. MATLAB simulation is implemented to display the fetal heart rate. Here
the input signals are taken from the physionet website. This website provides the
2
signals used for the research purposes. These signals are extracted as Matlab file.
Then by using the fuzzy logic these signals are trained and the fetal heart rate is
displayed in the LCD using Arduino.
Figure 1.1: Input signal
3
2. BLOCK DIAGRAM
Figure 2.1: Block diagram
3. COMPONENTS
ARDUINO
LCD DISPLAY
MATERNAL
AND FETAL
SIGNAL
MATLAB
SOFTWA
RE
ARDUINO LCD
4
4. HARDWARE DESCRIPTION
4.1 ARDUINO UNO
The Arduino Uno is a microcontroller board based on the
ATmega328. It has 14 digital input/output pins (of which 6 can be used as PWM
outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power
jack, an ICSP header, and a reset button. It contains everything needed to support
the microcontroller. Simply connect it to a computer with a USB cable or power it
with a AC-to-DC adapter or battery to get started. The Uno differs from all
preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega8U2 programmed as a USB-to-serial converter. All
Arduino boards are based around the ATMEGA AVR series microcontrollers from
ATMEL which feature both analog and digital pins. Arduino also created software
which is compatible with all Arduino microcontrollers. The software, also called
“Arduino”, it can be used to program any of the Arduino microcontrollers by
selecting them from a drop-down menu. Being open source and based around C,
Arduino users are not necessarily restricted to this software, and can use a variety
of other software to program the microcontrollers.
4.2 FEATURES
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
5
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
4.1.2 INPUT AND OUTPUT
Each of the 14 digital pins on the Uno can be used as an input or
output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate
at 5 volts. Each pin can provide or receive 20 mA as recommended operating
condition and has an internal pull-up resistor (disconnected by default) of 20-50k
ohm. A maximum of 40mA is the value that must not be exceeded on any I/O pin
to avoid permanent damage to the microcontroller.
The Uno has 6 analog inputs, labeled A0 through A5, each of which
provide 10bits of resolution (i.e. 1024 different values). By default they measure
from ground to 5 volts, though is it possible to change the upper end of their range
using the AREF. pin and the analogReference() function.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with
analogReference().
6
Reset. Bring this line LOW to reset the microcontroller. Typically used to
add a reset button to shields which block the one on the board.
Figure 4.1.1 Pin diagram
4.1.3 MEMORY
The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader).
It also has 2 KB of SRAM and 1 KB of EEPROM.
7
4.1.4 POWER
The Uno board can be powered via the USB connection or with
an external power supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart)
or battery. The adapter can be connected by plugging a 2.1mm center-positive plug
into the board's power jack. Leads from a battery can be inserted in the GND and
Vin pin headers of the POWER connector.
The board can operate on an external supply from 6 to 20 volts.
If supplied with less than 7V, however, the 5V pin may supply less than five volts
and the board may become unstable. If using more than 12V, the voltage regulator
may overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
Vin. The input voltage to the Uno board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
5V.This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V),
the USB connector (5V), or the VIN pin of the board (7-12V). Supplying
voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your
board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum
current draw is 50 mA.
GND. Ground pins.
IOREF. This pin on the Uno board provides the voltage reference with
which the microcontroller operates. A properly configured shield can read
8
the IOREF pin voltage and select the appropriate power source or enable
voltage translators on the outputs to work with the 5V or 3.3V.
4.1.5 COMMUNICATION
The Uno has a number of facilities for communicating with a
computer, another Uno board, or other microcontrollers. The ATmega328 provides
UART TTL (5V) serial communication, which is available on digital pins 0 (RX)
and 1 (TX). An ATmega16U2 on the board channels this serial communication
over USB and appears as a virtual com port to software on the computer. The
16U2 firmware uses the standard USB COM drivers, and no external driver is
needed. The Arduino Software (IDE) includes a serial monitor which allows
simple textual data to be sent to and from the board. The RX and TX LEDs on the
board will flash when data is being transmitted via the USB-to-serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1). A
Software Serial library allows serial communication on any of the Uno's digital
pins.
The ATmega328 also supports I2C (TWI) and SPI
communication. The Arduino Software (IDE) includes a Wire library to simplify
use of the I2C bus; see the documentation for details. For SPI communication, use
the SPI library.
4.1.6 AUTOMATIC RESET
Rather than requiring a physical press of the reset button before
an upload, the Uno board is designed in a way that allows it to be reset by software
running on a connected computer. One of the hardware flow control lines (DTR) of
9
the ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100
nanofarad capacitor. When this line is asserted (taken low), the reset line drops
long enough to reset the chip. The Arduino Software (IDE) uses this capability to
allow you to upload code by simply pressing the upload button in the interface
toolbar. This means that the bootloader can have a shorter timeout, as the lowering
of DTR can be well-coordinated with the start of the upload.
This setup has other implications. When the Uno is connected
to either a computer running Mac OS X or Linux, it resets each time a connection
is made to it from software (via USB). For the following half-second or so, the
bootloader is running on the Uno. While it is programmed to ignore malformed
data (i.e. anything besides an upload of new code), it will intercept the first few
bytes of data sent to the board after a connection is opened. If a sketch running on
the board receives one-time configuration or other data when it first starts, make
sure that the software with which it communicates waits a second after opening the
connection and before sending this data.
The Uno board contains a trace that can be cut to disable the
auto-reset. The pads on either side of the trace can be soldered together to re-
enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset
by connecting a 110 ohm resistor from 5V to the reset line.
4.1.7 SPECIALIZED PIN FUNCTIONS
Some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. These pins are connected to the corresponding pins of the
ATmega8U2 USB-to-TTL Serial chip.
10
External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge, or a change in value. See
the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the
analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.
LED: 13. There is a built-in LED driven by digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication
using the Wire library.
4.1.8 PHYSICAL CHARACTERISTICS
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Three screw holes allow the board to be attached to a surface or case.
Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even
multiple of the 100 mil spacing of the other pins.
11
Figure 4.1.2 Physical characteristics
4.1.9 ADVANTAGES
Inexpensive
Cross-platform
Simple, clear programming environment
Open source and extensible software
Open source and extensible hardware
12
4.2 LCD DISPLAY
A liquid crystal display (LCD) is a flat panel display,
electronic visual display, or video display that uses the light modulating properties
of liquid crystals. Liquid crystals (Fig 3.5) do not emit light directly. LCDs are
available to display arbitrary images (as in a general-purpose computer display) or
fixed images which can be displayed or hidden, such as preset words, digits, and 7-
segment displays as in a digital clock. They use the same basic technology, except
that arbitrary images are made up of a large number of small pixels, while other
displays have larger elements. LCDs are used in a wide range of applications
including computer monitors, televisions, instrument panels, aircraft cockpit
displays, and signage. They are common in consumer devices such as video
players, gaming devices, clocks, watches, calculators, and telephones, and have
replaced cathode ray tube (CRT) displays in most applications. They are available
in a wider range of screen sizes than CRT and plasma displays, and since they do
not use phosphors, they do not suffer image burn-in. LCDs are, however,
susceptible to image persistence. The LCD is more energy efficient and can be
disposed of more safely than a CRT. Its low electrical power consumption enables
it to be used in battery-powered electronic equipment. It is an electronically
modulated optical device made up of any number of segments filled with liquid
crystals and arrayed in front of a light source (backlight) or reflector to produce
images in color or monochrome. Liquid crystals were first developed in 1888. By
2008, worldwide sales of televisions with LCD screens exceeded annual sales of
CRT units; the CRT became obsolete for most purposes.
13
Figure 4.2.1 LCD
4.2.1 PIN DESCRIPTION
The LCDs have a parallel interface, meaning that the
microcontroller has to manipulate several interface pins at once to control the
display. The interface consists of the following pins:
A register select (RS) pin that controls where in the LCD's
memory you're writing data to. You can select either the data register, which holds
what goes on the screen, or an instruction register, which is where the LCD's
controller looks for instructions on what to do next.
A Read/Write (R/W) pin that selects reading mode or writing mode
An Enable pin that enables writing to the registers
8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're
writing to a register when you write, or the values you're reading when you read.
14
There's also a display constrast pin (Vo), power supply pins (+5V and Gnd) and
LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control
the display contrast, and turn on and off the LED backlight, respectively.
4.2.2 PIN INTERFACING
To wire the LCD screen to arduino board, connect the following pins:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
Additionally, wire a 10k pot to +5V and GND, with it's wiper (output) to LCD
screens VO pin (pin3). A 220 ohm resistor is used to power the backlight of the
display, usually on pin 15 and 16 of the LCD connector
15
Figure 4.2.2 Arduino and LCD interfacing
16
Use of the LCD is pretty straightforward. After power-up, wait a
half second or so to let the LCD run its own initialization. Since the default mode
is eight bits, we’ll have to reinitialize it to accept our data via the four-bit bus.
When the four-bit initialization is complete, It can send our characters or
commands. The RS line is set high for characters, low for LCD commands.
The initialization code is required to allow the LCD to operate in
four-bit mode. After setting the four-bit interface, this section of code turns the
display on, turns off the underline cursor, and causes the cursor to increment after
each character is written. Just to ensure that there is no garbage left from any
previous operations, the Display Clear command is sent to the LCD.
Writing a character or command is done in these steps:
1. Set the RS line (HIGH for character, LOW for command).
2. Place the high nibble of the character/command byte on the bus.
3. Strobe the Enable line (cause a HIGH-to-LOW transition).
4. Place the low nibble on the bus.
5. Strobe the Enable line one more time.
The LCD pins are numbered from 1- 16 .In the case where the LCD is powered
with the Arduino by the 5V USB cable, selecting the contrast resistor to be 2K
ohm and the back LED resistor to be 100 ohm is a good start. Alternatively, a 5K
potentiometer can be used to adjust the contrast.
17
Table 4.2.1 LCD and its interface
5 SOFTWARE DESCRIPTION
5.1 MATLAB SOFTWARE
MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include:
Math and computation
Algorithm development
Modeling, simulation, and prototyping
Data analysis, exploration, and visualization
Scientific and engineering graphics
Application development, including Graphical User Interface building
18
The name MATLAB stands for matrix laboratory. MATLAB
features a family of application-specific solutions called toolboxes. Very important
to most users of MATLAB, toolboxes allow you to learn and apply specialized
technology. Toolboxes are comprehensive collections of MATLAB functions (M-
files) that extend the MATLAB environment to solve particular classes of
problems. Areas in which toolboxes are available include signal processing,
control systems, neural networks, fuzzy logic, wavelets, simulation, and many
others.
5.1.1 METHOD AND CONCEPT OF FECG EXTRACTION
The method used in this project is adaptive noise cancellation
(ANC) based on neuro fuzzy logic technique. ANC is a process by which the
interference signal can be filtered out by identifying a non linear model between a
measurable noise source (which is MECG in this case) and the corresponding
immeasurable interference. This is an extremely useful technique when a signal is
submerged in a very noisy environment. Usually, the MECG noise is not steady; it
changes from time to time. So the noise cancellation must be an adaptive process:
it should be able to work under changing conditions, and be able to adjust itself
according to the changing environment. The basic idea of an adaptive noise
cancellation algorithm is to pass the corrupted signal (abdominal) through a filter
that tends to suppress the MECG while leaving the signal unchanged. As
mentioned above, this is an adaptive process, which means it does not require prior
knowledge of signal or noise characteristics.
19
Figure 5.1: Noise cancellation with ANFIS filtering
In this project, x(k) represents the FECG signal that is to be
extracted from the noisy signal. n(k) is the MECG which is the noise source signal.
The noise signal goes through an unknown nonlinear dynamics(f) and generates a
distorted d(k) which is then added to x(k) to form the measurable
output(abdominal) signal y(k).
During the extraction of the fetal heartbeat signal, the system
input parameters (of both the maternal and the fetal heartbeat signals) were
generated by codes written in matlab. These parameters were then passed to the
adaptive neuro fuzzy inference system (ANFIS) for training. In the process of
training, the parameters (i.e. membership function parameters) of each system
input signal continues to map each other until the adaptive noise canceller (ANC)
reaches a point of convergence. At this point the fetal heart rate signal is extracted.
20
Figure 5.2:Flowchart for the extraction of FECG
5.1.2 ADVANTAGES OF ANFIS
Adaptive Neuro Fuzzy Inference System (ANFIS) was the
proposed technique for the extraction of Fetal Electrocardiogram (FECG) signals
from composite abdominal ECG recordings. The advantage of this technique over
other methods is that it requires only one abdominal signal and one thoracic signal.
But the other methods require many signals to validate their results. Compared to
other methods, ANFIS is well suitable for non linear applications. . Since this
technique uses neural network it requires fewer inputs to extract the FECG signal.
Convergence time is less compared to methods using neural network alone due to
the hybrid rule used in the ANFIS technique. ANFIS can separate the FECG
without dividing the signals into different frames. After removing the major
interference (MECG) from the FECG, it is easier to cancel the high frequency
noise using digital filters. Since the morphology of the extracted FECG using this
technique remains same, it can be used by the medical doctors and/or physicians to
diagnose.
21
5.2 ARDUINO SOFTWARE
The open-source Arduino Software (IDE) makes it easy to
write code and upload it to the board. It runs on Windows, Mac OS X, and Linux.
The environment is written in Java and based on Processing and other open-source
software. This software can be used with any Arduino board. The Arduino
Integrated Development Environment or Arduino Software (IDE) contains a text
editor for writing code, a message area, a text console, a toolbar with buttons for
common functions and a series of menus. It connects to the Arduino and Genuino
hardware to upload programs and communicate with them.
Programs written using Arduino Software (IDE) are called
sketches. These sketches are written in the text editor and are saved with the file
extension .ino. The editor has features for cutting/pasting and for
searching/replacing text. The message area gives feedback while saving and
exporting and also displays errors. The console displays text output by the Arduino
Software (IDE), including complete error messages and other information. The
bottom righthand corner of the window displays the configured board and serial
port. The toolbar buttons allow you to verify and upload programs, create, open,
and save sketches, and open the serial monitor.
Verify/Compile
Checks your sketch for errors compiling it; it will report memory usage for
code and variables in the console area.
Upload
Compiles and loads the binary file onto the configured board through the
configured Port.
Upload Using Programmer : This will overwrite the bootloader on the board;
you will need to use Tools > Burn Bootloader to restore it and be able to
22
Upload to USB serial port again. However, it allows you to use the full
capacity of the Flash memory for your sketch. Please note that this command
will NOT burn the fuses. To do so a Tools -> Burn Bootloader command
must be executed.
Export Compiled Binary : Saves a .hex file that may be kept as archive or
sent to the board using other tools.
Port
This menu contains all the serial devices (real or virtual) on your machine. It
should automatically refresh every time you open the top-level tools menu.
Burn Bootloader
The items in this menu allow you to burn a bootloader onto the
microcontroller on an Arduino board.
6.ADVANTAGES
Continuous fetal heart rate monitoring reduces the chances of
seizure after the birth, a symptom of brain injury from low oxygen. It also ensures
the well-being and safety of both mother and fetal during pregnancy.
An abnormal fetal heart rate or pattern mean that the fetus is not
getting enough oxygen or suffering from any other problems. If the fetal heart rate
lies above or below 120 to 160BPM, it indicates the emergency situation.
7.CONCLUSION
Thus the fetal heart rate is monitored by using the adaptive neuro
fuzzy logic which is implemented by MATLAB, in which the FECG signal is
extracted by comparing normal MECG signal from the MECG and the fetal heart
rate signal is displayed in the LCD using Arduino. So that we ensure the well-
being and safety of both mother and fetal during pregnancy.
23
8. REFERENCE
[1] Assaleh K. (2007). Extraction of Fetal Electrocardiogram Using Adaptive
Neuro-Fuzzy Inference Systems, IEEE Trans. Biomed. Eng., 54: 59-68.
[2] Ibahimy M. et al. (2003). Real Time Signal Processing For Fetal Heart Rate
Monitoring, IEEE Med Biol. Eng. Comput., 50: 258-261.
[3] Jang J. (1993). ANFIS: Adaptive –Network- Based Fuzzy Inference
Systems, IEEE Trans. Syst. Man Cybern, 23: 665-683.
[4] Ferrara, E. R., and Widrow, B., “Fetal electrocardiogram enhancement by time-
sequenced adaptive filtering”, IEEE Trans. Biomed. Eng. 29,
pp. 458–460, 1982.
[5] Jafari, M. G., and Chambers, J. A., “Fetal electrocardiogram extraction by
sequential source separation in the wavelet domain”, IEEE
Transactions on Biomedical Engineering, vol. 52, no. 3, pp.390–400,2005.
[6] Widrow, B.,“Adaptive Noise Cancelling: Principles and Applications”,
Proc. IEEE, vol. 63, pp.1692-1716, Dec. 1975.
[7] John, R. G. Jr., “Adaptive Noise Canceling Applied to Sinusoidal
Interferences”, IEEE Trans. ASSP, Vol. ASSP-25, no. 6, pp. 484-491,
Dec.1977
[8] V. Zarzoso and A. Nandi, “Noninvasive fetal electrocardiogram extraction:
blind separation versus adaptive noise cancellation,” Biomedical Engineering,
IEEE Transactions on, vol. 48, no. 1, pp. 12–18, 2001.
[9] “Physionet, the research resource for complex biomedical signals.” http://www.
physionet.org/.
[10] R. Sameni and G. Clifford, “A review of fetal ECG signal processing; issues
and promising directions,” The open pacing, electrophysiology & therapy journal,
vol. 3, p. 4, 2010.