You are on page 1of 81


Submitted in partial fulfillment of the
Requirements for the award of the degree of
Bachelor Of Technology
Bio-Medical Engineering




Department Of Bio-Medical Engineering
GokarajuRangaraju Institute of Engineering and Technology
(Affiliated to Jawaharlal Nehru Technological University)

Department of Bio-Medical Engineering
GokarajuRangaraju Institute of Engineering and Technology
(Affiliated to Jawaharlal Nehru Technological University)

This is to certify that the project entitled “PATIENT MONITORING SYSTEM ”
has been submitted by




For partial fulfillment of the requirements for the award of degree of
Bachelor of Technology in Bio-Medical Engineering from
Jawaharlal Nehru Technological University, Hyderabad.
The results embodied in this project have not been submitted to any other
University or Institution for the award of any degree or diploma.

External Examiner

Head of Department
Mrs. T.Padma
Professor & HOD
Dept of Bio-Medical Engineering


This is to certify that K. KRISHNA GANESH, H.R. RANJAN students of final year B.M.E (Bio-Medical
Engineering) of Gokaraju Rangaraju Institute Of Engineering And Technology, affiliated to Jawaharlal
Nehru Technological University have completed a project work titled “PATIENT MONITORING SYSTEM”
in the department of Bio-Medical Engineering at GRIET.

Project Guide:

Project In charge:



Dept of Bio-Medical Engg

Dept of Bio-Medical Engg

There are many people who have helped us directly or indirectly in the successful
completion of our project. We would like to take this opportunity to thank one and all.

First of all we would like to express our deep sense of gratitude towards our project
Guide Suresh, Asst Professor Dept. of BME for always being available whenever we require her
guidance as well as for motivating us throughout the project work.

