Automated Walker with Patient Monitoring Mechanism
By
Kailash Kumar Jain Munoth
A Report
Presented to the Faculty of
Assistive Technology Lab
Padmasri Dr. B. V. Raju Institute of Technology
Under the Supervision of Professor Jayshree Das
Narsapur, Medak, India
December, 2013
Chapter 1: Introduction
1.1 SCOPE
Walkers are currently available for use by persons having walking difficulties devices. These
devices are normally constructed as four-legged, open-bottomed, self-standing structures that a
person can approach and stand within for at least partial support while holding on during the
taking of walking steps. Examples of typical walker devices of this kind are shown in U.S. Pat. Nos.
2,708,473 and 3,354,893. The persons using the device picks it up, places it on the ground a
distance of several steps in front of him, and then walks to it while holding on for support.
While this procedure is satisfactory for some people, it requires a person to bend or lean forward
to place the walker device in front of him and then to walk to the device while holding on to it in
such bent position. This is very difficult or impossible for many people with walking problems and
does not provide a normal walking position wherein a person strengthens the muscles necessary to
walk normally without the walker. Not only that it requires a person to do some work in lifting the
walker. This could be difficult for persons with limb problems. Thus, the conventional walker
cannot be used by some, and, for many by whom it can be used, it is merely an aid to getting
around but does not provide therapy to rehabilitate the person. Further, some people using
conventional walkers are very weak and find it difficult to walk any distance, even with the help
provided by the walker.
Therefore an automated walker has been designed to overcome the drawbacks in
conventional walker. A conventional walker is provided with motors to make it automated. It is
provided with a joystick mechanism to move it in the desired direction, that is forward or backward
without any strain/stress on the patient.
We added a special feature of heart beat sensor to this automated walker. Heart beat
sensor is a device which is used to monitor the heart rate of the person using the walker. This helps
him to be cautious and to have a up to date analysis of his health. This would be mostly helpful for
senior citizens with walking disabilities. Thus we named our project as automated walker with
patient monitoring mechanism.
1.2 SCHEMATIC DIAGRAM
Schematic diagram of heart beat sensor
Chapter 2: CIRCUIT DESCRIPTION
Design
The main intention of this project is to design an AUTOMATED WALKER WITH PATIENT
MONITORING MECHANISM using motors and heart beat sensors. In order to fulfill this
application, there are few steps that have been performed i.e.
• Designing the power supply for the entire circuitry.
• Selection of microcontroller that suits our application.
• Designing of heart beat sensor
• Selection of motors
• Selection of wheels
Complete studies of all the above points are useful to develop this project.
2.1 Power Supply Section
In order to work with any components basic requirement is power supply. In this section
there is a requirement of a 5V DC power supply.
Now the aim is to design the power supply section which converts 230V AC in to 5V
DC. Since 230V AC is too high to reduce it to directly 5V DC, therefore we need a step-down
transformer that reduces the line voltage to certain voltage that will help us to convert it in to
a 5V DC. Considering the efficiency factor of the bridge rectifier, we came to a conclusion to
choose a transformer, whose secondary voltage is 3 to 4 V higher than the required voltage
i.e. 5V. For this application 0-9V transformers is used, since it is easily available in the market.
The output of the transformer is 9V AC; it feed to rectifier that converts AC to pulsating
DC. As we all know that there are 3 kind of rectifiers that is
• half wave
• Full wave and
• Bridge rectifier
Here we short listed to use Bridge rectifier, because half wave rectifier has less
efficiency. Even though the efficiency of full wave and bridge rectifier are the same, there is
no requirement for any negative voltage for our application. Hence it is appropriate to choose
a bridge rectifier.
Since the output voltage of the rectifier is pulsating DC, in order to convert it into pure
DC we use a high value (1000UF/1500UF) of capacitor in parallel that acts as a filter. The
easiest way to regulate this voltage is by using a 7805 voltage regulator, whose output voltage
is constant 5V DC irrespective of any fluctuation in line voltage.
2.2 Selection of Microcontroller
As we know, there so many types of microcontroller families are available in the market.
Those are: 8051 Family, AVR microcontroller Family, PIC microcontroller Family and ARM Family
Basic 8051 microcontrollers are enough for our application; hence we are not concentrating
on higher end controller families. In order to fulfill our application AT89S52 microcontroller is
enough. There are minimum requirements for proper operation of microcontroller.
Microcontroller based heartbeat monitor with LCD display IR led and LDR based
heartbeat monitor with display on computer and microcontroller LCD display. The heart rate
meter is used to measure the heart beats per minute from finger placing between the sensor.
The sensor is made of simple photo resistor and LED. The pulses from the circuit are them
amplified and converted into TTL logic pulses using comparator Operational Amplifier.
2.3 Circuit Operation
The IR sensors placed in the transmitter unit gives data to the HT12E encoder which
converts the analog data into digital form. This data is given to the RF transmitter which
transmits the same. In the receiver unit, the RF signal can be detected by the RF receiver. The
data is processed by the microcontroller (AT89S52) and a control signal is given to the buzzer
which alerts the user immediately in case of a possible accident.
Chapter 3: Literature
3.1 Introduction to Embedded Systems
Embedded systems are electronic devices that incorporate microprocessors within their
implementations. The main purpose of the microprocessors is to simplify the system design and
provide flexibility. Having a microprocessor in the device helps in removing the bugs, making
modifications, or adding new features and is only a matter of rewriting the software that
controls the device. In other words embedded computer systems are electronic systems that
include a microcomputer to perform a specific dedicated application. The computer is hidden
inside these products. Embedded systems are ubiquitous. Every week millions of tiny computer
chips come pouring out of factories finding their way into our everyday products.
Embedded systems are self-contained programs that are embedded within a piece of
hardware. While a regular computer has many different applications and software that can be
applied to various tasks, embedded systems are usually set to a specific task that cannot be
altered without physically manipulating the circuitry. Another way to think of an embedded
system is a computer system that is created with optimal efficiency, thereby allowing it to
complete specific functions as quickly as possible.
Embedded systems designers usually have a significant grasp of hardware technologies.
They use specific programming languages and software to develop embedded systems and
manipulate the equipment. When searching online, companies offer embedded systems
development kits and other embedded systems tools for use by engineers and businesses.
Embedded systems technologies are usually fairly expensive due to the necessary
development time and built in efficiencies, but they are also highly valued in specific industries.
Smaller businesses may wish to hire a consultant to determine what sort of embedded systems
will add value to their organization.
3.1.1 Characteristics
Two major areas of differences are cost and power consumption. Since many embedded
systems are produced in tens of thousands to millions of units range, reducing cost is a major
concern. Embedded systems often use a (relatively) slow processor and small memory size to
minimize costs.
The slowness is not just clock speed. The whole architecture of the computer is often
intentionally simplified to lower costs. For example, embedded systems often use peripherals
controlled by synchronous serial interfaces, which are ten to hundred times slower than
comparable peripherals used in PCs. Programs on an embedded system often run with real-
time constraints with limited hardware resources: often there is no disk drive, operating
system, keyboard or screen. A flash drive may replace rotating media, and a small keypad and
LCD screen may be used instead of a PC's keyboard and screen.
Firmware is the name for software that is embedded in hardware devices, e.g. in one or
more ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain
100% reliability while running continuously for long periods, sometimes measured in years.
Firmware is usually developed and tested to reach requirements than is general-purpose
software, which can usually be easily restarted if a problem occurs.
3.2 Introduction to Microcontroller
Microcontrollers as the name suggests are small controllers. They resemble single chip
computers that are often embedded into other systems to function as processing/controlling
unit. For example the remote control you are using has microcontrollers inside it that do
decoding and other controlling functions. They are also used in automobiles, washing machines,
microwave ovens, toys, etc., where automation is needed.
Microcontrollers are re useful to the extent that they communicate with other devices,
such as sensors, motors, switches, keypads, displays, memory and even other microcontrollers.
Many interface methods have been developed over the years to solve the complex problem of
balancing circuit design criteria such as features, cost, size, weight, power consumption,
reliability, availability, and manufacturability.
Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic
form, a microcontroller system can be viewed as a system that reads from (monitors) inputs,
performs processing and writes to (controls) outputs.
Embedded system means the processor is embedded into the required application. An
embedded product uses a microprocessor or microcontroller to do one task only. In an
embedded system, there is only one application software that is typically burned into ROM.
Example: printer, keyboard, video game player.
Microprocessor - A single chip that contains the CPU
Microcontroller - A single chip that contains CPU, I/O ports, memory, timers, serial port, ADC,
DAC etc, and is used to control other devices.
Microcontroller differs from a microprocessor in many ways. First and the most
important is its functionality. In order for a microprocessor to be used, other components such
as memory, or components for receiving and sending data must be added to it. In short that
means that microprocessor is the very heart of the computer. On the other hand,
microcontroller is designed to be all of that in one. No other external components are needed
for its application because all necessary peripherals are already built into it. Thus, we save the
time and space needed to construct devices.
3.2.1 Microprocessor VS Microcontroller
Microprocessor:
• CPU is stand-alone, RAM, ROM, I/O, timer are separate
• Designer can decide on the amount of ROM, RAM and I/O ports.
• Expensive
• Versatile and general-purpose
Microcontroller:
• CPU, RAM, ROM, I/O and timer are all on a single chip
• Fixed amount of on-chip ROM, RAM, I/O ports
• For applications in which cost, power and space are critical
• Single-purpose
3.3 Introduction to Kiel Software
Many companies provide the 8051 assembler; some of them provide shareware version
of their product on the web of which Kiel is one. We can download them from their websites.
However, the size of code for these shareware versions is limited and we have to consider
which assembler is suitable for our application.
Kiel uVision 2:
This is an IDE (Integrated Development Environment) that helps you write,
compile, and debug embedded programs. It encapsulates the following components:
• A project manager
• A make facility
• Tool configuration
• Editor
• A powerful debugger
Building an Application in uVision 2:
To build (compile, assemble, and link) an application in uVision2, you must:
• Select Project–Open Project
(For example, \C166\EXAMPLES\HELLO\HELLO.UV2)
• Select Project - Rebuild all target files or Build target. UVision2 compiles, assembles, and
links the files in your project.
Creating an Application:
To create a new project in uVision2, you must:
• Select Project - New Project.
• Select a directory and enter the name of the project file.
• Select Project - Select Device and select an 8051, 251, or
C16x/ST10 device from the Device
• Database
• Create source files to add to the project.
• Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and
add the source files to the project.
• Select Project - Options and set the tool options. Note when you select the
target device from the Device Database all-special options are set automatically. You only need
to configure the memory map of your target hardware. Default memory model settings are
optimal for most.
Applications:
• Select Project - Rebuild all target files or Build target.
Debugging an Application in uVision 2:
To debug an application created using uVision2, you must:
• Select Debug - Start/Stop Debug Session.
• Use the Step toolbar buttons to single-step through your program. You may enter G,
main in the Output Window to execute to the main C function.
• Open the Serial Window using the Serial #1 button on the toolbar.
• Debug your program using standard options like Step, Go, Break, and so on.
Limitation of Evaluation Software:
The following limitations apply to the evaluation versions of the C51, C251, or C166 tool
chains. C51 Evaluation Software Limitations:
• The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code but
source Code may be any size. Programs that generate more than 2 Kbytes of object code
will not compile, assemble, or link the startup code generated includes LJMP's and
cannot be used in single-chip devices supporting Less than 2 Kbytes of program space
like the Philips 750/751/752.
• The debugger supports files that are 2 Kbytes and smaller.
• Programs begin at offset 0x0800 and cannot be programmed into single-chip devices.
• No hardware support is available for multiple DPTR registers.
• No support is available for user libraries or floating-point arithmetic.
Evaluation Software:
• Code-Banking Linker/Locator
• Library Manager.
• RTX-51 Tiny Real-Time Operating System
Peripheral Simulation:
The u vision2 debugger provides complete simulation for the CPU and on chip
peripherals of most embedded devices. To discover which peripherals of a device are
supported, in u vision2, we can select the Simulated Peripherals item from the Help menu.
3.4 Introduction of Light Emitting Diode (LED)
A light-emitting diode (LED) is a semiconductor diode that emits incoherent
narrow spectrum light when electrically biased in the forward direction of the pn-junction, as in
the common LED circuit. This effect is a form of electroluminescence.
While sending a message in the form of bits such as 1,the data is sent to the
receiver side correspondingly the LED glows representing the data is being received
simultaneously when we send 8 as a data the LED gets off .
Figure 3.1 Light Emitting Diode
As in the simple LED circuit, the effect is a form of electroluminescence where incoherent and
narrow-spectrum light is emitted from the p-n junction.
LED’s are widely used as indicator lights on electronic devices and increasingly in higher
power applications such as flashlights and area lighting. An LED is usually a small area (less than
1 mm2) light source, often with optics added to the chip to shape its radiation pattern and assist
in reflection. The color of the emitted light depends on the composition and condition of the
semi conducting material used, and can be infrared, visible, or ultraviolet. Besides lighting,
interesting applications include using UV-LED’s for sterilization of water and disinfection of
devices, and as a grow light to enhance photosynthesis in plants.
Color Coding:
COLOR POTENTIAL DIFFERENCE
Infrared 1.6V
Red 1.8V to 2.1V
Orange 2.2V
Yellow 2.4V
Green 2.6V
Blue 3.0V to 3.5V
White 3.5V
Table 3.1 Color coding
Advantages:
• LED’s have many advantages over other technologies like lasers. As compared to laser
diodes or IR sources
• LED’s are conventional incandescent lamps. For one thing, they don't have a filament
that will burn out, so they last much longer. Additionally, their small plastic bulb makes
them a lot more durable. They also fit more easily into modern electronic circuits.
• The main advantage is efficiency. In conventional incandescent bulbs, the light-
production process involves generating a lot of heat (the filament must be warmed).
Unless you're using the lamp as a heater, because a huge portion of the available
electricity isn't going toward producing visible light.
• LED’s generate very little heat. A much higher percentage of the electrical power is
going directly for generating light, which cuts down the electricity demands
considerably.
• LED’s offer advantages such as low cost and long service life. Moreover LED’s have very
low power consumption and are easy to maintain.
Disadvantages of LEDs:
• LED’s performance largely depends on the ambient temperature of the operating
environment.
• LED’s must be supplied with the correct current.
• LED’s do not approximate a "point source" of light, so cannot be used in applications
needing a highly collimated beam.
But the disadvantages are quite negligible as the negative properties of LED’s do not apply and
the advantages far exceed the limitations.
Chapter 4: Component Description
4.1 Microcontroller 8051
Features:
• 8051 have 128 bytes of RAM
• 8051 have 128 user defined flags
• It consist of 16 bit address bus
• It also consist of 3 internal and two external interrupts
• less power usage in 8051 with respect to other micro-controller
• It consist of 16-bit program counter and data pointer
• 8051 can process 1 million one-cycle instructions per second
• It also consist of 32 general purpose registers each of 8 bits
• ROM on 8051 is 4 Kbytes in size
• It also consist of Two 16 bit Timer/ Counter
Description:
A microcontroller is an economical computer-on-a-chip built for dealing with specific tasks,
such as displaying or receiving information through LEDs or remote controlled devices. The
most commonly used set of microcontrollers belong to 8051 Family. 8051 Microcontrollers
continue to remain a preferred choice for a vast community of hobbyists and professionals.
Through 8051, the world became witness to the most revolutionary set of microcontrollers.
Intel fabricated the original 8051 which is known as MCS-51. The other two
members of the 8051 family are:
i. 8052 – This microcontroller has 256 bytes of RAM and 3 timers. In addition to the standard
features of 8051, this microcontroller has an added 128 bytes of RAM and timer. It has 8K bytes
of on chip program ROM. The programs written for projects using 8051 microcontroller can be
used to run on the projects using 8052 microcontroller as 8051 is a subset of 8052.
ii. 8031 – This microcontroller has all the features of 8051 except for it to be ROM-less. An
external ROM that can be as large as 64 K bytes should be programmed and added to this chip
for execution. The disadvantage of adding external ROM is that 2 ports (out of the 4 ports) are
used. Hence, only 2 ports are left for I/O operations which can also be added externally if
required for execution.
Comparison of 8051 family members:
Features 8051 8052 8031
RAM(bytes) 128 256 128
ROM 4K 8K 0K
Timers 2 3 2
Serial port 1 1 1
I/O pins 32 32 32
Interrupt sources 6 8 6
Pin Diagram - 8051:
Figure 4.1 Pin Diagram of 8051
Pin Description:
The 8051 microcontroller has :
• 4 Kb of ROM
• 4 Kb of ROM
• 4 ports having in total of 32 input/output lines are in most cases sufficient to make all
necessary connections to peripheral environment.
The whole configuration is made to satisfy the needs of most
programmers working on development of automation devices. One of its advantages
is that nothing is missing and nothing is too much. Another advantages are RAM
organization, the operation of Central Processor Unit (CPU) and ports which
completely use all recourses and enable further upgrade.
• VCC - Supply voltage.
• GND - Ground.
Pins 1-8: Each of these pins can be configured as an input or an output.
Pin 9: RS A logic one on this pin disables the microcontroller and clears the contents of most
registers. In other words, the positive voltage on this pin resets the microcontroller. By applying
logic zero to this pin, the program starts execution from the beginning.
Pins 10-17: Similar to port 1, each of these pins can serve as general input or output. Besides,
all of them have alternative functions:
Pin 10: RXD Serial asynchronous communication input or Serial synchronous communication
output.
Pin 11: TXD Serial asynchronous communication output or Serial synchronous communication
clock output.
Pin 12: INT0 Interrupt 0 input.
Pin 13: INT1 Interrupt 1 input.
Pin 14: T0 Counter 0 clock input.
Pin 15: T1 Counter 1 clock input.
Pin 16: WR Write to external (additional) RAM.
Pin 17: RD Read from external RAM.
Pin 18, 19: X2, X1 Internal oscillator input and output. A quartz crystal which specifies operating
frequency is usually connected to these pins. Instead of it, miniature ceramics resonators can
also be used for frequency stability. Later versions of microcontrollers operate at a frequency of
0 Hz up to over 50 Hz.
Pin 20: GND Ground.
Pins 21-28: Port 2, If there is no intention to use external memory then these port pins are
configured as general inputs/outputs. In case external memory is used, the higher address byte,
i.e. addresses A8-A15 will appear on this port. Even though memory with capacity of 64Kb is
not used, which means that not all eight port bits are used for its addressing, the rest of them
are not available as inputs/outputs.
Pin 29: PSEN If external ROM is used for storing program then a logic zero (0) appears on it
every time the microcontroller reads a byte from memory.
Pin 30: ALE Prior to reading from external memory, the microcontroller puts the lower address
byte (A0-A7) on P0 and activates the ALE output. After receiving signal from the ALE pin, the
external register (usually 74HCT373 or 74HCT375 add-on chip) memorizes the state of P0 and
uses it as a memory chip address. Immediately after that, the ALU pin is returned its previous
logic state and P0 is now used as a Data Bus. As seen, port data multiplexing is performed by
means of only one additional (and cheap) integrated circuit. In other words, this port is used for
both data and address transmission.
Pin 31: EA By applying logic zero to this pin, P2 and P3 are used for data and address
transmission with no regard to whether there is internal memory or not. It means that even
there is a program written to the microcontroller, it will not be executed. Instead, the program
written to external ROM will be executed. By applying logic one to the EA pin, the
microcontroller will use both memories, first internal then external (if exists).
Pins 32-39: Port 0, Similar to P2, if external memory is not used, these pins can be used as
general inputs/outputs. Otherwise, P0 is configured as address output (A0-A7) when the ALE
pin is driven high (1) or as data output (Data Bus) when the ALE pin is driven low (0).
Pin 40: VCC +5V power supply
Input/output (I/O) pin:
It refers to all the pins except those of the P0 port which do not have pull-up resistors built-in.
Output pin:
A logic zero (0) is applied to a bit of the P register. The output FE transistor is turned on, thus
connecting the appropriate pin to ground.
Input pin:
A logic one (1) is applied to a bit of the P register. The output FE transistor is turned off and the
appropriate pin remains connected to the power supply voltage over a pull-up resistor of high
resistance.
Port 0:
The P0 port is characterized by two functions. If external memory is used then the lower
address byte (addresses A0-A7) is applied on it. Otherwise, all bits of this port are configured
as inputs/outputs. The other function is expressed when it is configured as an output. Unlike
other ports consisting of pins with built-in pull-up resistor connected by its end to 5 V power
supply, pins of this port have this resistor left out. This apparently small difference has its
consequences: If any pin of this port is configured as an input then it acts as if it “floats”. Such
an input has unlimited input resistance and undetermined potential.
When the pin is configured as an output, it acts as an “open drain”. By applying logic 0
to a port bit, the appropriate pin will be connected to ground (0V). By applying logic 1, the
external output will keep on “floating”. In order to apply logic 1 (5V) on this output pin, it is
necessary to build in an external pull-up resistor.
Port 1:
Port1 is a true I/O port, because it doesn't have any alternative functions as is the case with
P0, but can be configured as general I/O only. It has a pull-up resistor built-in and is
completely compatible with TTL circuits.
Port 2
P2 acts similarly to P0 when external memory is used. Pins of this port occupy addresses
intended for external memory chip. This time it is about the higher address byte with addresses
A8-A15. When no memory is added, this port can be used as a general input/output port
showing features similar to P1.
Port 3
All port pins can be used as general I/O, but they also have an alternative function. In order to
use these alternative functions, a logic one (1) must be applied to appropriate bit of the P3
register. In tems of hardware, this port is similar to P0, with the difference that its pins have a
pull-up resistor built-in .
Pin's Current limitations
When configured as outputs (logic zero (0)), single port pins can receive a current of 10mA. If all
8 bits of a port are active, a total current must be limited to 15mA (port P0: 26mA). If all ports
(32 bits) are active, total maximum current must be limited to 71mA. When these pins are
configured as inputs (logic 1), built-in pull-up resistors provide very weak current, but strong
enough to activate up to 4 TTL inputs of LS series
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the
device.
ALE/PROG:
Address Latch Enable 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. 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:
Program Store Enable is the read strobe to external program memory. When
the AT89C52 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 pro-gram memory locations starting at 0000H up to FFFFH.
However, 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 12V programming
enable voltage (VPP) during Flash programming when 12V programming is selected.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2:
It is an output from the inverting oscillator amplifier.
Block Diagram of 8051:
Figure 4.2 block diagram of 8051 microcontroller
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier, which can be configured for use as an on-chip oscillator. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source, XTAL2
should be left unconnected while XTAL1 is driven. There are no requirements on the duty
cycle of the external clock signal, since the input to the internal clocking circuitry is through a
divide-by-two flip-flop, but minimum and maximum voltage high and low times specifications
must be observed.
Idle Mode:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the on-chip RAM and all the
special function registers remain unchanged during this mode. The idle mode can be
terminated by any enabled interrupt or by a hardware reset. It should be noted that when
idle is terminated by a hardware reset, the device normally resumes program execution, from
where it left off, up to two machine cycles before the internal reset algorithm takes control.
On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is
not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is
terminated by reset, the instruction following the one that invokes Idle should not be one
that writes to a port pin or to external memory.
Oscillator Connections:
Note: C1, C2 = 30 pF ± 10 pF for Crystals
= 40 pF ± 10 pF for Ceramic Resonators
Figure 4.4 Oscillator connections
4.2 Servomotors
A servomotor is a motor which forms part of a servomechanism. The servomotor is paired with
some type of encoder to provide position/speed feedback. This feedback loop is used to
provide precise control of the mechanical degree of freedom driven by the motor. A
servomechanism may or may not use a servomotor. For example, a household furnace
controlled by a thermostat is a servomechanism, because of the feedback and resulting error
signal, yet there is no motor being controlled directly by the servomechanism.
4.3 Light detector
This circuit detects light falling on the Photo-cell (Light Dependent Resistor) to turn on the 555
and create a tone that is delivered to the speaker. Pin 4 must be held below 0.7v to turn the
555 off. Any voltage above 0.7v will activate the circuit. The adjustable sensitivity control is
needed to set the level at which the circuit is activated. When the sensitivity pot is turned so
that it has the lowest resistance (as shown in red), a large amount of light must be detected by
the LDR for its resistance to be low. This produces a voltage-divider made up of the LDR and 4k7
resistor. As the resistance of the LDR decreases, the voltage across the 4k7 increases and the
circuit is activated.
When the sensitivity control is taken to the 0v rail, its resistance increases and this effectively
adds resistance to the 4k7. The lower-part of the voltage-divider now has a larger resistance
and this is in series with the LDR. Less light is needed on the LDR for it to raise the voltage on
pin 4 to turn the 555 on.
Chapter 5: Conclusion
It has been successfully proved that a simple IR sensor in conjunction with an
encoder-decoder arrangement and a microcontroller can be effectively used to alert the user of
any potential accident with very low cost. The low cost of this design makes it attractive to use
on a daily basis. The potentiometer at the transmitter side is used to change the sensitivity of
the module. Various sensitivities have been tested successfully.
Appendix:
Coding
The code is written in keil C51 compiler .The C code listing for heartbeat monitor system is:
#include<at89x52.h> // plz ad the reg51 . h file
#include<string.h> // plz ad the string . h file
//heart beat monitor 8051 based
#define lcdport P2 // chnage it for ur hardware
sbit rw = P3^7; // LCD connection may be different
sbit rs=P3^6; // LCD interface with microcontroller
sbit en=P3^5; // Enable pin of LCD
unsigned char sec,sec100;
unsigned int bt,tick,r,bpm;
void lcdinit();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void send_string(unsigned char *s);
void msdelay(unsigned int);
void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse
{
bt=tick; // number of ticks are picked
tick=0; // reset for next counting
}
void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
{
TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
tick++; // This variable counts the time period of incoming pulse in Sec/100
if(tick>=3500){tick=0;} // tick are limited to less trhan 255 for valid calculation
if(sec100 >=100) // 1 sec = sec100 * 100
{
sec++;
sec100=0;
}
}
void main()
{
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
rw=0;
EA = 1;
TMOD = 0x21;
IT0 = 1;
EX0 = 1;
ET0 = 1;
TR0 = 1;
msdelay(1000);
lcdinit();
msdelay(1000);
send_string("Heart beat ");
msdelay(1500);
msdelay(500);
//delay(15000);
bpm=0;bt=0;
while(1)
{
if(sec >=1)
{
sec=0;
/*
The sampling time is fixed 1 sec.
A variable "tick" is incremented with one tick per 100mSc in the timer 0 interrupt routine.
Each on occurring of external interrupt the value in the "tick" is picked up
and it is set to zero for recounting.
The process continues till next external interrupt.
Formula for calculating beats per minutes (microcontroller based heartbeat monitor ) is
as tick is the time period in Sec/100. so extract the frequency of pulses at external interrupt
Frequency = (1/tick)* 100 i.e pulses /sec
Then
bpm = frequency * 60 for one minutes i.e pulses per minute
in short we can do it as
bpm = 6000/ bt
*/
lcdcmd(0x02);
if(bt >=7){
bpm = 6000/bt; // for valid output bt is limited so that it should be greater than 6
msdelay(500);
send_string("Pulse. ");
lcddata((bpm/100)+0x30);
r=bpm%100;
lcddata((r/10)+0x30);
lcddata((r%10)+0x30);
send_string(" bpm ");
}
else {
send_string("out of range");} // otherwise bpm will be shown zero, if limit does not fit for your
project you can change it.
}
}
}
void lcdinit()
{
msdelay(100);
lcdcmd(0x01);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x06);
msdelay(500);
lcdcmd(0x0c);
msdelay(500);
lcdcmd(0x03);
msdelay(500);
msdelay(500);
}
void lcdcmd(unsigned char value)
{
rs=0;
lcdport=value;
msdelay(100);
en=1;
msdelay(100);
en=0;
msdelay(100);
rs=1;
}
void lcddata(unsigned char value)
//heart beat monitoring system using microcontroller
{
rs=1;
lcdport=value;
msdelay(10);
en=1;
msdelay(100);
en=0;
rs=0;
}
void msdelay(unsigned int i)
{
//unsigned int i;
while(i --);
}
void send_string(unsigned char *s)
{
unsigned char l,i;
l = strlen(s); // get the length of string
for(i=1;i <=l;i++)
{
lcddata(*s); // write every char one by one
s++;
}
}
BIBLIOGRAPHY
Text Books Referred:
1. “The 8051 Microcontroller and Embedded Systems” by Muhammad Ali Mazidi and
Janice Gillispie Mazidi, Pearson Education.
2. 8051 Microcontroller Architecture, programming and application by KENNETH JAYALA
3. ATMEL 89s52 Data sheets
4. Hand book for Digital IC’s from Analogic Devices