sms based patient report from remote place1
TRANSCRIPT
SMS BASED PATIENT REPORT FROM REMOTE PLACE
CHAPTER-1
INTRODUCTION
The project deals with the design and development of hardware and software for
temperature and heartbeat measurement of a patient over LCD
The data which are recorded continuously in this project are Heartbeat of the patient. The
digital value read is sent to the microcontroller. The microcontroller temporarily stores this
value.
The heartbeat pulses can be seen by the doctor at regular intervals in LCD to know the
patient condition.
1.1. OBJECTIVE
The project intends to interface the microcontroller with the LCD and Heart beat
monitoring system and send the information like heartbeat pulses of the patient to the doctor’s
work station on LCD. The project uses the LCD, Heartbeat sensor and Embedded Systems to
design this application. The main objective of this project is to design a system that continuously
monitors the heartbeat of the patient and if they are likely to exceed the normal values, the
system immediately sends a message to the doctor’s LCD.
This project is a device that collects data from the sensors, codes the data into
a format that can be understood by the controlling section. This system also collects information
from the master device and implements commands that are directed by the master.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
1.2 BACK GROUND OF THE PROJECT
The software application and the hardware implementation help the
microcontroller read the output of the sensors and send these values to the doctor’s mobile
whenever he sends a request to the controlling unit. The measure of efficiency is based on how
fast the microcontroller can read the sensor output values and send a message to the doctor’s
mobile whenever these parameters exceed the normal values. The system is totally designed
using LCD and embedded systems technology.
The Controlling unit has an application program to allow the
microcontroller read the sensor output values and send them to the user mobile whenever he
sends a request to the controlling unit. The performance of the design is maintained by
controlling unit.
CHAPTER-2
PROJECT DESCRIPTION
SMS BASED PATIENT REPORT FROM REMOTE PLACE
2.1 BLOCK DIAGRAM
The block diagram of the design is as shown in Fig 3.1. It consists of power supply unit,
microcontroller, GSM modem, Serial communication unit, sensor module. The brief description
of each unit is explained as follows.
Fig: Block diagram for Heartbeat Monitoring System
2.2 CIRCUIT DIAGRAM
SMS BASED PATIENT REPORT FROM REMOTE PLACE
2.3 WORKING PROCEDURE
SMS BASED PATIENT REPORT FROM REMOTE PLACE
The working of the project goes like this: The temperature and heartbeat of the patient
will be monitored continuously and the status of the patient will be monitored and sent to the
doctor wherever he may be.
Thus, the two values, the temperature and the heartbeat pulse will be sent to the doctor
who knows the entire health conditions of the patient. Thus, to send this data, we are using the
wireless technology, GSM. When the monitoring system sends a message to the doctor’s mobile,
even this system should have a device which can send or receive the messages from/to the
doctor. The device we are using is the GSM modem. The modem is exactly similar to our mobile
phones. Even the modem requires a SIM card to communicate with the outside world. The
modem will be interfaced with the microcontroller through serial interface.
The data which are monitored continuously in this project are Temperature and Heartbeat
of the patient. The analog quantities are taken and converted into corresponding digital values
using a single channel ADC. This converted digital value is sent to the microcontroller. The
microcontroller temporarily stores this value.
The doctor can read the temperature and heartbeat value whenever he wishes to. The
doctor can take care of the patient’s condition wherever he may be. The doctor has to send
predefined messages to the modem to retrieve the data. The modem receives the predefined
messages and intimates the same to the microcontroller. Now, it is the job of the microcontroller
to read the value, process it and send the requested value to the doctor’s mobile. The user can
read the updated data whenever he reads the predefined messages to the modem. These values
can also be displayed on the LCD.
CHAPTER 3
MICROCONTROLLER
SMS BASED PATIENT REPORT FROM REMOTE PLACE
3.1. A brief history of the 8051 family:
In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051. This
microcontroller had 128 bytes of RAM,4K bytes of on- chip ROM, two timers, one serial port,
and four ports(each 8-bit wide) all on a single chip. At the time it is also referred to as a “system
on chip.” This is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a
time. Data larger than 8 bits has to be broken into 8 bit pieces to be processed by the CPU. The
8051 has a total of four I/O ports, each 8-bit wide.
The 8051 became widely popular after Intel allowed other manufactures to make and
market any flavors of the 8051 they please with the condition that they remain code-compatible
with the 8051. This led to many versions of the 8051 with different speeds and amounts of on-
chip ROM marketed by more than half a dozen manufacturers. It is important to note that
although there are different flavors of the 8051 in terms of speed and amount of on-chip ROM,
they are all compatible with the original 8051 as far as the instructions are concerned. This
means that if you write your program for one, it will run on any of them regardless of the
manufacturer.
“The 8051 is the original member of the 8051 family. Intel refers to it as MCS-51.”
The Microcontroller AT89c51 is from Atmel Corporation. It has a wide collection of 8051
chips, as shown below. The AT89C51 is a popular and inexpensive chip used in many small
projects. It has 4K bytes of flash ROM. Notice that AT89C51-12PC, where “C” before the 51
stands for CMOS, which has low power consumption, “12” indicates 12MHz, “P” is for plastic
DIP package, and another “C” is for commercial.
3.2 FEATURES
Compatible with MCS-51 Products
8K Bytes of In-System Reprogrammable Flash Memory
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
4.0V to 5.5V Operating Range
Full Duplex UART Serial Channel
Interrupt Recovery from Power-down Mode
Watchdog Timer
Dual Data Pointer
Power-off Flag
Fast Programming Time
Flexible ISP Programming (Byte and Page Mode
3.3 PIN DIAGRAM:
SMS BASED PATIENT REPORT FROM REMOTE PLACE
FIG PIN DIAGRAM OF 89S52 IC
3.4 PIN DESCRIPTION
VCCSupply voltage.
GNDGround.
Port 0 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus
during accesses to external program and data memory. In this mode, P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming and outputs the code bytes during
program verification.
External pull-ups are required during program verification.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1
can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter
2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives
the low-order address bytes during Flash programming and verification.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order
address byte during fetches from external program memory and during accesses to external data
memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong
internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit
addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2
also receives the high-order address bits and some control signals during Flash programming and
verification.
Port 3
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of
various special features of the AT89S52, as shown in the following table. Port 3 also receives
some control signals for Flash programming and verification.
RST Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device. This pin drives High for 96 oscillator periods after the Watchdog times
out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the
default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address
Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to
external memory. This pin is also the program pulse input (PROG) during Flash programming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be
used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped
during each access to external data memory. If desired, ALE operation can be disabled by setting
bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if
the microcontroller is in external execution mode.
PSEN
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access to external
data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device
to fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage
(VPP) during Flash programming.
XTAL1
Input to the inverting oscillator amplifier and input to theInternal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
CHAPTER 4
POWER SUPPLY
All digital circuits require regulated power supply. In this article we are going to learn how to get
a regulated positive supply from the mains supply.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Figure shows the basic block diagram of a fixed regulated power supply. Let us go through each
block.
4.1 TRANSFORMER
A transformer consists of two coils also called as “WINDINGS” namely PRIMARY &
SECONDARY. They are linked together through inductively coupled electrical conductors also
called as CORE. A changing current in the primary causes a change in the Magnetic Field in the
core & this in turn induces an alternating voltage in the secondary coil. If load is applied to the
secondary then an alternating current will flow through the load. If we consider an ideal
condition then all the energy from the primary circuit will be transferred to the secondary circuit
through the magnetic field.
So
SMS BASED PATIENT REPORT FROM REMOTE PLACE
The secondary voltage of the transformer depends on the number of turns in the Primary as well as in the
secondary.
4.2 RECTIFIER
A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we use
a diode, a diode is a device that allows current to pass only in one direction i.e. when the anode
of the diode is positive with respect to the cathode also called as forward biased condition &
blocks current in the reversed biased condition.
Rectifier can be classified as follows:
1) Half Wave rectifier.
This is the simplest type of rectifier as you can see in the diagram a half wave rectifier consists
of only one diode. When an AC signal is applied to it during the positive half cycle the diode is
forward biased & current flows through it. But during the negative half cycle diode is reverse
biased & no current flows through it. Since only one half of the input reaches the output, it is
very inefficient to be used in power supplies.
2) Full wave rectifier.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Half wave rectifier is quite simple but it is very inefficient, for greater efficiency we would like
to use both the half cycles of the AC signal. This can be achieved by using a center tapped
transformer i.e. we would have to double the size of secondary winding & provide connection to
the center. So during the positive half cycle diode D1 conducts & D2 is in reverse biased
condition. During the negative half cycle diode D2 conducts & D1 is reverse biased. Thus we get
both the half cycles across the load.
One of the disadvantages of Full Wave Rectifier design is the necessity of using a center tapped
transformer, thus increasing the size & cost of the circuit. This can be avoided by using the Full
Wave Bridge Rectifier.
3) Bridge Rectifier.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
As the name suggests it converts the full wave i.e. both the positive & the negative half cycle
into DC thus it is much more efficient than Half Wave Rectifier & that too without using a center
tapped transformer thus much more cost effective than Full Wave Rectifier. Full Bridge Wave
Rectifier consists of four diodes namely D1, D2, D3 and D4. During the positive half cycle
diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3 conduct thus the
diodes keep switching the transformer connections so we get positive half cycles in the output.
If we use a center tapped transformer for a bridge rectifier we can get both positive & negative
half cycles which can thus be used for generating fixed positive & fixed negative voltages.
4.3 VOLTAGE REGULATOR
A Voltage regulator is a device which converts varying input voltage into a constant regulated
output voltage. Voltage regulator can be of two types
1) Linear Voltage Regulator
Also called as Resistive Voltage regulator because they dissipate the excessive voltage
resistively as heat.
2) Switching Regulators.
They regulate the output voltage by switching the Current ON/OFF very rapidly. Since their
output is either ON or OFF it dissipates very low power thus achieving higher efficiency as
compared to linear voltage regulators. But they are more complex & generate high noise due to
SMS BASED PATIENT REPORT FROM REMOTE PLACE
their switching action. For low level of output power switching regulators tend to be costly but
for higher output wattage they are much cheaper than linear regulators.
The most commonly available Linear Positive Voltage Regulators are the 78XX series where the
XX indicates the output voltage. And 79XX series is for Negative Voltage Regulators.
After filtering the rectifier output the signal is given to a voltage regulator. The maximum input
voltage that can be applied at the input is 35V.Normally there is a 2-3 Volts drop across the
regulator so the input voltage should be at least 2-3 Volts higher than the output voltage. If the
input voltage gets below the Vmin of the regulator due to the ripple voltage or due to any other
reason the voltage regulator will not be able to produce the correct regulated voltage.
3 Circuit diagram:
Fig 2.3. Circuit Diagram of power supply
IC 7805:
7805 is an integrated three-terminal positive fixed linear voltage regulator. It supports an input
voltage of 10 volts to 35 volts and output voltage of 5 volts. It has a current rating of 1 amp
although lower current models are available. Its output voltage is fixed at 5.0V. The 7805 also
SMS BASED PATIENT REPORT FROM REMOTE PLACE
has a built-in current limiter as a safety feature. 7805 is manufactured by many companies,
including National Semiconductors and Fairchild Semiconductors.
The 7805 will automatically reduce output current if it gets too hot.The last two digits represent
the voltage; for instance, the 7812 is a 12-volt regulator. The 78xx series of regulators is
designed to work in complement with the 79xx series of negative voltage regulators in systems
that provide both positive and negative regulated voltages, since the 78xx series can't regulate
negative voltages in such a system.
The 7805 & 78 is one of the most common and well-known of the 78xx series regulators, as it's
small component count and medium-power regulated 5V make it useful for powering TTL
devices.
Table. Specifications of IC7805
SPECIFICATIONS IC 7805
Vout 5V
Vein - Vout Difference 5V - 20V
Operation Ambient Temp 0 - 125°C
Output Imax 1A
SMS BASED PATIENT REPORT FROM REMOTE PLACE
CHAPTER-5
SENSORS
The sensors used in this project are Heartbeat and Temperature sensor. The
output of temperature sensor is given to the ADC so as to convert the analog value into digital
data and then give it to the microcontroller. The Heartbeat sensor used is basically a LED and
LDR arrangement.
5.1 HERT BEAT SENSOR
SMS BASED PATIENT REPORT FROM REMOTE PLACE
LED and LDR arrangement
The Heartbeat sensor used in this project is basically a LED and LDR arrangement.
The LED used in this arrangement is a high intensity LED.
Heart beat is sensed by using a high intensity type LED and LDR. The finger is
placed between the LED and LDR. As sensor, a photo diode or a photo transistor can be used.
The skin may be illuminated with visible (red) using transmitted or reflected light for detection.
The very small changes in reflectivity or in transmittance caused by the varying blood content of
human tissue are almost invisible. Various noise sources may produce disturbance signals with
amplitudes equal or even higher than the amplitude of the pulse signal. Valid pulse measurement
therefore requires extensive preprocessing of the raw signal.
The setup described here uses a red LED for transmitted light illumination and
a LDR as detector. With only slight changes in the preamplifier circuit the same hardware and
software could be used with other illumination and detection concepts. These values are sent to
the ADC for conversion of analog to digital and then sent to the microcontroller.
5.2 LM35 TEMPERATURE SENSOR
SMS BASED PATIENT REPORT FROM REMOTE PLACE
LM35 converts temperature value into electrical signals. LM35 series sensors are
precision integrated-circuit temperature sensors whose output voltage is linearly proportional to
the Celsius temperature. The LM35 requires no external calibration since it is internally
calibrated. . The LM35 does not require any external calibration or trimming to provide typical
accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature
range.
The LM35’s low output impedance, linear output, and precise inherent calibration make
interfacing to readout or control circuitry especially easy. It can be used with single power
supplies, or with plus and minus supplies. As it draws only 60 μA from its supply, it has very
low self-heating, less than 0.1°C in still air.
5.2.1 FEATURES
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
0.5°C accuracy guaranteed (at +25°C)
Rated for full −55° to +150°C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 μA current drain
Low self-heating, 0.08°C in still air
Nonlinearity only ±1⁄4°C typical
Low impedance output, 0.1 W for 1 mA load
SMS BASED PATIENT REPORT FROM REMOTE PLACE
The characteristic of this LM35 sensor is:
For each degree of centigrade temperature it outputs 10milli volts.
CHAPTER-6
ANALOG TO DIGITAL CONVERTER
Analog-to-digital converters are among the most widely used devices for data
acquisition. Digital systems use binary values, but in the physical world everything is continuous
i.e., analog values. Temperature, pressure (wind or liquid), humidity and velocity are the
physical analog quantities. These physical quantities are to be converted into digital values for
further processing. One such device to convert these physical quantities into electrical signals is
sensor. Sensors for temperature, pressure, humidity, light and many other natural quantities
produce an output that is voltage or current.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Thus, an analog-to-digital converter is needed to convert these electrical
signals into digital values so that the microcontroller can read and process them. An ADC has an
n-bit resolution where n can be 8,10,12,16 or even 24 bits. The higher resolution ADC provides a
smaller step size, where step size is the smallest change that can be detected by an ADC. In
addition to resolution, conversion time is another major factor in judging an ADC. Conversion
time is defined as the time it takes the ADC to convert the analog input to a digital number.
6.1 PIN DIAGRAM
ADC0804:
The ADC chip that is used in this project is ADC0804. The ADC0804 IC is an
8-bit parallel ADC in the family of the ADC0800 series from National Semiconductor. It works
with +5 volts and has a resolution of 8 bits. In the ADC0804, the conversion time varies
depending on the clocking signals applied to the CLK IN pin, but it cannot be faster than 110µs.
6.2 PIN DESCRIPTION
CS (Chip select)
Chip select is an active low input used to activate the ADC0804 chip. To access the ADC0804,
this pin must be low.
RD (read)
SMS BASED PATIENT REPORT FROM REMOTE PLACE
This is an input signal and is active low. ADC converts the analog input to its binary equivalent
and holds it in an internal register. RD is used to get the data out of ADC0804 chip. When CS=0,
if a high-to-low pulse is applied to the RD pin, the 8-bit digital output shows up at the D0-D7
data pins.
WR (write)
This is an active low input used to inform the ADC0804 to start the conversion process.
If CS=0 when WR makes a low-to-high transition, the ADC0804 starts converting the analog
input value Vin to an 8-bit digital value. The amount of time it takes to convert varies depending
on the CLK IN and CLK R values.
CLK IN and CLK R
CLK IN is an input pin connected to an external clock source when an external clock is
used for timing. However, the 804 has an internal clock generator. To use the internal clock
generator of the ADC0804, the CLK IN and CLK R are connected to a capacitor and a resistor.
In that case, the clock frequency is determined by the equation:
f = 1/ (1.1RC)
Typical values are R=10K ohms and C= 150 pf. Substituting in the above equation, the
frequency is calculated as 606 kHz. Thus, the conversion time is 110µs.
INTR
This is an output pin and is active low. It is a normally high pin and when the conversion is
finished, it goes low to signal the CPU that the converted data is ready to be picked up. After
SMS BASED PATIENT REPORT FROM REMOTE PLACE
INTR goes low, the CS pin is made low i.e., CS=0 and send a high-to-low pulse to the RD pin to
get the data out of the ADC0804 chip.
Vin(+) and Vin(-)
These are the differential analog inputs where Vin=Vin(+) – Vin(-). The Vin(-) pin is connected
to ground and the Vin(+) pin is used as the analog input to be converted to digital.
Vcc
This is the +5 volt power supply. It is also used as a reference voltage when the Vref/2 input (pin
9) is open.
Vref/2
Pin 9 is an input voltage used for the reference voltage. If this pin is open, the analog input
voltage for the ADC0804 is in the range of 0 to 5 volts.Vref/2 is used to implement analog input
voltages other than 0.5V. i.e., if the analog input range needs to be 0 to 4 volts, Vref/2 is
connected to 2 volts.
D0-D7
D0-D7 (D7 is the MSB) are the digital data output pins since ADC0804 is a
parallel ADC chip. To calculate the output voltage, the below equation is used:
Dout = Vin/ (step size)
where Dout = digital data output pins (in decimal) and Vin = analog input value
Analog ground and Digital ground
These are the input pins providing the ground for both the analog signal and the
digital signal. Analog ground is connected to the ground of the analog Vin while digital ground
is connected to the ground of the Vcc pin.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Clock source for ADC0804:
The speed at which an analog input is converted to the digital output depends on the
speed of the CLK input. According to the ADC0804 datasheets, the typical operating frequency
is approximately 640 kHz at 5 volts.
ADC interface with Microcontroller:
SMS BASED PATIENT REPORT FROM REMOTE PLACE
CHAPTER-7
LIQUID CRYSTAL DISPLAY
LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven
segment LEDs or other multi segment LEDs) because of the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the
task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep
displaying the data.
4. Ease of programming for characters and graphics.
7.1 LCD SCREEN
LCD screen consists of two lines with 16 characters each. Each character consists of 5x7 dot
matrix. Contrast on display depends on the power supply voltage and whether messages are
displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Vee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have
built in backlight (blue or green diodes). When used during operating, a resistor for current
limitation should be used (like with any LE diode).
LCD Connection
Depending on how many lines are used for connection to the microcontroller, there are 8-bit and
4-bit LCD modes. The appropriate mode is determined at the beginning of the process in a phase
called “initialization”. In the first case, the data are transferred through outputs D0-D7 as it has
been already explained. In case of 4-bit LED mode, for the sake of saving valuable I/O pins of
the microcontroller, there are only 4 higher bits (D4-D7) used for communication, while other
may be left unconnected.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Consequently, each data is sent to LCD in two steps: four higher bits are sent first (that normally
would be sent through lines D4-D7), four lower bits are sent afterwards. With the help of
initialization, LCD will correctly connect and interpret each data received.
Besides, with regards to the fact that data are rarely read from LCD (data mainly are transferred
from microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to
the Ground. Such saving has its price.
Even though message displaying will be normally performed, it will not be possible to read from
busy flag since it is not possible to read from display.
7.2 LCD INTERFACING WITH 8051
SMS BASED PATIENT REPORT FROM REMOTE PLACE
CHAPTER-8
RS-232 AND MAX-232
8.1 RS 232:
RS-232 is simple, universal, well understood and supported but it has some serious
shortcomings as a data interface. The standards to 256kbps or less and line lengths of 15M (50 ft)
or less but today we see high speed ports on our home PC running very high speeds and with
high quality cable maxim distance has increased greatly. The rule of thumb for the length a data
cable depends on speed of the data, quality of the cable.
.
Sub-D15 Male Sub-D15 Female
This is a standard 9 to 25 pin cable layout for async data on a PC AT serial cable
Description Signal 9-pin DTE 25-pin DCE Source DTE or DCE
Carrier Detect CD 1 8 from Modem
Receive Data RD 2 3 from Modem
Transmit Data TD 3 2 from Terminal/Computer
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Data Terminal Ready DTR 4 20 from Terminal/Computer
Signal Ground SG 5 7 from Modem
Data Set Ready DSR 6 6 from Modem
Request to Send RTS 7 4 from Terminal/Computer
Clear to Send CTS 8 5 from Modem
Ring Indicator RI 9 22 from Modem
SMS BASED PATIENT REPORT FROM REMOTE PLACE
8.2 MAX 232:
DESCRIPTION:
The MAX232 device is a dual driver/receiver that includes a capacitive voltage
generator to supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts EIA-232
inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and a typical
hysteresis of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into
EIA-232 levels. The driver, receiver, and voltage-generator functions are available as cells in the Texas.
8.2.1 FEATURES:
Operates With Single 5-V Power Supply
Lin Bi CMOS Technology
Two Drivers and Two Receivers
30-V Input Levels
Low Supply Current . . . 8 mA Typical
Meets or Exceeds TIA/EIA-232-F and ITU
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Recommendation V.28
8.2.2 APPLICATIONS:
TIA/EIA-232-F
Battery-Powered Systems
Terminals
Modems
Computers
ESD Protection Exceeds 2000 V Per
MIL-STD-883, Method 3015
Package Options Include Plastic
Small-Outline (D, DW) Packages and
Standard Plastic (N) DIPs
Absolute maximum ratings
Input supply voltage range, VCC : – 0.3 V to 6 V
Positive output supply voltage range: VS+ VCC – 0.3 V to 15 V
Negative output supply voltage range: VS––0.3 V to –15 V
Input voltage range, VI: Driver:–0.3 V to VCC + 0.3 V
Receiver: 30 V
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Output voltage range, VO: T1OUT, T2OUT VS –0.3 V to VS+ + 0.3 V
R1OUT, R2OUT : –0.3 V to VCC + 0.3 V
Short-circuit duration: T1OUT, T2OUT: Unlimited
Package thermal impedance, D package :113C/W
DW package : 105C/W
N package : 78C/W
Storage temperature range, Tstg : –65C to 150C
Lead temperature 1,6 mm (1/16 inch) from case for 10 seconds: 260C
Stresses beyond those listed under “absolute maximum ratings” may cause permanent
damage to the device. These are stress ratings only, and functional operation of the device at
these or any other conditions beyond those indicated under “recommended operating conditions”
is not implied. Exposure to absolute-maximum-rated conditions for extended periods may affect
device reliability. NOTE 1: All voltage values are with respect
to network ground terminal.2. The package thermal impedance is calculated in accordance with
JESD 51, except for through-hole packages, which use a trace length of zero description
SMS BASED PATIENT REPORT FROM REMOTE PLACE
8.2.3. MAX 232 Interfacing with RS232 and 89C51 microcontroller:
The MAX232 device is a dual driver/receiver that includes a capacitive voltage
generator to supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts
EIA-232 inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and
a typical hysterics of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS
input levels into EIA-232 levels. The driver, receiver, and voltage-generator functions are
available as cells in the Texas.
CHAPTER-9
GSM MODEM
9.1 THEORY
Unlike mobile phones, a GSM modem doesn’t have a keypad and display to interact with. It just accepts certain commands through a serial interface and acknowledges for those. These commands are called as AT commands. There are a list of AT commands to instruct the modem to perform its functions. Every command starts with "AT". That’s why they are called as AT commands. AT stands for attention.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
SMS Related AT Commands
AT It is used to test the connection.
AT+CMGF=1It is used to instruct the modem to operate in text mode. AT+CMGF=0 will instruct the modem to operate in PDU mode.
AT+CMGS="mobile number"
It is used to send a text message. It accepts the recipient mobile number. As soon as this command is accepted the modem waits for the message content. The text message has to be sent sequentially and terminated by the char 0x1A.
AT+CMGW="mobile number"
It is used to store a message in the memory. After execution it returns an index for the message stored. Eg: AT+CMGW=1 . Here 1 is the
SMS BASED PATIENT REPORT FROM REMOTE PLACE
index for the saved message. Later this index is used to process the message like deleting it or forwarding to the recipient number.
AT+CMGD=2It is used to delete a message from the storage. The index of the stored message is used to delete it. Above command deletes the message with index 2.
In our simple project, the program waits for the mobile number to be entered through the keyboard. When a ten digit mobile number is provided, the program instructs the modem to send the text message using a sequence of AT commands
Testing your GSM modem
The GSM modem can be tested by connecting it with a PC. The modem is equipped with a RS232 cable. Just use a Serial to USB converter and connect it with the PC.
Now you can proceed with sending the commands to the modem using any serial communication program like Hyperterminal, minicom etc. Ensure the serial paramters are configured to 8N1 and the baudrate is set to 9600bps.
For each command you send the modem acknowledges with a message. Example: Just try sending "AT" to the modem. It sends back a result code "OK" which states that the modem is responding. If it’s not working fine, it sends "ERROR".
APPLICATIONS
1. All the parameters can be viewed on the mobile phone.
2. Most reliable.
3. Cost effective.
4. Supports innumerable sensors to the system.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
RESULTS AND CONCLUSION
Results
Assemble the circuit on the PCB as shown in Fig 5.1. After assembling the circuit on the
PCB, check it for proper connections before switching on the power supply.
Conclusion
The implementation of Heartbeat Monitoring System using GSM is done successfully. The
communication is properly done without any interference between different modules in the design.
Design is done to meet all the specifications and requirements. Software tools like Keil Uvision
Simulator, Proload to dump the source code into the microcontroller, Orcad Lite for the schematic
diagram have been used to develop the software code before realizing the hardware.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
The performance of the system is more efficient. Continuously reading the output from
the sensors and pass the data to the doctor’s mobile whenever the read values exceed the normal
values or whenever the doctor sends a request to the controlling unit is the main job carried out
by the microcontroller. The mechanism is controlled by the microcontroller.
Circuit is implemented in Orcad and implemented on the microcontroller board. The performance
has been verified both in software simulator and hardware design. The total circuit is completely verified
functionally and is following the application software.
It can be concluded that the design implemented in the present work provide portability, flexibility and
the data transmission is also done with low power consumption.
REFRENCES AND BIBLOGRAPHY
Muhammad Ali Mazidi , Janice Gillispie Mazidi, Rolin D. Mckinlay.
Second edition, “THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM”
K. J. Ayala. Third edition, “The 8051 MICROCONTROLLER”
General information about electronic voting machine
www.eci.gov.in
www.eci.gov.in/faq/evm.asp
www.eci.gov.in/Audio_VideoClips/presentation/EVM.ppt
www.rajasthan.net/election/guide/evm.htm
SMS BASED PATIENT REPORT FROM REMOTE PLACE
www.indian-elections.com/electoralsystem/electricvotingmachine.html
Tutorial on microcontroller:
www.8051projects.net/microcontroller_tutorials/
Tutorial on LCD:
www.8051projects.net/lcd-interfacing/
APPENDIX
Keil Compiler:
Keil compiler is software used where the machine language code is written and compiled.
After compilation, the machine source code is converted into hex code which is to be dumped
into the microcontroller for further processing. Keil compiler also supports C language code.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Fig Compilation of source Code
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Fig Run the compiled program
Proload:
Proload is software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller and this is done by the
Proload. Proload is a programmer which itself contains a microcontroller in it other than the one
which is to be programmed. This microcontroller has a program in it written in such a way that it
accepts the hex file from the Keil compiler and dumps this hex file into the microcontroller
which is to be programmed. As the Proload programmer kit requires power supply to be
operated, this power supply is given from the power supply circuit designed above. It should be
noted that this programmer kit contains a power supply section in the board itself but in order to
switch on that power supply, a source is required. Thus this is accomplished from the power
supply board with an output of 12volts.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Fig Atmel AT89C2051 Device programmer
Features
Supports major Atmel 89 series devices
Auto Identify connected hardware and devices
Error checking and verification in-built
Lock of programs in chip supported to prevent program copying
20 and 40 pin ZIF socket on-board
Auto Erase before writing and Auto Verify after writing
Informative status bar and access to latest programmed file
Simple and Easy to use
Works on 57600 speed
Description
It is simple to use and low cost, yet powerful flash microcontroller programmer for the
Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and Blank
Check. All fuse and lock bits are programmable. This programmer has intelligent onboard
firmware and connects to the serial port. It can be used with any type of computer and requires
no special hardware. All that is needed is a serial communication ports which all computers
have.
All devices have signature bytes that the programmer reads to automatically identify the
chip. No need to select the device type, just plug it in and go! All devices also have a number of
SMS BASED PATIENT REPORT FROM REMOTE PLACE
lock bits to provide various levels of software and programming protection. These lock bits are
fully programmable using this programmer. Lock bits are useful to protect the program to be
read back from microcontroller only allowing erase to reprogram the microcontroller. The
programmer connects to a host computer using a standard RS232 serial port. All the
programming 'intelligence' is built into the programmer so you do not need any special hardware
to run it. Programmer comes with window based software for easy programming of the devices.
Programming Software
Computer side software called 'Proload V4.1' is executed that accepts the Intel HEX format file
generated from compiler to be sent to target microcontroller. It auto detects the hardware
connected to the serial port. It also auto detects the chip inserted and bytes used. Software is
developed in Delphi 7 and requires no overhead of any external DLL.
SMS BASED PATIENT REPORT FROM REMOTE PLACE
Fig Writing the programs bytes onto the microcontroller
Project source code
Main code:
#include<reg51.h>
#include"lcddisplay.h"
#include"UART.h"
SMS BASED PATIENT REPORT FROM REMOTE PLACE
#include"eeprom.h"
#include<string.h>
sbit temp = P2^2;
sbit panic = P2^3;
sbit finger = P2^7;
//void long_delay();
unsigned char mobilenum1[10];
unsigned char rec[20];
unsigned char str[10],mobilenum[11];
code unsigned char str1[]={"OK"};
unsigned char l,s,n,a,b,i,count,j,jjj,hb=68;
void main()
{
temp=panic=finger=1;
lcd_int();
USART_int();
lcdcmd(0x84);
msgdisplay(" welcome " );
SMS BASED PATIENT REPORT FROM REMOTE PLACE
delay(1000);
lcdcmd(0x01);
msgdisplay("searching for");
lcdcmd(0xc0);
msgdisplay("GSM modem");
delay(100);
send_to_modem("ate0"); //to avoid echo signals,
enter();
send_to_modem("at"); // TO CHECKING GSM MODEM...
enter();
for(s=0;s<5;s++) // Here we are waiting for data whitch is sending by GSM modem
{ // to checking wether the GSM modem connected to system or
while(RI==0); // not.
str[s]=SBUF;
RI=0;
}
/*str[s]='\0';
lcdcmd(0x01);
msgdisplay1(str);
long_delay();
SMS BASED PATIENT REPORT FROM REMOTE PLACE
n=strcmp(str3,str1);
if(n)
goto again; // GSM modem if those are matching then following messages
else
{*/ // are displaying on LCD.
lcdcmd(0x01);
msgdisplay("SYSTEM");
lcdcmd(0xc3);
msgdisplay("CONNECTED");
// }
send_to_modem("at+cmgf=1");
enter();
send_to_modem("at+cmgd=1");
enter();
send_to_modem("at+cmgd=2");
enter();
send_to_modem("at+cmgd=3");
enter();
RI=0;
SMS BASED PATIENT REPORT FROM REMOTE PLACE
lcdcmd(0x01);
msgdisplay(mobilenum);
st:delay(2500);
while(RI==1)
{
RI=0;
delay(100);
}
lcdcmd(0x01);
msgdisplay("patient ");
lcdcmd(0xc0);
msgdisplay("monitoring systm");
while(RI==1);
while(1)
{
SMS BASED PATIENT REPORT FROM REMOTE PLACE
hb=hb+1;
if(hb==80)
hb=69;
if(finger==0)
{
delay(500);
if((finger==0)&&(hb>79))
{
lcdcmd(0x1);
msgdisplay(" high heartbeat");
send_to_modem("at+cmgs=");
ch_send_to_modem('"');
send_to_modem(mobilenum);
ch_send_to_modem('"');
enter();
send_to_modem("emergency alert for patient xyz..");
ch_send_to_modem(0x1a);
enter();
SMS BASED PATIENT REPORT FROM REMOTE PLACE
while(RI==0);
a=SBUF;
RI=0;
if(a==13)
{
lcdcmd(0x01);
msgdisplay("message sent");
goto st;
}
}
else
{
lcdcmd(0x01);
msgdisplay("heart beat: ");
lcddata((hb/10)+48);
lcddata((hb%10)+48);
delay(500);
while(finger==0);
}
goto st;
}
if(temp==0)
SMS BASED PATIENT REPORT FROM REMOTE PLACE
{
resend:
lcdcmd(0x01);
msgdisplay("over temp");
lcdcmd(0xc3);
msgdisplay("sending msg");
send_to_modem("at+cmgs=");
ch_send_to_modem('"');
send_to_modem(mobilenum);
ch_send_to_modem('"');
enter();
send_to_modem("abnormal temerature from room1 ");
ch_send_to_modem(0x1a);
enter();
while(RI==0);
a=SBUF;
RI=0;
while(RI==0);
b=SBUF;
RI=0;
if(a==13)
{
SMS BASED PATIENT REPORT FROM REMOTE PLACE
lcdcmd(0x01);
msgdisplay("message sent ");
goto st;
}
else
{
delay(2000);
goto resend;
}
}
if(panic==0)
{
resend1:
lcdcmd(0x01);
msgdisplay("emergency alert from room1");
lcdcmd(0xc3);
msgdisplay("sending msg");
send_to_modem("at+cmgs=");
ch_send_to_modem('"');
send_to_modem(mobilenum);
ch_send_to_modem('"');
enter();
SMS BASED PATIENT REPORT FROM REMOTE PLACE
send_to_modem("emergency alert ");
ch_send_to_modem(0x1a);
enter();
while(RI==0);
a=SBUF;
RI=0;
if(a==13)
{
lcdcmd(0x01);
msgdisplay("message sent");
goto st;
}
else
{
delay(2000);
goto resend1;
}
}
}
}
SMS BASED PATIENT REPORT FROM REMOTE PLACE
}
}
}
LCD CODE:
#include<reg51.h>
#define lcd_data P2
#define lcd_cont() ((lcd_en=1),(delay(3)),(lcd_en=0))
sbit lcd_rs = P2^1;
SMS BASED PATIENT REPORT FROM REMOTE PLACE
sbit lcd_en = P2^0;
void lcd_init(void);
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);
void msgdisplay(unsigned char b[]);
void delay(unsigned int value);
void lcd_init(void)
{
lcdcmd(0x02);
lcdcmd(0x02);
lcdcmd(0x02);
lcdcmd(0x28);
lcdcmd(0x28);
lcdcmd(0x28);
lcdcmd(0x0c);
lcdcmd(0x06);
lcdcmd(0x01);
}
void lcdcmd(unsigned char value) // LCD COMMAND
{
lcd_data=value&(0xf0);
lcd_rs=0;
lcd_cont();
SMS BASED PATIENT REPORT FROM REMOTE PLACE
lcd_data=((value<<4)&(0xf0));
lcd_rs=0;
lcd_cont();
void lcddata(unsigned char value)
{
lcd_data=value&(0xf0);
lcd_rs=1;
lcd_cont();
delay(3);
lcd_data=((value<<4)&(0xf0));
lcd_rs=1;
lcd_cont();
delay(3);
}
void msgdisplay(unsigned char b[])
{
unsigned char s,count=0;
for(s=0;b[s]!='\0';s++)
{
lcddata(b[s]);
}
}
SMS BASED PATIENT REPORT FROM REMOTE PLACE
void delay(unsigned int value)
{
unsigned int x,y;
for(x=0;x<100;x++)
for(y=0;y<value;y++);
}
SERIAL COMMUNICATION CODE:
#include<reg51.h>
void UART_init();
void send_to_modem(char*);
void enter();
void send(char);
void ch_send_to_modem(char*);
void UART_init()
{
SCON = 0x50;
TMOD = 0x20;
TH1 = 0xFD;
TR1 = 1;
}
void send_to_modem(char *s)
{
SMS BASED PATIENT REPORT FROM REMOTE PLACE
while(*s != '\0')
{
send(*s);
s++;
}
}
void ch_send_to_modem(char *s)
{
while(*s != '\0')
{
send(*s);
s++;
}
send('\r');
send('\n');
}
void send(char x)
{
SBUF = x;
while(TI == 0);
TI = 0;
}
void enter()
SMS BASED PATIENT REPORT FROM REMOTE PLACE
{
send('\r');
send('\n');
}
COMMUNACATION DETAILS