We are also grateful to the Mrs T.Padma, (Head of Dept.of BME for her valuable
guidance during our project. We would like to express our deep gratitude towards our teaching
and non-teaching staff for giving their valuable suggestions and co operation for doing our

We are also deeply indebted to Dr. Jandhyala. N. Murthy, Principal, Gokaraju
Rangaraju institute of engineering and technology for providing necessary facilities during the
execution of this project.
We would like to thank all our friends for their help and constructive criticism during our project
period. Finally, we are very much indebted to our parents for their moral support and encouragement to
achieve higher goals. we have no words to express our gratitude and still we are very thankful to our
parents who have shown us this world and for every support they gave us.







For more versatile medical applications. A micro-controller board is used for analyzing the inputs from the patient and any abnormality felt by the patient causes the monitoring system to give an alarm. by incorporating blood pressure monitoring systems. . dental sensors and annunciation systems. heart beat rate.. Also all the process parameters within an interval selectable by the user are recorded online. respiratory rate and ECG. thereby making it useful in hospitals as a very efficient and dedicated patient care system.ABSTRACT : Our project is a working model which incorporates sensors to measure parameters like body temperature. this project can be improvised. This is very useful for future analysis and review of patient’s health condition.



This thermister is a passive transducer and it’s resistance depends on the beat being applied on it. The software is written to give an audio alert when saline level falls below the safe level. . They are placed near the nect of the saline bottle. Also all temperature measurements are updated in the patients database. This sensor exhibits a large change in resistance with a change in body temperature. Here in our project we use bead temperature sensor. As long as the saline is present . SALINE MONITORING SYSTEM: For saline monitoring the infrared emitter and detector are placed in a position such that the saline bottle passes between them. which changes the values and thus the corresponding change in the temperature is displayed on the monitor graphically. The temperature sensor part is attached to the patient whose temperature has to be measured. We have arranged the sensor in the potential divider circuit.INTRODUCTION MEASUREMENT OF RESPIRATORY RATE: Thermister is used for the measurement of body temperature and respiratory temperature. Aand so the output will indicate normal saline status. The respiratory rate is determined by holding the sensor near the nose. the path of the infrared rays is blocked and the infrared detector is blocked from collecting infrared rays from the emitter.

This method of tracking the heart rate is more efficient than the traditional method which derives the same from ecg graph. .These switches are placed in the vicinity of the patient to enable medical access in an emergency. HEART BEAT MONITOR: The patient’s heart beat rate is monitored using photoelectric sensor which can sense the patient’s pulse rate.PATIENT CALLING SYSTEM: The patient caliing system consists of four switches which when pressed gives display on the screen and activities an audio alert indicating that patient is calling.


causing a correspondence variation in phototransistor output. . The phototransistor is connected as part of a voltage divider circuit. Also the output signal amplitude is large with better signal to noise ratio. Due to the narrow bond of the spectrum involved the radiation heat output is minimized. blood is forced to the extremities and amount of blood in finger increases.707 peak bandwidth of 0. The pulse rate monitoring method indicates a heart block immediately by sensing the cessation of blood circulation in the limb terminals. from which the heart beat rate is derived. The peak spectral emission of the LED is at 0.CIRCUIT DESCRIPTION Heart Beat Rate Sensor Cirtuit: Monitoring the heart beat rate of the patient can be easily accomplished by analyzing the ECG pulse .mm.94 mm with a 0. the ECG pulse is amplified and the average time interval or the instantaneous time interval between two successive R peaks is measured. This alters the optical density and so the IR signal transmission through the finger reduces.1. with 10KΩ and 22 KΩ carbon resistors and produces a voltage pulse that closely follows the heart beat rate .04mm. The finger probe used for pulse pick up consists of a Ga As infrared LED and a silicon NPN phototransistor mounted in an enclosure that fits over the tip of the patients’ finger. This pulse output is given to the bit 4 of the port D of the microcontroller for signal processing. Here. The photo transistor is used as an emitter follower configuration. The silicon phototransistor is sensitive to radiation between 0. The IR signal from the LED is transmitted through the finger tip of the patient’s finger and the conductivity of the phototransistor depends on the amount of radiation reaching it with each contraction of the heart. But this method fails to indicate heart blocks immediately and so photo electric pulse transducers are used. This technique uses photoelectric transducers which are easy to apply then the 3 ECG electrodes.4 and 1.

3. The subject should stayreasonably still – muscle movements will influence the signal. If used onthe finger the subject may feel a throbbing sensation. Attach the Pleth (finger/ear lobe clip) to either the fingertip or to the ear lobe. 2. Note for EasySenseAdvanced and Logger users: if the red LED does notstart to flash. Once a regular heart rate is detected.Measurement procedure 1. The red LEDon the Sensor housing will start to flash in time with the heartbeat. and the LCD display on the EasySenseunit is blank. . Wait for a short while for the signal to stabilise. begin recording data. press any ofthe buttons on the top panel of the EasySenseunit to wake it up.

thus generating no output at the IR detector. These switches are placed in the vicinity of the patient to enable medical access in an emergency. PATIENT CALL SWITCHES CIRCUIT : The patient calling system consists of four switches when pressed gives display on the screen and activates an audio alert indicating that a patient is calling. corresponding to port bit 4. The circuit uses an IR emitter and an IR detector which are placed in a straight line with the saline bottle in between.SALINE STATUS MONITORING CIRCUIT: The saline water injection plays a key role in the treatment and recovery of many a patient that requires constant monitoring. This digital output is fed to the pin 23 of the PIC micro controller. The presence of saline water. Also the usage of the GSM modem facilitates sending of saline status to the doctor concerned for any further action required. BODY RESPIRATORY RATECIRCUIT : The rate measuring circuit uses a temperature sensor for measuring the respiration rate. refracts the emitted radiation. By means of annunciation systems. When the saline level falls below the preset value. The signal is processed and the saline status is displayed on the screen. in a full bottle. In case of the saline becoming empty the annunciation systems are activated. This condition can be fulfilled by using IR sensors which can detect a drop in the saline below the quantity. the hospital staff can be informed and an action of replacing the saline can be easily accomplished before the bottle becomes empty.A thermistor is a ceramic semiconductor which exhibits a large change in resistance with a change in its body temperature. The availability of high . The thermistors have much better sensitivity than RTD’s and are therefore better suited for precision temperature measurements. at the point representing the preset saline level. the emitted IR radiation causes a photoelectric current from the detector. The detector output is an analog quantity which is made to drive a switching NPN transistor BC107 to get a binary output from the collector of the transistor.

where the temperature spans are very wide. Thermistors has other important advantages over RTD’s in that they are available in smaller sizes. the sensor must be low power consumer.resistance values allows the thermistors to be used with long extension leads since the lead resistance or contact resistance effects can be greatly diminished. In general to obtain clear and constant output with respect to the input change.This voltage is given to the transistor so that number of ones is counted in the microcontroller which is given as voltage from the transistor. In this circuit wehave arranged thermistor in the form of potential divider when thermistor is R1 and a potentiator is acting as a R2 which forms potential divider network and produces an output from potential divider network which is given to analog input channel of the micro controller. at lower costs and with greater resistance to shock and vibration effects. If not the sensor will to drive large output voltage may cause self heating of the device. Due to the above grounds we have constructed the thermistor circuits to produce low milli volts which can be easily digitalized by the transistor. If we draw a lowest current sensitivity the thermistor will improve and provides better performance. Self heating means large current flows through the thermistor create heat on it without accepting the body temperature. The non-linearity of the thermistor resistance-temperature characteristics outs a practical limit on the temperature span over which a thermistor can be operated in measurement or control circuit RTD’s have lower sensitivity and are more linear and can therefore be used in applications. with faster response times. .

Buzzer 13. Resistors 10. LED 6. Switches 7. LM35D 8. Microcontroller-89s52 2. Diodes . LCD Display 3. Battery 12. Photo Transistor 4. Capacitors 11. Transistors 9. IR Emitter and Detector 5.HARDWARE DETAILS Hardware used in the project are as follows: 1.

MICRO CONTROLLER 89S52: Definition A Microcontroller is a single-chip microcomputer that contains all the componentssuch as the CPU.Unlike a generalpurpose computer. a program counter (PC). RAM. ALU. . which contains arithmetic and logic unit (ALU).The 89C51/89C52/89C54/89C58 contains a non-volatile FLASH program memory that is parallel programmable. PC. counters and a clock circuit. The design incorporates all of the features found in a microprocessor: CPU. which was first introduced in 1980 and has gone on to be arguably the most popular micro controller architecture available. make complete computer: ROM. a clock timing circuit. serial I/O. and timers. For devices that are serial programmable (In-System Programmable (ISP) and In-Application Programmable (IAP) with a boot loader)All three families are Single-Chip 8-bit Microcontrollers manufactured in advanced CMOS process and are Derivatives of the 80C51 microcontroller family. a stack pointer (SP). parallel I/O. which just means that they are part of an embedded system. which also includes all of these components. some working registers.All the devices have the same instruction set as the 80C51. Microcontrollers are sometimes calledembedded microcontrollers. A microprocessor is a generalpurpose digital computer with central processing unit (CPU). some form of ROM. RAM. The 8051 is a very complete micro controller with a large amount of built in control store (ROM &EPROM) andRAM. enhanced I/O ports. SP and registers. and the ability to access external memory. and interrupts circuits. So we are going for micro controller since it has on-board programmable ROM and I/O that can be programmed for various control functions ATMEL 89S52 AT89S52 MICROCONTROLLER The microcontroller development effort resulted in the 8051 architecture. The maximum clock frequency with an 8051 micro controller can execute instructions is 20MHZ. It also has the other features needed to. The main disadvantage of microprocessor is that it has no on-chip memory. a microcontroller is designed for a very specific task – to control a particular system. Microcontroller is a true computer on chip. I/O ports.

0V to 5.5V Operating Range • 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 • Full Duplex UART Serial Channel • Low-power Idle and Power-down Modes • Interrupt Recovery from Power-down Mode • Watchdog Timer • Dual Data Pointer .000 Write/Erase Cycles • 4.Features • Compatible with MCS®-51 Products • 8K Bytes of In-System Programmable (ISP) Flash Memory – Endurance: 10.

The AT89S52 provides the following standard features: 8K bytes of Flash. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pinout.• Power-off Flag • Fast Programming Time • Flexible ISP Programming (Byte and Page Mode) • Green (Pb/Halide-free) Packaging Option Description The AT89S52 is a low-power. and clock circuitry. Watchdog timer. and interrupt system to continue functioning. 32 I/O lines. the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip. The on-chip flash allows the program memory to be reprogrammed in. the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. two data pointers. high performance CMOS 8-bit micro computer with 8Kbytes of flash programmable manufactured using and Atmel’s erasable high read onlymemory(PEROM). The Idle Mode stops the CPU while allowing the RAM. timer/counters. 256 bytes of RAM. disabling all other chip functions until the next interrupt or hardware reset.system or by a . The AT89s52 is a low power. on-chip oscillator. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. In addition. serial port. The Power-down mode saves the RAM con-tents but freezes the oscillator. high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory.The density nonvolatile memory device technology and is is compatible with the industry standard 80c51 and 80C52 instruction set and pin out. a full duplex serial port. a six-vector two-level interrupt architecture. three 16-bit timer/counters.

i. the software used can be applicable to any other microcontroller. Rewritability The 89s52 microcontroller has an excellent software compatability. The program can be reloaded and changed for nearly 1000 times. the Atmel AT89s52 Is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. Program Compatibility 3. The program can be used in any other advanced microcontroler.conventional nonvolatile memory programmer. Program compatibility is the major advantage in 89s52.e. The program written on this microcontroller can be carried to any base. The main advantages of 89s52 over 8051 are 1. By combining a versatile 8-bit CPU with flash on a monolithic chip. . Software Compatibility 2.



andclock circuitry. a six-vectortwo-levelinterrupt architecture. Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. The Power-down mode saves the RAM contents but freezes the oscillator. The Port 1 output buffers can sink/source four TTL inputs. three 16-bit timer/counters.256 bytes of RAM. External pullupsare required during program verification. When 1s are written to port 0 pins. GND:Ground. Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. the AT89s52 is designed with static logic for operation down to zerofrequency and supports two software selectable power saving modes.Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. a full-duplex serial port. When 1s are written to Port 1 pins. each pin can sink eight TTL inputs. P0 has internalpullups. 32 I/O lines. on-chip oscillator. PIN DESCRIPTION: VCC :Supply voltage. In this mode. the pins can be used as high impedance inputs. In addition. they are pulled high by the inter-nal pull-ups and can be used as inputs. As an output port.0 and P1. Port 0 can also be configured to be the multiplexed lower order address/data bus during accesses to external program and data memory.The AT89s52 provides the following standard features: 8K bytes ofFlash. The Idle Mode stops the CPU while allowing the RAM.1 . serial port. P1. disabling all other chip functions until the next hardware reset. timer/counters. and interrupt system to continue functioning. As inputs.In addition.

7 SCK (used for In-System Programming) . Port 1 also receives the low-order address bytes during Flash programming and verification. clock-out P1. When 1s are written to Port 2 pins. In this application. Port 2 emits the high-order address byte during fetches from external program memory and dur-ing accesses to external data memory that use 16-bit addresses (MOVX @ DPTR).0/T2) and the timer/counter 2 trigger input (P1.5 MOSI (used for In-System Programming) P1. Port 2 emits the contents of the P2 Special Function Register.can be configured to be the timer/counter 2 external count input (P1.0 T2 (external count input to Timer/Counter 2). As inputs.6 MISO (used for In-System Programming) P1. Port 2 also receives the high-order address bits and some control signals during Flash program-ming and verification. During accesses to external data memory that use 8-bit addresses (MOVX @ RI). they are pulled high by the inter-nal pull-ups and can be used as inputs. The Port 2 output buffers can sink/source four TTL inputs. Port 2 uses strong internal pull-ups when emitting 1s.1/T2EX). as shown in the follow-ing table.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control) P1. Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. P1. respectively. Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups.

This pin is also the program pulse input (PROG) during Flash programming. As inputs.3 INT1 (external interrupt 1) . the RESET HIGH out feature is enabled. Otherwise. With the bit set. When 1s are written to Port 3 pins. ALE operation can be disabled by setting bit 0 of SFR location 8EH. P3. In normal operation.0 RXD (serial input port) P3.2 INT0 (external interrupt 0) P3. Note. If desired. ALE is active only during a MOVX or MOVC instruction. that one ALE pulse is skipped dur-ing each access to external data memory. the pin is weakly pulled high. 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 drives high for 98 oscillator periods after the Watchdog times out. RST Reset input. Port 3 also serves the functions of various special features of the AT89S52.1 TXD (serial output port) P3. Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. A high on this pin for two machine cycles while the oscillator is running resets the device. The Port 3 output buffers can sink/source four TTL inputs. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. they are pulled high by the inter-nal pull-ups and can be used as inputs.Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. however. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. as shown in the fol-lowing table. In the default state of bit DISRTO. Port 3 receives some control signals for Flash programming and verification.

PSEN is activated twice each machine cycle.P3. except that two PSEN activations are skipped during each access to external data memory. When the AT89S52 is executing code from external program memory. and unoccupied addresses may not be imple-mented on the chip. Note. since they may be used in future . Read accesses to these addresses will in general return random data. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. User software should not write 1s to these unlisted locations. Note that not all of the addresses are occupied.4 T0 (timer 0 external input) P3. EA should be strapped to VCC for internal program executions. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 5-1. EA/VPP External Access Enable. XTAL1Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2Output from the inverting oscillator amplifier.6 WR (external data memory write strobe) P3. and write accesses will have an indeterminate effect. that if lock bit 1 is programmed. EA will be internally latched on reset. however.7 RD (external data memory read strobe) PSEN Program Store Enable (PSEN) is the read strobe to external program memory.5 T1 (timer 1 external input) P3. 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.

When set. EXEN2 Timer 2 external enable.products to invoke new features. T2CON – Timer/Counter 2 Control Register TF2 Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. EXF2 does not cause an interrupt in up/down counter mode (DCEN = 1). RCLK Receive clock enable. In that case. the reset or inactive values of the new bits will always be 0. Two priorities can be set for each of the six interrupt sources in the IP register. causes the serial port to use Timer 2 overflow pulses for its receive clock in serial port Modes 1 and 3. EXF2 Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and EXEN2 = 1. When set. TCLK Transmit clock enable. EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine. Interrupt Registers: The individual interrupt enable bits are in the IE register. When set. . TR2 Start/Stop control for Timer 2. RCLK = 0 causes Timer 1 overflow to be used for the receive clock. RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit autoreload mode. Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in Table 5. When Timer 2 interrupt is enabled. TCLK = 0 causes Timer 1 overflows to be used for the transmit clock.2) and T2MOD (shown in Table 10-2) for Timer 2. The register pair (RCAP2H. EXF2 must be cleared by software. TF2 will not be set when either RCLK = 1 or TCLK = 1. allows a capture or reload to occur as a result of a negative transition on T2EX if Timer 2 is not being used to clock the serial port. causes the serial port to use Timer 2 overflow pulses for its transmit clock in serial port Modes 1 and 3. TR2 = 1 starts the timer. EXEN2 = 0 causes Timer 2 to ignore events at T2EX.

Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. this bit is ignored and the timer is forced to auto-reload on Timer 2 overflow. AUXR: Auxiliary Register Dual Data Pointer Registers: To facilitate accessing both internal and external data memory. program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. When either RCLK or TCLK = 1.4) in the PCON SFR. The upper 128 bytes occupy a parallel address space to the Special Function Registers. When an instruction accesses an internal location above address 7FH. The user should ALWAYS initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. POF is set to “1” during power up. the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR . all program fetches are directed to external memory. It can be set and rest under software control and is not affected by reset. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX if EXEN2 = 1. Program MemoryIf the EA pin is connected to GND. CP/RL2 = 0 causes automatic reloads to occur when Timer 2 overflows or negative transitions occur at T2EX when EXEN2 = 1. if EA is connected to VCC. Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. Up to 64K bytes each of external Program and Data Memory can be addressed. On the AT89S52. C/T2 = 1 for external event counter (falling edge triggered). C/T2 = 0 for timer function. two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. CP/RL2 Capture/Reload select.C/T2 Timer or counter select for Timer 2. Data MemoryThe AT89S52 implements 256 bytes of on-chip RAM.

The WDT is defaulted to disable from exiting reset. the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. the following indirect addressing instruction. The WDT counter cannot be read or written. To enable the WDT. When WDT over-flows. For example. MOV @R0. When the WDT is enabled. it will generate an output RESET pulse at the RST pin. it will increment every machine cycle while the oscillator is running. The RESET pulse dura-tion is 98xTOSC. Watchdog Timer (One-time Enabled with Reset-out) The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. #data Note that stack operations are examples of indirect addressing. where TOSC = 1/FOSC. When the WDT is enabled. and this will reset the device. For example. where R0 contains 0A0H. When the WDT is enabled. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). Using the WDTTo enable the WDT. rather than P2 (whose address is 0A0H). a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H).space. Instructions which use direct addressing access the SFR space. the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). . it should be serviced in those sections of code that will periodically be executed within the time required to prevent a WDT reset. MOV 0A0H. To make the best use of the WDT. accesses the data byte at address 0A0H. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT timeout period is dependent on the external clock frequency. it will drive an output RESET HIGH pulse at the RST pin. so the upper 128 bytes of data RAM are available as stack space. #data Instructions that use indirect addressing access the upper 128 bytes of RAM. The 14-bit counter overflows when it reaches 16383 (3FFFH). it will increment every machine cycle while the oscillator is running. a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). This means the user must reset the WDT at least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1H to WDTRST. When WDT overflows. WDTRST is a write-only register.

it is best to reset the WDT just before entering Power-down mode. which means the WDT also stops.WDT During Power-down and Idle In Power-down mode the oscillator stops. servicing the WDT should occur as it normally does whenever the AT89S52 is reset. With WDIDLE bit enabled. the WDT will stop to count in IDLE mode and resumes the count upon exit from IDLE. Exiting Power-down with an interrupt is significantly different. the WDT is not started until the interrupt is pulled high. please click on the document link below: Timer 0 and 1Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the AT89C51 and AT89C52. The WDT keeps counting during IDLE (WDIDLE bit = 0) as the default state. There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt which is enabled prior to entering Power-down mode. the TL2 register is incremented every machine cycle. For further information on the timers’ operation. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 5-2). the user should always set up a timer that will periodically exit IDLE. To ensure that the WDT does not overflow within a few states of exiting Power-down. For further information on the UART operation. Timer 2 has three operating modes: capture. service the WDT. the interrupt is serviced. While in Power-down mode. The modes are selected by bits in T2CON. and baud rate generator. It is suggested that the WDT be reset during the interrupt service for the interrupt used to exit Power-down mode. The interrupt is held low long enough for the oscillator to stabilize. Since a machine cycle consists of 12 oscillator periods. UARTThe UART in the AT89S52 operates the same way as the UART in the AT89C51 and AT89C52. Before going into the IDLE mode. To prevent the WDT from resetting the device while the interrupt pin is held low. auto-reload (up or down counting). Timer 2 consists of two 8-bit registers. the user does not need to service the WDT. please click on the document link below: Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. and reenter IDLE mode. When the interrupt is brought high. the WDIDLE bit in SFR AUXR is used to determine whether the WDT continues to count if enabled. as shown in Table 10-1. the count rate is 1/12 of the oscil- . TH2 and TL2. When Power-down is exited with hardware reset. To prevent the WDT from resetting the AT89S52 while in IDLE mode. In the Timer function.

the maximum count rate is 1/24 of the oscillator frequency. the external input is sampled during S5P2 of every machine cycle. The EXF2 bit. two options are selected by bit EXEN2 in T2CON. can generate an interrupt. The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition. Both the TF2 and EXF2 bits can generate an interrupt if enabled. Timer 2 can count up or down. The overflow also causes the timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. If EXEN2 = 0. When the samples show a high in one cycle and a low in the next cycle. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. like TF2. If EXEN2 = 1. In the Counter function. a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input T2EX. Timer 2 performs the same operation. This transition also sets the EXF2 bit. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD (see Table 10-2). T2MOD – Timer 2 Mode Control Register Timer 2 automatically counting up when DCEN = 0. In this function. In this mode. the register is incremented in response to a 1-to-0 transition at its corre-sponding external input pin. the count is incremented. If EXEN2 = 0. When DCEN is set. This bit can then be used to generate an interrupt. the DCEN bit is set to 0 so that timer 2 will default to count up. The capture mode is illus-trated in Figure 10-1. To ensure that a given level is sampled at least once before it changes. the level should be held for at least one full machine cycle. If EXEN2 = 1.lator frequency. respectively. T2. Auto-reload (Up or Down Counter) Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. In addition. Upon reset. two options are selected by bit EXEN2 in T2CON. but a 1-to-0 transi-tion at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L. Setting the DCEN bit enables Timer 2 to count up . the transition at T2EX causes bit EXF2 in T2CON to be set. Capture ModeIn the capture mode. Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. depending on the value of the T2EX pin. Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon overflow.

A logic 0 at T2EX makes Timer 2 count down. Thus. it increments every machine cycle (at 1/12 the oscillator frequency). and the results of a read or write may not be accurate. A logic 1 at T2EX makes Timer 2 count up. The baud rate generator mode is similar to the auto-reload mode.or down. in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L. T2EX can be used as an extra external interrupt. the T2EX pin controls the direction of the count. In this operating mode. The underflow sets the TF2 bit and causes 0FFFFH to be reloaded into the timer registers. RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer. TL2). The timer underflows when TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. RCAP2L) to (TH2. Note too. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode. where (RCAP2H. Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode. as shown in Figure 10-2. The timer operation is different for Timer 2 when it is used as a baud rate generator. The timer will overflow at 0FFFFH and set the TF2 bit. Note that the baud rates for transmit and receive can be different if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other function. however. it is con-figured for timer operation (CP/T2 = 0). it increments every state time (at 1/2 the oscillator frequency). EXF2 does not flag an interrupt. Timer 2 as a baud rate generator is shown in Figure 11-1. a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H. The baud rate formula is given below. that if EXEN2 is set. Baud Rate Generator Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON (Table 5-2). This overflow also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer registers. This figure is valid only if RCLK or TCLK = 1 in T2CON. In this mode. which are preset by software. respectively. The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate according to the fol-lowing equation. Note that a rollover in TH2 does not set TF2 and will not generate an inter-rupt. the Timer is incremented every state time. TH2 or TL2 should not be read from or written to. because a write might overlap a . The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a 17th bit of resolution. The Timer can be configured for either timer or counter operation. as a timer. as shown in Figure 11-1. TH2 and TL2.As a baud rate generator. Under these conditions. In most applications. when Timer 2 is in use as a baud rate generator. Normally. The RCAP2 registers may be read but should not be written to.

since it may be used in future AT89 products. which disables all interrupts at once. and the serial port interrupt. This pin. It is possible to use Timer 2 as a baud-rate gen-erator and a clock generator simultaneously. Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1). Bit TR2 (T2CON. Nei-ther of these flags is cleared by hardware when the service routine is vectored to. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers. Timer 2 rollovers will not generate an interrupt. has two alternate functions.0. It can be programmed to input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz (for a 16-MHz operating frequency). Programmable Clock Out A 50% duty cycle clock can be programmed to come out on P1. besides being a regular I/O pin. EA.1) must be cleared and bit T2OE (T2MOD. In fact. Note.1) must be set. bit C/T2 (T2CON.reload and cause write and/or reload errors.2) starts and stops the timer. TF0 and TF1. as shown in Figure 12-1. In the clock-out mode. Note that Table 13-1 shows that bit position IE. three timer interrupts (Timers 0. RCAP2L). and 2). These interrupts are all shown in Figure 13-1. The Timer 0 and Timer 1 flags. This behavior is similar to when Timer 2 is used as a baudrate generator. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. however.6 is unimplemented. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. that the baud-rate and clock-out frequencies cannot be determined independently from one another since they both use RCAP2H and RCAP2L. 1. IE also contains a global disable bit. To configure the Timer/Counter 2 as a clock generator. are set at S5P2 of the cycle in which the timers overflow. The clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers (RCAP2H. as shown in the following equation. The . and that bit will have to be cleared in software. the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt. User software should not write a 1 to this bit position.

To drive the device from an external clock source. . since the input to the internal clock-ing circuitry is through a divide-by-two flip-flop. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset. the oscillator is stopped. up to two machine cycles before the internal reset algorithm takes control. Idle Mode In idle mode. the device normally resumes pro-gram execution from where it left off. The idle mode can be terminated by any enabled interrupt or by a hardware reset. but minimum and maximum voltage high and low time specifications must be observed. the instruction following the one that invokes idle mode should not write to a port pin or to external memory. of an inverting amplifier that can be configured for use as an on-chip oscillator. Exit from Power-down mode can be initiated either by a hardware reset or by an enabled external interrupt. Power-down Mode In the Power-down mode. Note that when idle mode is terminated by a hardware reset. However. is set at S2P2 and is polled in the same cycle in which the timer overflows. The content of the on-chip RAM and all the special functions regis-ters remain unchanged during this mode. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. Reset redefines the SFRs but does not change the on-chip RAM. Either a quartz crystal or ceramic resonator may be used. as shown in Figure 162. Oscillator Characteristics XTAL1 and XTAL2 are the input and output. The on-chip RAM and Special Function Registers retain their values until the Power-down mode is terminated. as shown in Figure 161.values are then polled by the circuitry in the next cycle. the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. the Timer 2 flag. and the instruction that invokes Power-down is the last instruction executed. TF2. On-chip hardware inhibits access to internal RAM in this event. XTAL2 should be left unconnected while XTAL1 is driven. but access to the port pins is not inhibited. respectively. There are no requirements on the duty cycle of the external clock signal.

Programming the Flash – Parallel Mode The AT89S52 is shipped with the on-chip Flash memory array ready to be programmed. Reading the Signature Bytes: The signature bytes are read by the same procedure as a nor-mal verification of locations 000H. The byte-write cycle is self-timed and typically takes no more than 50 μs. 2. and 200H. Input the desired memory location on the address lines. the address. data. To program the AT89S52. true data is valid on all outputs. Program Verify: If lock bits LB1 and LB2 have not been programmed. Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. The AT89S52 code memory array is programmed byte-by-byte. changing the address and data for the entire array or until the end of the object file is reached. Data Polling may begin any time after a write cycle has been initiated. 3. Once the write cycle has been completed. and control signals should be set up according to the “Flash Programming Modes” (Table 22-1) and Figure 22-1 and Figure 22-2. the programmed code data can be read back via the address and data lines for verification. and the next cycle may begin. Data Polling: The AT89S52 features Data Polling to indicate the end of a byte write cycle.6 and P3.7. P3. an attempted read of the last byte written will result in the complement of the written data on P0. Dur-ing a write cycle. take the following steps: 1. The values returned are as follows. 4. Programming Algorithm: Before programming the AT89S52.0 is pulled low after ALE goes high during programming to indicate BUSY. (000H) = 1EH indicates manufactured by Atmel (100H) = 52H indicates AT89S52 (200H) = 06H Chip Erase: In the parallel programming mode. Activate the correct combination of control signals. The programming interface needs a high-voltage (12volt) program enable signal and is compatible with conventional third-party Flash or EPROM programmers. Raise EA/VPP to 12V. Input the appropriate data byte on the data lines.0 is pulled high again when programming is done to indicate READY.7 must be pulled to a logic low. except that P3. 5. a chip erase operation is initiated by using the proper combination of control signals and by pulsing ALE/PROG low for a . Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The status of the individ-ual lock bits can be verified directly by reading them back. 100H. Repeat steps 1 through 5. P3.

Apply power between VCC and GND pins. RST can be set low to commence normal device operation. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1. b. Set XTAL1 to “L” (if a crystal is not used).7 needs to be less than the CPU clock at XTAL1 divided by 16. In this mode.6. Set RST to “L”. 5. Serial Programming Algorithm To program and verify the AT89S52 in the serial programming mode. MOSI (input) and MISO (output).500 ns. 4. In the serial programming mode.5. In this mode. The write cycle is self-timed and typically takes less than 0. The maximum serial clock (SCK) frequency should be less than 1/16 of the crystal frequency. Power-up sequence: a. 3. 2. During chip erase. 2. a chip erase operation is initiated by issuing the Chip Erase instruction. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO/P1. 3. If a crystal is not connected across pins XTAL1 and XTAL2. The serial interface consists of pins SCK. the Programming Enable instruction needs to be executed first before other operations can be executed. chip erase is self-timed and takes about 500 ms.5 ms at 5V. Power-off sequence (if needed): 1. a serial read from any address location will return 00H at the data output. The Code array is programmed one byte at a time in either the Byte or Page mode. After RST is set high. With a 33 MHz oscillator clock. Data Polling: The Data Polling feature is also available in the serial mode. the maximum SCK frequency is 2 MHz. . Set RST pin to “H”. apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. Either an external system clock can be supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. the following sequence is recommended: 1. At the end of a programming session. The frequency of the shift clock supplied at pin SCK/P1. Before a reprogramming sequence can occur. The Chip Erase operation turns the content of every memory location in the Code array into FFH. during a write cycle an attempted read of the last byte written will result in the complement of the MSB of the serial output byte on MISO.duration of 200 ns . Turn VCC power off. Programming the Flash – Serial Mode The Code memory array can be programmed using the serial ISP interface while RST is pulled to VCC. a Chip Erase operation is required.

but I’m not an electrical engineer.Basically what I want to know when I look at this document is: What transistor type do I need for my project? What resistors do I need to use with this transistor? How do I hook it up? . I would promptly forget the proper configuration for doingit. and I’ve have to look it all upagain next time. So every time used a transistor circuit in a project. A typicalexample is using a computer’s parallel port to turn some external device on.Serial Programming Instruction Set The Instruction Set for Serial Programming follows a 4-byte protocol Transistors as switches Introduction A key aspect of proper hacking is the use of transistors for switching things on and off. and I don’t claim to really remember anything learned in the past about what’s happening at the silicon level in a transistor.I assembled this document as a quick reference for myself. and I didn’t write verymuch of it myself. and everything I knew about which transistor type did what. to avoid this painful lookup in thefuture… notice I say “assembled”. this is basically a “google composite”. I used to do this allthe time.

The direction of the arrow on the emitter distinguishes the NPN from the PNP transistor. and an NPN's emitter “emitting” holes (positive charge). the . schematics like this : Transistors usually appear on To keep emitter notation straight. (Points iN) the transistor is a PNP. you can think of a PNP's emitter “emitting” electrons. The collector then “collects” current carriers (holes or electrons). If the arrow points in. The arrow in a schematic is always the emitter.Notation First some notation about transistor types and schematics. On the other hand if the arrow points out.

or on the back of the box if you buy them at Radio Shack. emitter. Conversely. so it’s much easier to switch the device’s ground than the device’s power. I can do this in two ways… I can connect the device’s ground to the world’s ground all the time. the three pins – base. clearly I can’t just power the device with my 3. The Darlington transistor (I mention this because it’s a term one comes across frequently. and switch the device’s ground connection on and off. If I’m using a 3.3V source and expect it to turn on. or from the P to N sections. Applications In my typical application.3V parallel port). and because sometimes you actually need to use one for switching applications) is really two BJT’s in one: Darlingtons can be used to yield very high amplification of a control current (since a Darlington's total gain is equal to the product of the gains of the two BJT transistors it is made from). the latter is typically preferable. I can connect power all the time. I want to turn some device on and off with some source of voltage (often the PC’s 3.transistor is an NPN (Not Pointing iN). no matter whether the P section is the emitter or base Notation aside. Another point you should keep in mind is that the arrow always points in the direction of hole (positive charge) flow.3V source to switch on and off – for example – a 12V or 9V device. collector – are typically labeled on the data sheet for a transistor. NPN . These are generally used for high-current loads. and turn the device’s power on and off. In practice.

This is intuitive to me. a logical “1” means “yes. Here’s a schematic: . since on the side of my computer or whatever. then connecting the base to high voltage (a little bit higher than ground) will switch ground to the device and start the current-a-flowing. I would make the following connections: Device power to whatever power source I want to use Device ground to the collector on my NPN transistor Transistor emitter to “real” ground My “switch” – whatever line I am able to control from my button or my computer or whatever – to transistor base If I make those connections. please let current pass”. In this case.transistors can be used to switch ground to a device.

read on if you want just a tad more intuition. HFE is defined as (load current / base current). a transistor is really a current amplifier). . which you typically get from the data sheet or the box your transistors came in Skip to equation (6) if you just want to know the magic formula. Resistor R1 controls the amount of switching current that goes to the device. and base current is the amount of current flowing from my switching line to ground. To compute a good value for R1. (remember. you need to know: The current you intend to send through your load The voltage you’ll be using to switch your transistor The HFE value for your transistor.Notice there are a couple of resistors also. where load current is the amount of current flowing through my device.

logic circuits. These integrated circuits are also made from transistors. indicators. bipolar and field-effect. and other devices used to communicate with the outside world. the large current flow is almost independent of the voltage across the transistor from collector to emitter. and collector (Figure 7. and so the behavior of logic devices depends upon the behavior of transistors. Introduction An electrical signal can be amplified by using a device which allows a small current or voltage to control the flow of a much larger current from a dc power source. Because op-amps are built from transistors. This makes it possible to obtain a large amplification of . while for field-effect transistors an input voltage provides the control. The current at the base is typically one hundredth of the collector-emitter current. single transistors are still important in many applications. the difference between these two types is that for bipolar devices an input current controls the large current flow through the device. The amplifier must accept input signals from a source impedance of 1 kand provide an undistorted output amplitude of 5 V when driving a 560 load.Transistor asAmplifiers Purpose The aim of this experiment is to develop a bipolar transistor amplifier with a voltage gain of minus 25. Transistors are the basic device providing control of this kind. and an enormous variety of other integrated circuits. base. must be based on an understanding of transistors. a detailed understanding of opampbehavior. In this experiment we will build a two-stage amplifier using two bipolar transistors. Very roughly. A small current into the base controls a large current flow from the collector to the emitter. A good understanding of transistor fundamentals is nevertheless essential. For experiments they are especially useful as interface devices between integrated circuits and sensors. In most practical applications it is better to use an op-amp as a source of gain rather than to build an amplifier from discrete transistors. The bandwidth should extend from below 100 Hz to above 1 MHz. particularly input and output characteristics. The three terminals of a bipolar transistor are called the emitter. In addition to the importance of transistors as components of op-amps. There are two general types of transistors. which are the basic elements of computers and other digital devices. We will learn in Experiments #9 and #10 about logic devices. Moreover.1).

1 Pin-out of 2N3904 and 1 k trimpot Theory CURRENT AMPLIFIER MODEL OF BIPOLAR TRANSISTOR From the simplest point of view a bipolar transistor is a current amplifier. 2. Figure 7. The emitter voltage precisely follows the base voltage but more current is available from the emitter. This can be cured by adding an emitter follower as a second stage. the collector current is proportional to the base current: IC = hFE IB. Under these conditions. We will begin by constructing a common emitter amplifier. which operates on this principle. and with a current flowing into the base. The base-emitter junction then acts like a forward-biased diode with an 0. An NPN transistor operates with the collector voltage at least a few tenths of a volt above the emitter voltage. It depends on collector current (see H&H Fig.78). The current flowing from collector to emitter is equal to the base current multiplied by a factor." a set of numbers that give a complete description of the small-signal properties of a transistor (see Bugg Section 17. The constant of proportionality is called hFE because it is one of the "hparameters.6 V drop: VB VE + 0. but the output is taken from the emitter.6V. A major fault of a single-stage common emitter amplifier is its high output impedance. The common emitter stage and the emitter follower stage are by far the most common transistor circuit configurations. It is important to keep in mind that hFE is not really a constant. In this circuit the control signal is again applied at the base.4). and it varies by 50% or more from device to .voltage by taking the output voltage from a resistor in series with the collector.

In the emitterfollowerstage the output (emitter) voltage is simply related to the input (base) voltage by a diode drop of about . and hence also through Rc. The first step is to fix the dc voltage of the base with a voltage divider (R1 and R2 in Figure 7. An ac signal of 1 volt amplitude on the input will therefore give an AC signal of 1 volt on the output. i. This will cause an ac current of 1volt/RE from the emitter to ground. the collector is usually tied to the positive supply voltage VCC. With the emitter voltage known.3).Emitter follower stage Common emitter stage Figure shows the two main transistor-based circuits we will consider. a 1 volt ac signal at the input will again cause a 1 volt ac signal at the emitter. For an emitter follower. the output just “follows” the input. Vout is therefore 15-Rc(1volt/RE) and we see that there is an ac voltage gain of – Rc/RE. The emitter voltage will then be 0.2b. the current flowing from the emitter is determined by the emitter resistor: IE = VE/RE.e.6 eV. In the common emitter stage of figure 7. Although we are only looking to amplify the AC signal. it is nonetheless very important to set up proper dc bias conditions or quiescent points. The only difference between biasing the emitter .6 V less than the base voltage. the advantage of this circuit is as a buffer due to a relatively high input and low output impedance. As we will see later.

Biased common emitter amplifier .follower and biasing the common emitter circuit is that the common emitter circuit always has a collector resistor. The collector resistor does not change the base or emitter voltage. but the drop across the collector resistor does determine the collector voltage: VC = VCC – ICRC.

INPUT AND OUTPUT IMPEDANCES The input impedance is the same for both emitter followers and common emitter stages. The common emitter stage. which means that the output can swing equal amounts above and below the quiescent point. The minimum output voltage occurs when the transistor saturates. then RC and RE stand for the ac impedances attached to the collector and emitter. Finally.There are three subtleties to keep in mind when biasing common-emitter or emitter-follower circuits. the quiescent point determines the voltages at which the output will clip. which happens when the collector voltage is no longer at least a few tenths of a volt above the emitter voltage.3). The voltage gain of the emitter follower stage is very close to unity. First of all. In our circuit we use CE to bypass part of the emitter resistor at the signal frequency. For a common emitter stage the maximum output voltage will be close to the positive supply voltage VCC. Another point to keep in mind is that when you fix the quiescent point by choosing the base divider ratio and the resistors RE and RC. This is essential because the base current depends on hFE and so is not a well determined quantity. in contrast. the divider impedance will be low enough when: R1 R2 R1R2 R1 R2 As we will see in a moment. If the base voltage is determined by a divider (as in Figure 7. Be careful that you do not exceed the maximum allowed power dissipation Pmax. this equation just says that the impedance seen looking into the divider (The Thevenin equivalent or R1||R2) should be much less that the impedance looking into the base. We usually try to design common emitter stages for symmetrical clipping. The input impedance looking into the base is . can have a large voltage gain: A RC/RE If we are interested in the ac gain. the base bias voltage must be fixed by a low enough impedance so that changes in the base current do not alter the base voltage. which may be different from the dc resistances. you are also fixing the dc power dissipation in the transistor: P = (VC – VE) IE.

rather than just that looking into the base. the transistor now acts as if it has a small internal resistor re in series with the emitter . The formula relating IC and VBE is called the Ebers-Moll equation. the Ebers-Moll model only modifies our current amplifier model in one important way. the emitter-follower base is connected to the collector of a common emitter stage. The dependence of IC on VBE is definitely not linear. EBERS-MOLL MODEL OF BIPOLAR TRANSISTOR A slightly more detailed picture of the bipolar transistor is required to understand what happens when the emitter resistor is very small. and it is discussed in H&H For our purposes. you will have to consider rin in parallel with the base bias resistors. For our two-stage amplifier shown in Figure 7. For small variations about the quiescent point. and so R is the output impedance of that stage. The output impedance of a common emitter stage is just equal to the collector resistor. rather it is a very rapid exponential function. which is equal to RC. one can take the view that the collector current IC is controlled by the base-emitter voltage VBE. The output impedance looking into the emitter of an emitter follower is given by routR/hFE1 Now R stands for whatever impedance is connected to the base.5. If you want the input impedance of the whole stage. Instead of using the current amplifier model.rinhFE1R In this expression R is whatever impedance is connected to the emitter. R would usually just be the emitter resistor. For a common emitter. but for an emitter follower R might be the emitter resistor in parallel with the input impedance of the next stage.

The most important of these results is the modified Equation (2) A RCRE re which shows that the common emitter gain does not go to infinity when the external emitter resistor goes to zero. Instead the gain goes to the finite value A = –RC / re. Compare the measured maximum gain with the value predicted in the homework . and for Equation (3) we need to substitute R R + re. Equation (4) is modified to read routR/hFE1)re . Verify that the quiescent point has not changed significantly. and our formulas for the ac gain are not correct. Start with the contact at ground (bottom of diagram) and move it up until CE bypasses all of RE. Observe the change in gain as you traverse the full range of the trimpot using 10 kHz sine waves. When approaching maximum gain turn down the input amplitude (a long way) so that the output signals are still well shaped sine waves. The presence of the intrinsic emitter resistance re modifies the above Equations (1) – (4). In Equations (1) and (2) we should substitute RE RE +25 1 mA/Ic)   The magnitude of the intrinsic emitter resistance re dependes on the collector current IC.0 k trimpot RE through the bypass capacitor CE to ground. If the output is distorted the amplifier is not in its linear regime. COMMON EMITTER AMPLIFIER–VARIABLE GAIN Connect the wiper of the 1.

the emitter "follows" the base voltage. What fraction of the original output amplitude do you see? Is this as expected? Remove the 1 k resistor before the next test so that you test only one thing at a time. Do not connect the 560 load to the output yet. the input signal is applied to the base of the transistor. so a direct dc connection can be made between the two circuits. The emitter follower has unit gain. Ordinarily the quiescent base voltage is determined by a bias circuit. the base to be at the collector voltage of . Carry out appropriate dc diagnostic tests. Connect a 560 load from the output to ground.e. This time we expect the collector to be at +15 V. i.for several output amplitudes going down by factors of two. In the present case the collector voltage VC of the previous circuit already has a value suitable for biasing the follower. (To see where the trimpot is set.5. Do theory and experiment tend to converge as Vout tends to zero? COMMON EMITTER AMPLIFIER: INPUT AND OUTPUT IMPEDANCE Set the amplifier gain to –25 for 10 kHz sine waves. The input impedance is high and the output impedance is low.) Simulate the required source impedance by inserting a 1 kresistor in series with the input. Assemble the emitter follower circuit shown in Figure 7. What fraction of the original output do you now see? Is this as expected? EMITTER FOLLOWER OUTPUT STAGE In the emitter follower circuit. What trimpot setting gives a gain of –25?. remove it from the circuit and measure the resistance from cw to wiper or from ccw to wiper. but the output is taken from the emitter.

whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. it has very low self-heating. less than 0. and the emitter to be about 0. (Again you may need to add a 220 kresistor to ground after Cout to keep the dc level at the scope input near ground. and precise inherent calibration make interfacing to readout or control circuitry especially easy. Observe the ac amplitudes at the input of the emitter follower and at the output. Attach a 560 load from the output to ground. Measure the ac gain of the emitter follower stage.the first stage. The LM35 is rated to operate over a -55° to +150°C temperature range. Confirm that the voltage gain of the emitter follower is unity. As it draws only 60 µA from its supply. The LM35D is also available in an 8-lead surface mount small outline package and a plastic TO-220 package. while the LM35C is rated for a -40° to +110°C range (-10° with improved accuracy). linear output.) You may want to put the scope on ac coupling when you probe points with large dc offsets. as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35's low output impedance. It can be used with single power supplies. 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 series is available packaged in hermetic TO-46 transistor packages. or with plus and minus supplies. TEMPERATURE SENSOR-LM35D: The LM35 series are precision integrated-circuit temperature sensors. Drive the complete system with the function generator. What fraction of the unloaded output do you now see? Compare with your calculations. LM35CA.1°C in still air. while the LM35C. Low cost is assured by trimming and calibration at the wafer level.6 V below the collector. The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin. Correct any problems before moving on. and LM35D are also available in the plastic TO-92 transistor package. .

08°C in still air Nonlinearity only ± 1/4°C typical Low impedance output.1 for 1 mA load Typical Applications DS005516-4 DS005516-3 FIGURE 1. 0. Basic Centigrade Temperature Sensor (+2°C to +150°C) Choose R1 = -VS/50 µA V OUT = +1.500 mV at +150°C = +250 mV at +25°C = -550 mV at -55°C FIGURE 2. 0. Full-Range Centigrade Temperature Sensor .Features Calibrated directly in ° Celsius (Centigrade) Linear + 10.0 mV/°C scale factor 0.5°C accuracy guaranteeable (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.

and telephones. LCs do not emit light directly. signage. They are usually more compact.[1] By 2008. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. lightweight. They are available in a wider range of screen sizes than CRT and plasma displays. They are used in a wide range of applications including: computer monitors. less expensive. etc. LCDs have displaced cathode ray tube(CRT) displays in most applications. flat electronic visual display that uses the light modulating properties of liquid crystals (LCs).LCD DISPLAY: A liquid crystal display (LCD) is a thin. They are common in consumer devices such as video players. the axes of transmission of which are (in most of the cases) . instrument panels. worldwide sales of televisions with LCD screens had surpassed the sale of CRT units. gaming devices. aircraft cockpit displays. and since they do not use phosphors. LCDs are more energy efficient and offer safer disposal than CRTs. and two polarizing filters. Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes. more reliable. calculators. television. the discovery of liquid crystals. The earliest discovery leading to the development of LCD technology. they cannot suffer image burn-in. watches. and easier on the eyes. dates from 1888. clocks. portable. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in colour or monochrome.

Typical uses of buzzers and beepers include alarms.[citation needed] The surface of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction. timers and confirmation of user input such as a mouse click or keystroke. a ring or a beep. Electrodes are made of a transparent conductor called Indium Tin Oxide (ITO). The direction of the liquid crystal alignment is then defined by the direction of rubbing. for example. Sounds commonly used to indicate that a button has been pressed are a click. RESET SWITCH: It is used to reset the lcd display screen such that the new readings can be taken. or electronic.perpendicular to each other. BUZZER: A buzzer or beeper is an audio signaling device. which may be mechanical. electromechanical. In most of the cases the liquid crystal has double refraction. A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal source. With no actual liquid crystal between the polarizing filters. This treatment typically consists of a thin polymer layer that is unidirectionally rubbed using. . Electronic buzzers find many applications in modern days. light passing through the first filter would be blocked by the second (crossed) polarizer. a cloth.

It can also be referred to as a photoconductor. Lead sulfide (PbS) and indium antimonide (InSb) LDRs (light dependent resistor) are used for the mid infrared spectral region. . street lights. there will be extra electrons available for conduction.Aphotoresistor is made of a high resistance semiconductor. thereby lowering resistance. Photoresistors come in many different types. Ge:Cu photoconductors are among the best far-infrared detectors available.LDR(LIGHT DEPENDENT RESISTOR): A photoresistor or light dependent resistor or cadmium sulfide (CdS) cell is a resistor whose resistance decreases with increasing incident light intensity. also called dopants.e. The resulting free electron (and its hole partner) conduct electricity. photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. and outdoor clocks. In intrinsic devices the only available electrons are in the valence band. silicon. An intrinsic semiconductor has its own charge carriers and is not an efficient semiconductor. since the electrons do not have as far to jump. Inexpensive cadmium sulfide cells can be found in many consumer items such as camera light meters. They are also used in some dynamic compressors together with a small incandescent lamp or light emitting diode to control gain reduction. If light falling on the device is of high enough frequency. If a sample of silicon has some of its atoms replaced by phosphorus atoms (impurities). added whose ground state energy is closer to the conduction band. Extrinsic devices have impurities. Transducers are used for changing energy types. and hence the photon must have enough energy to excite the electron across the entire bandgap. lower energy photons (i. longer wavelengths and lower frequencies) are sufficient to trigger the device.g. e.. alarms. This is an example of an extrinsic semiconductor. and are used for infrared astronomy and infrared spectroscopy. clock radios. A photoelectric device can be either intrinsic or extrinsic.

LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output. The compact size of LEDs has allowed new text and video displays and sensors to be developed. LEDs are used as indicator lamps in many devices. while their high switching rates are useful in advanced communications technology. electrons are able to recombine with holes within the device. An LED is usually small in area (less than 1 mm2). This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. longer lifetime. improved robustness. Infrared LEDs are also used in the remote control units of many commercial products including televisions. automotive lighting (particularly indicators) and in traffic signals. smaller size. and other . ultraviolet and infrared wavelengths.[2] early LEDs emitted low-intensity red light. releasing energy in the form of photons. and integrated optical components are used to shape its radiation pattern and assist in reflection. and are increasingly used for lighting. Introduced as a practical electronic component in 1962.[3] LEDs present many advantages over incandescent light sources including lower energy consumption. but modern versions are available across the visible. Light-emitting diodes are used in applications as diverse as replacements for aviation lighting. DVD players. and greater durability and reliability.LED(LIGHT EMITTING DIODE): A light-emitting diode (LED) (pronounced /ˌɛl iː ˈdiː/[1]) is a semiconductor light source.When a light-emitting diode is forward biased (switched on). with very high brightness. faster switching.

Angle of half sensitivity = 25_ . Standard T–1 (ø 3 mm ) clear plastic package 4. PHOTO TRANSISTOR:NTE3037 Description: BPW85 is a high speed and high sensitive silicon NPN epitaxial planar phototransistor in a standard T–1 (ø 3 mm) plastic package.Fast response times 2. Features 1. Axial terminals 5. High photo sensitivity 3.domestic appliances. The viewing angle of 25_ makes it insensible to ambient straylight. Due to its waterclear epoxy the device is sensitive to visible and near infrared radiation.

6. . Suitable for visible and near infrared radiation Applications Detector in electronic control and drive circuits SWITCHES: Normal on and off switches are used for the purpose of calling system and when the patient presses one of these switches which is connected to microcontroller and this makes the buzzer to give the alarm sound and make a display on the lcd screen.

sbit s3=P3^3. sbit buzz=P2^0. sbit respiration rate=P1^5. sbit heart rate=P2^7. unsigned char name[]="water. unsigned char class[]=“Emergency". sbitrw=P1^1. sbit s2=P3^2. sbit s1=P3^1. void delay(void).Software details: #include<reg51. void main() { unsignedint i=0. sbit saline status=P3^4. sbit en=P1^2. sbit s0=P3^0. .0". voidlcddata(unsigned char). sfrldata=0x80.h> voidlcdcmd(unsigned char). sbitrs=P1^0.

void delay(n). unsigned char stmt[]=“need assistance".min. } lcdcmd(0x85).0x0e.i++) { lcddata(name[i]).name[i]!='0'.i++) { lcdcmd(cmd[i]).0x38. voidinitializelcd().sec. unsigned char stmt1[]=“saline empty".r.0}.unsigned char cmd[]={0x01.t2. buzz=1. for(i=0. while(1) { if(s0==0) { if(s0==0) buzz=0.cmd[i]!=0.0x06.t1. delay(). unsigned char bt. for(i=0.0x80. buzz=0.sec100. .

i++) { lcdcmd(cmd[i]). for(i=0.class[i]!='0'.cmd[i]!=0.i++) { lcdcmd(cmd[i]). . } for(i=56.cmd[i]!=0.i++) { lcddata(class[i]).} } if(s1==0) { for(i=0.i<87. } lcdcmd(0xC3).i++) { lcddata(i). } } if(s2==0) { for(i=0.

i++) { lcddata(stmt[i]). for(i=0.cmd[i]!=0.i++) { . for(i=0.i++) { lcdcmd(cmd[i]). } lcdcmd(0x80).i++) { lcdcmd(cmd[i]).stmt1[i]!='0'. } } if(s4==0) { for(i=0.cmd[i]!=0.} } if(s3==0) { for(i=0.stmt[i]!='0'. } lcdcmd(0x80).

lcddata(stmt1[i]). } voidlcddata(unsigned char a) { ldata=a. . return. en=1. en=1. rs=0. rw=0. rs=1. delay(). en=0. rw=0. } } } } voidlcdcmd(unsigned char a) { ldata=a. delay(). delay().

i++) { for(j=0. "). t1=0.t2=0.R. delay(1000).j=0.j++). delay(1500).delay(). for(i=0.0). delay(500). //delay(15000).M. printlcd("Welcome to H. return.i<5. gotoxy(0. en=0. } void delay() { unsignedint i=0. initializelcd().j<100. while(1) { . } } delay(1000).

min=0. } } } . lcd_send_byte((r/10)+48.1). lcd_send_byte((bt/100)+48. delay(500).if(min>=1) { gotoxy(0.1). bt=t1.1).1). lcd_send_byte((r%10)+48. r=bt%100. delay(500).

SOFTWARE EXECUTION: Software execution part of our project is being done on the keil software and the dumping of the program into the microcontroller is done with the help of micro flash software and the execution of the program is done in the following steps: STEP 1: Starting a new project as shown in the figure .

STEP2:Creating a new file and saving it as shown .

STEP3:Choosing the family of micro controller which in our case is “ATMEL” as shown .

0592 hz in our project. .STEP 4:Setting the frequency for the micro controller as shown which is 11.

STEP 5:Now pasting the project program in the project and save as shown .

STEP 6:Now the saved program is add to the source group which is present in the new project .

STEP 7:Executing the saved program as shown .

STEP 8:After executing the program successfully it should be dumped into the micro controller as shown in the figure .

STEP 9:Now after the micro flash software is opened then the successfully executed program
is loaded into it as shown.

The program will be stored in the form of hex file and this hex file is loaded into this software

STEP 10:After the program is loaded then when the icon program is clicked then program will
get dumped into the micro controller and after getting dumped a message box will be displayed
with a message that the program is dumped successfully as shown

The outputs for the inputs are as follows:

Output on the kit

Output for 1st switch

Output for 2nd switch

Output for 3rd switch OUTPUT FOR SALINE STATUS: .

So these are the outputs which are achieved in our project. .The outputs for the parameters can be directly seen on the kit and the above other important things like the patient calling system and the saline status are not only displayed on the lcd display but also are connected to a buzzer which gives an alarm sound or a beep sound and warns the hospital staff that the patient is in need of some help from the staff.

Such a package would contain the circuiting for inputs from ECG sensors.FUTURE ENHANCEMENTS The human body scanning system could be made more sophisticated by incorporating blood pressure and EEG sensors. EEG sensors. This wearable module can transmit the data continuously over a fiber optic link or through an internet digital radio. The received data can be stored in separate memory and be processed by a microcontroller. pressure measurement and pulse rate transducers. Hospitable –wide wireless capability would allows doctor to occur the patients’ database using their word held computers. The analog channel inputs AN4 and AN7 can be used and the Port B can be programmed as an input port along with an additional ADC chip in the external circuit. This enhancement will enable monitoring of patients to be more flexible and strain-free . The entire medical data acquisition could be made wireless and wearable.

2.ADVANTAGES AND DISADVANTAGES This Project which demonstrates an automated patient monitoring system has its own merits and demerits which are discussed below: Merits: 2. 5.The ECG amplifier needs a high CMRR and additional narrowband filters are necessary to attenuate effects of mains and noise interference.With online recoding of medical parameters. 3.The clinical information database contains all data regarding the patients in electronic form.The wireless alert system using WAP notifies physicians of critical results on their cellular phones. the workload of the case providers and the nursing staff is reduced. .The patient call switches help emergency situations to be handled quickly. Future enhancements can be easily implemented with the PLC controller.The heart beat sensor is highly temperature dependent and the dynamic characteristics change with different levels of ambient light and temperature level. 4. De-Merits: 1.

.CONCLUSION: Hence an attempt is made to design a device which not only acts as an alarm system but also can measure the parameters of the body and the attempt made is successful.

Pleiffer 3.VISUAL BASIC---.BIBLOGRAPHY 1. 6. A. Bio-Medical Instrumentation and measurements - Leslie Cromwell - Fred.Khandpur 2. Linear Integrated Circuits - Roy Chowdary 4. IBM PC Handbook - IBM Corporation - Gary Cornel 5. Handbook of Bio-Medical Instrumentation - R.Ground Up . www. Wejnbell - Erich .S.microchip.