Borewell Safety Alert Alaram
Borewell Safety Alert Alaram
Borewell Safety Alert Alaram
M.ANUSHA (17S45A0233)
V.VINITH KUMAR (16S41A0249)
S.VISHAL SIDDARTHA (17S45A0246 )
E.SHEKAR (16S45A0208)
under the esteemed guidance of
Mr. Md.IMRAN,(M.TECH)
Asst. Professor
RAMAKRISHNA COLONY
KARIMNAGAR-505481
TELANGANA STATE 2019
1
VAAGESWARI COLLEGE OF ENGINEERING
RAMAKRISHNA COLONY
KARIMNAGAR-505481
CERTIFICATE
This is to certify the mini project work entitled “BOREWELL SAFETY ALERT ALARAM” submitted by
following students in partial fulfillment of the requirement of the award of the degree Of Bachelor of
Technology in EEE, is from vaageswari college of engineering. Karimnagar.
M.ANUSHA (17S45A0233)
V.VINITH KUMAR (16S41A0249)
S.VISHAL SIDDARTHA (17S45A0246 )
E.SHEKAR (16S45A0208)
2
ACKNOWLEDGEMENT
To make an effort over this period can be succesful by the advice and support of many well wishers.
we avail this opportunity to express our gratitude and appreciate to all of them.
we express thanks to our project guide Mr. Md.IMRAN , Asst. professor, EEE Department for his
valuable and timely suggestions during the course of our project.
we are thankful to Dr. M.RAMESH, professor & HOD of EEE department of the guidance ,
valuable support and useful suggestions given to us during the course of our project
we would like to express our profound respect to Dr. CH.SRINIVAS . Principal, vaageswari college
of engineering for his useful suggestion during the project work.
we extend our sincere thanks to staff of EEE Department and all our friends for their good wishes
,their helping hands and constructive criticism, which led the successful completion of our project report.
We immensly indebted to our parents, brothers and sisters for their love and unshakable belief in us
and understanding and ever-decreasing grudges for not spending time more often.
Finally, we thank all those who directly and indirectly helped us in this regard, we apologize for not
listing everyone.
ABSTRACT
In this project we are developing a proactive approach to prevent the child fatalities at the umpteen
This project is based on communications using IR signals when the IR signal placed two inches
diametrically under the ground surface of bore well, breaks due to any obstructing body, a buzzer
3
starts sounding as an alert and at the same time, a stake that is kept a few feet lower in the bore well
closes the bore in order to prevent the body from falling deeper into the well the solution presented in
this project is simple and yet easily scalable and highly cost effective solution utilizing the proven
technology of IR(Infra Red)signaling.
INDEX
CHAPTER 1
4
CHAPTER2. DESCRIPTION OF HARDWARE COMPONENTS
2.2.1 Introduction
2.2.3 Transformer
2.2.4 Rectifier
2.2.5 Regulator
2.3.5 LCD
5
CHAPTER 4. SOFTWARE DEVELOPMENT
4.1.1 Introduction
5.1 Advantages
5.2 Disadvantages
5.3 Applications
5.5 Conclusion
REFERENCES
CHAPTER 1
1.Introduction of Embedded System
This is in direct contrast to the personal computer in the family room. It too is
comprised of computer hardware and software and mechanical components (disk drives, for
example). However, a personal computer is not designed to perform a specific function rather; it is
able to do many different thingsFor example, my computer consists of a keyboard, mouse, video
card, modem, hard drive, floppy drive, and sound card-each of which is an embedded system. Each
of these devices contains a processor and software and is designed to perform a specific function.
6
For example, the modem is designed to send and receive digital data over analog telephone line. .
Such is the case for a microwave oven, VCR, or alarm clock. In some cases, it would even be
possible to build an equivalent device that does not contain the processor and software. This could
be done by replacing the combination with a custom integrated circuit that performs the same
functions in hardware. However, a lot of flexibility
Real Time Systems:
All of the topics and examples presented in this book are applicable to the designers of real-time
system who is more delight in his work. He must guarantee reliable operation of the software and
hardware under all the possible conditions and to the degree that human lives depend upon three
system's proper execution, engineering calculations and descriptive paperwork.
Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used in very market
segment- consumer electronics, office automation, industrial automation, biomedical engineering,
wireless communication, data communication, telecommunications, transportation, military and so
on.
Consumer appliances:
At home we use a number of embedded systems which include digital camera, digital
diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner,
VCO player, video game consoles, video recorders etc. Today’s high-tech car has about 20
embedded systems for transmission control, engine spark control, air-conditioning, navigation etc.
Even wristwatches are now becoming embedded systems. The palmtops are powerful embedded
7
systems using which we can carry out many general-purpose tasks such as playing games and word
processing.
Office automation:
The office automation products using em embedded systems are copying machine, fax
machine, key telephone, modem, printer, scanner etc.
Industrial automation:
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific tasks such
as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate
action based on the monitored levels to control other devices or to send information to a centralized
monitoring station. In hazardous industrial environment, where human presence has to be avoided,
robots are used, which are programmed to do specific jobs. The robots are now becoming very
powerful and carry out many interesting and complicated tasks such as hardware assembly.
Medical electronics:
router’s function is to obtain the data packets from incoming pores, analyze the packets and send
them towards the destination after doing necessary protocol conversion. Most networking 5
Security:
8
Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store. Developing
embedded systems for security applications is one of the most lucrative businesses nowadays.
Security devices at homes, offices, airports etc. for authentication and verification are embedded
systems. Encryption devices are nearly 99 per cent of the processors that are manufactured end up
in~ embedded systems. Embedded systems find applications in .
Finance:
Financial dealing through cash and cheques are now slowly paving way for transactions using
smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines.
Smart card, of the size of a credit card, has a small micro-controller and memory; and it interacts
with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology
has the capability of ushering in a cashless society. Well, the list goes on. It is no exaggeration to say
that eyes wherever you go, you can see, or at least feel, the work of an embedded system!
Like all good things, this powerful component is basically very simple. It is made by mixing tested
and high- quality "ingredients" (components) as per following receipt:
1. The simplest computer processor is used as the "brain" of the future system.
2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters, timers,
input/output lines etc. are added
3. All that is placed in some of the standard packages.
4. A simple software able to control it all and which everyone can easily learn about has been
developed.
On the basis of these rules, numerous types of microcontrollers were designed and they quickly
became man's invisible companion. Their incredible simplicity and flexibility conquered us a long
time ago and if you try to invent something about them, you should know that you are probably late,
someone before you has either done it or at least has tried to do it.
9
The following things have had a crucial influence on development and success of the
microcontrollers:
So, if you are infected with a virus called electronics, there is nothing left for you to do but to learn
how to use and control its power.
Even though there is a large number of different types of microcontrollers and even more programs
created for their use only, all of them have many things in common. Thus, if you learn to handle one
of them you will be able to handle them all. A typical scenario on the basis of which it all functions
is as follows:
1. Power supply is turned off and everything is still…the program is loaded into the
microcontroller, nothing indicates what is about to come…
2. Power supply is turned on and everything starts to happen at high speed! The control logic
unit keeps everything under control. It disables all other circuits except quartz crystal to
operate. While the preparations are in progress, the first milliseconds go by.
3. Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs
are being filled with bits reflecting the state of all circuits within the microcontroller. All pins
10
are configured as inputs. The overall electronis starts operation in rhythm with pulse
sequence. From now on the time is measured in micro and nanoseconds.
4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder
which recognizes it, after which it is executed with immediate effect.
11
What is what in the microcontroller?
As you can see, all the operations within the microcontroller are performed at high speed and quite
simply, but the microcontroller itself would not be so useful if there are not special circuits which
make it complete. In continuation, we are going to call your attention to them.
Random Access Memory (RAM) is a type of memory used for temporary storing data and
intermediate results created and used during the operation of the microcontrollers. The content of
this memory is cleared once the power supply is off. For example, if the program performes an
addition, it is necessary to have a register standing for what in everyday life is called the “sum” . For
that purpose, one of the registers in RAM is called the "sum" and used for storing results of addition.
The size of RAM goes up to a few KBs.
The EEPROM is a special type of memory not contained in all microcontrollers. Its contents may be
changed during program execution (similar to RAM ), but remains permanently saved even after the
loss of power (similar to ROM). It is often used to store values, created and used during operation
(such as calibration values, codes, values to count up to etc.), which must be saved after turning the
12
power supply off. A disadvantage of this memory is that the process of programming is relatively
slow. It is measured in miliseconds.
Special function registers are part of RAM memory. Their purpose is predefined by the manufacturer
and cannot be changed therefore. Since their bits are physically connected to particular circuits
within the microcontroller, such as A/D converter, serial communication module etc., any change of
their state directly affects the operation of the microcontroller or some of the circuits. For example,
writing zero or one to the SFR controlling an input/output port causes the appropriate port pin to be
configured as input or output. In other words, each bit of this register controls the function of one
single pin.
Program Counter
Program Counter is an engine running the program and points to the memory address
containing the next instruction to execute. After each instruction execution, the value of the counter
is incremented by 1. For this reason, the program executes only one instruction at a time just as it is
written. However…the value of the program counter can be changed at any moment, which causes a
“jump” to a new memory location. This is how subroutines and branch instructions are executed.
After jumping, the counter resumes even and monotonous automatic counting +1, +1, +1…
AIM:
In recent years , ther has been an increase in the bore well mishaps wherein children fail
into the open bore wells. The project aims at designing a system which is capable of rescuing the
child with ease and without causing any discomports such as to save the child at a visible distance
inside the bore
13
IR SENSOR
A BUZZER
T
8
9
CHAPTER 2 MOTOR DRIVER
S (L293D)
We can achieve the project through IR transmitter and IR receiver.To getting the signal from IR
sensor and controlling the persons these are all the things we can control through software written in
89S52 controller.
Generate the IR rays using 555 timer and IR led. In this construct the 555 timers in a stable mode in
out put connect the IR led. From this circuit we can get the IR rays continuously. These IR rays can
detect from TSOP1738 receiver.
We are using 89S52 microcontroller one of the powerful micro -controller for commercial
purpose. We are using the one of the powerful tool to developing the software for this project.We
are using the stepper motor to control the gate for opening and closing. And also using number of
persons entering into the room,which is displayed on the lcd.
14
application is satisfactorily served by 8-bit micro controller. Using an inexpensive 8-bit
Microcontroller will doom the 32-bit product failure in any competitive market place. Coming to the
question of why to use 89S52 of all the 8-bit Microcontroller available in the market the main
answer would be because it has 8kB Flash and 256 bytes of data RAM32 I/O lines, three 16-bit
timer/counters, a Eight-vector two-level interrupt architecture, a full duplex serial port, on-chip
oscillator, and clock circuitry.
By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcomputer which provides a highly flexible and cost effective solution
to many embedded control applications
Input/output devices are very critical components of an embedded system. The first input
device we will study is the switch. It allows the human to input binary information into the
microcontroller. Typically we define the Two state, logic true, when the switch is pressed. logic
false, when the switch in not pressed. A single pole single throw (SPST) switch has two connections.
The switches are shown as open circuit in Figure 1.which is a normally open switch (NO), the
resistance between the connections is infinite (over 1000 MΩ) if the switch is not pressed and zero
(under 0.1 Ω) if the switch is pressed.
15
A switch has an two state open state and closed state. And state of switch is monitor by
microcotroller at a digital input pin. A switch requires a pull-up or pull-down resistor to produce a
definite high or low voltage when it is open or closed. A resistor placed between a digital input and
the VCC(5v) is called a "pull-up" resistor because it normally pulls the pin's voltage up to the
VCC(5v). A resistor placed between a digital input and the GND(0v) is called a "pull-down" resistor
because it normally pulls the pin's voltage to the GND(0v).
In positive logic input pin of microcontroller is normally in low state(0V logic 0) when we
press switch pin become high state (Vcc-5V logic 1).
In negative logic input pin of microcontroller is normally in high state(Vcc-5V logic
1)when we press switch pin become low state (0V logic 0).
16
Pinout Description
Pins 1-8: Port 1 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.
Pins10-17: Port 3 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.
Pin 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.
17
2.1.4RAM MEMORY
While operating, the processor processes data as per program instructions. Each instruction consists
of two parts. One part describes WHAT should be done, while the other explains HOW to do it. The
latter part can be a data (binary number) or the address at which the data is stored.
1. Direct Addressing
On direct addressing, the address of memory location containing data to be read is specified in
instruction. The address may contain a number being changed during operation (variable). For
example:
18
2. Indirect Addressing
Indirect addressing is only used for accessing RAM locations available for use (never for accessing
SFRs). This is the only way of accessing all the latest versions of the microcontrollers with
additional memory block (128 locations of RAM).
MOV A,@R0; Means: Store the value from the register whose address is in the R0 register
into accumulator
2.1.6 REGISTERS
Special Function Registers (SFRs) are a sort of control table used for running and monitoring the
operation of the microcontroller. Each of these registers as well as each bit they include, has its
name, address in the scope of RAM and precisely defined purpose such as timer control, interrupt
control, serial communication control etc. Even though there are 128 memory locations intended to
be occupied by them, the basic core, shared by all types of 8051 microcontrollers, has only 21 such
registers.
B Register
Multiplication and division can be performed only upon numbers stored in the A and B registers. All
other instructions in the program can use this register as a spare accumulator (A).
R Registers (R0-R7)
This is a common name for 8 general-purpose registers (R0, R1, R2 ...R7). Even though they are
not true SFRs, they deserve to be discussed here because of their purpose. They occupy 4 banks
within RAM. Similar to the accumulator, they are used for temporary storing variables and
intermediate results during operation.
19
MOV A,R3; Means: move number from R3 into accumulator
ADD A,R4; Means: add number from R4 to accumulator (result remains in accumulator)
MOV R5,A; Means: temporarily move the result from accumulator into R5
MOV A,R1; Means: move number from R1 to accumulator
ADD A,R2; Means: add number from R2 to accumulator
SUBB A,R5; Means: subtract number from R5 (there are R3+R4)
PSW register is one of the most important SFRs. It contains several status bits that reflect the current
state of the CPU. Besides, this register contains Carry bit, Auxiliary Carry, two register bank select
bits, Overflow flag, parity bit and user-definable status flag.P - Parity bit. If a number stored in
the accumulator is even then this bit will be automatically set (1), otherwise it will be cleared (0). It
is mainly used during data transmit and receive via serial communication.
OV Overflow occurs when the result of an arithmetical operation is larger than 255 and cannot be
stored in one register. Overflow condition causes the OV bit to be set (1). Otherwise, it will be
cleared (0).
RS0, RS1 - Register bank select bits. These two bits are used to select one of four register
banks of RAM. By setting and clearing these bits, registers R0-R7 are stored in one of four banks of
RAM
T0M1,T0M0 These two bits select the operational mode of the Timer 0.
F0 - Flag 0. This is a general-purpose bit available for use.
AC - Auxiliary Carry Flag is used for BCD operations only.
20
CY - Carry Flag is the (ninth) auxiliary bit used for all arithmetical operations and shift
instructions.
Data Pointer Register (DPTR)
DPTR register is not a true one because it doesn't physically exist. It consists of two separate
registers: DPH (Data Pointer High) and (Data Pointer Low). For this reason it may be treated as a
16-bit register or as two independent 8-bit registers.
If neither external memory nor serial communication system are used then 4 ports with in total of 32
input/output pins are available for connection to peripheral environment. Each bit within these ports
affects the state and performance of appropriate pin of the microcontroller. Thus, bit logic state is
reflected on appropriate pin as a voltage (0 or 5 V) and vice versa, voltage on a pin reflects the state
of appropriate port bit.
2.1.7 Counters and Timers
As you already know, the microcontroller oscillator uses quartz crystal for its operation. As the
frequency of this oscillator is precisely defined and very stable, pulses it generates are always of the
same width, which makes them ideal for time measurement. Such crystals are also used in quartz
watches. In order to measure time between two events it is sufficient to count up pulses coming from
this oscillator.
Timer T0
21
As seen in figure below, the timer T0 consists of two registers – TH0 and TL0 representing a low
and a high byte of one 16-digit binary number.
Accordingly, if the content of the timer T0 is equal to 0 (T0=0) then both registers it consists of will
contain 0. If the timer contains for example number 1000 (decimal), then the TH0 register (high
byte) will contain the number 3, while the TL0 register (low byte) will contain decimal number 232.
Formula used to calculate values in these two registers is very simple:
TH0 × 256 + TL0 = T
Matching the previous example it would be as follows:
3 × 256 + 232 = 1000
GATE1 enables and disables Timer 1 by means of a signal brought to the INT1 pin (P3.3):
o 1 - Timer 1 operates only if the INT1 bit is set.
o 0 - Timer 1 operates regardless of the logic state of the INT1 bit.
C/T1 selects pulses to be counted up by the timer/counter 1:
1 - Timer counts pulses brought to the T1 pin (P3.5).
22
Timer 0 in mode 0 (13-bit timer)
This is one of the rarities being kept only for the purpose of compatibility with the previous
versions of microcontrollers. This mode configures timer 0 as a 13-bit timer which consists of all 8
bits of TH0 and the lower 5 bits of TL0. As a result, the Timer 0 uses only 13 of 16 bits.
Mode 1 configures timer 0 as a 16-bit timer comprising all the bits of both registers TH0 and TL0.
That's why this is one of the most commonly used modes. Timer operates in the same way as in
mode 0, with difference that the registers count up to 65 536 as allowable by the 16 bits.
Mode 2 configures timer 0 as an 8-bit timer. Actually, timer 0 uses only one 8-bit register for
counting and never counts from 0, but from an arbitrary value (0-255) stored in another (TH0)
register.
23
The following example shows the advantages of this mode. Suppose it is necessary to constantly
count up 55 pulses generated by the clock.
If mode 1 or mode 0 is used, It is necessary to write the number 200 to the timer registers and
constantly check whether an overflow has occured, i.e. whether they reached the value 255. When it
happens, it is necessary to rewrite the number 200 and repeat the whole procedure. The same
procedure is automatically performed by the microcontroller if set in mode 2.
Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. In other
words, the 16-bit timer consisting of two registers TH0 and TL0 is split into two independent 8-bit
timers. This mode is provided for applications requiring an additional 8-bit timer or counter. The
TL0 timer turns into timer 0, while the TH0 timer turns into timer 1.
Timer Control (TCON) Register
TCON register is also one of the registers whose bits are directly in control of timer operation.
Only 4 bits of this register are used for this purpose, while rest of them is used for interrupt control
to be discussed later.
24
o 1 - Timer 0 is enabled.
o 0 - Timer 0 is disabled.
In order to use timer 0, it is first necessary to select it and configure the mode of its operation. Bits of
the TMOD register are in control of it:
Referring to figure above, the timer 0 operates in mode 1 and counts pulses generated by internal
clock the frequency of which is equal to 1/12 the quartz frequency.
Turn on the timer:
The TR0 bit is set and the timer starts operation. If the quartz crystal with frequency of 12MHz is
embedded then its contents will be incremented every microsecond. After 65.536 microseconds, the
both registers the timer consists of will be loaded. The microcontroller automatically clears them and
the timer keeps on repeating procedure from the beginning until the TR0 bit value is logic zero (0).
4. Timer 1
Timer 1 is identical to timer 0, except for mode 3 which is a hold-count mode. It means that they
have the same function, their operation is controlled by the same registers TMOD and TCON and
both of them can operate in one out of 4 different modes.
25
2.1.8 SERIAL COMMUNICATION
One of the microcontroller features making it so powerful is an integrated UART, better known as a
serial port. It is a full-duplex port, thus being able to transmit and receive data simultaneously and at
different baud rates. Without it, serial data send and receive would be an enormously complicated
part of the program in which the pin state is constantly changed and checked at regular intervals.
Serial port must be configured prior to being used. In other words, it is necessary to determine how
many bits is contained in one serial “word”, baud rate and synchronization clock source. The whole
process is in control of the bits of the SCON register (Serial Control).
SM0 - Serial port mode bit 0 is used for serial port mode selection.
SM1 - Serial port mode bit 1.
SM2 - Serial port mode 2 bit, also known as multiprocessor communication enable bit. When
set, it enables multiprocessor communication in mode 2 and 3, and eventually mode 1. It
should be cleared in mode 0.
REN - Reception Enable bit enables serial reception when set. When cleared, serial reception
is disabled.
TB8 - Transmitter bit 8. Since all registers are 8-bit wide, this bit solves the problem of
transmiting the 9th bit in modes 2 and 3. It is set to transmit a logic 1 in the 9th bit.
26
As seen, serial port mode is selected by combining the SM0 and SM2 bits:
In mode 0, serial data are transmitted and received through the RXD pin, while the TXD pin output
clocks. The bout rate is fixed at 1/12 the oscillator frequency.
TRANSMIT - Data transmit is initiated by writing data to the SBUF register. In fact, this process
starts after any instruction being performed upon this register. When all 8 bits have been sent, the TI
bit of the SCON register is automatically set.
RECEIVE - Data receive through the RXD pin starts upon the two following conditions are met: bit
REN=1 and RI=0 (both of them are stored in the SCON register). When all 8 bits have been
received, the RI bit of the SCON register is automatically set indicating that one byte receive is
complete.
Since there are no START and STOP bits or any other bit except data sent from the SBUF register in
the pulse sequence, this mode is mainly used when the distance between devices is short, noise is
minimized and operating speed is of importance. A typical example is I/O port expansion by adding
a cheap IC (shift registers 74HC595, 74HC597 and similar).
Mode 1
In mode 1, 10 bits are transmitted through the TXD pin or received through the RXD pin in the
following manner: a START bit (always 0), 8 data bits (LSB first) and a STOP bit (always 1). The
START bit is only used to initiate data receive, while the STOP bit is automatically written to the
RB8 bit of the SCON register.
TRANSMIT - Data transmit is initiated by writing data to the SBUF register. End of data
transmission is indicated by setting the TI bit of the SCON register.
RECEIVE - The START bit (logic zero (0)) on the RXD pin initiates data receive. The following
two conditions must be met: bit REN=1 and bit RI=0. Both of them are stored in the SCON register.
The RI bit is automatically set upon data reception is complete.
27
2.1.9 INTERRUPTS
There are five interrupt sources for the 8051, which means that they can recognize 5
different events that can interrupt regular program execution. Each interrupt can be enabled or
disabled by setting bits of the IE register. Likewise, the whole interrupt system can be disabled by
clearing the EA bit of the same register. Refer to figure below.
Interrupt Priorities
It is not possible to foreseen when an interrupt request will arrive. If several interrupts are enabled, it
may happen that while one of them is in progress, another one is requested.
1. Reset! The absolute master. When a reset request arrives, everything is stopped and the
microcontroller restarts.
2. Interrupt priority 1 can be disabled by Reset only.
3. Interrupt priority 0 can be disabled by both Reset and interrupt priority 1.
If two interrupt requests, at different priority levels, arrive at the same time then the higher
priority interrupt is serviced first.
If the both interrupt requests, at the same priority level, occur one after another, the one
which came later has to wait until routine being in progress ends.
If two interrupt requests of equal priority arrive at the same time then the interrupt to be
serviced is selected according to the following priority list:
29
1. External interrupt INT0
2. Timer 0 interrupt
3. External Interrupt INT1
4. Timer 1 interrupt
5. Serial Communication Interrupt
Reset
Reset occurs when the RS pin is supplied with a positive pulse in duration of at least
2 machine cycles (24 clock cycles of crystal oscillator). After that, the microcontroller generates an
internal reset signal which clears all SFRs, except SBUF registers, Stack Pointer and ports (the state
30
of the first two ports is not defined, while FF value is written to the ports configuring all their pins as
inputs).
Basically, everything is very simple: after turning the power on, electrical capacitor is being charged
for several milliseconds through a resistor connected to the ground.
POWER SUPPLY
All digital circuits require regulated power supply. In this article we are going to learn how to get a
regulated positive supply from the mains supply.
Figure 1 shows the basic block diagram of a fixed regulated power supply. Let us go through each block.
31
TRANSFORMER
A transformer consists of two coils also called as “WINDINGS” namely PRIMARY & SECONDARY. They
are linked together through inductively coupled electrical conductors also called as CORE. A changing
current in the primary causes a change in the Magnetic Field in the core & this in turn induces an alternating
voltage in the secondary coil. If load is applied to the secondary then an alternating current will flow through
the load. If we consider an ideal condition then all the energy from the primary circuit will be transferred
the secondary circuit through the magnetic field.
Rectifier
A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we use a diode, a
diode is a device that allows current to pass only in one direction i.e. when the anode of the diode is positive
with respect to the cathode also called as forward biased condition & blocks current in the reversed biased
condition.
Rectifier can be classified as follows:
This is the simplest type of rectifier as you can see in the diagram a half wave rectifier consists of
only one diode. When an AC signal is applied to it during the positive half cycle the diode is forward biased
& current flows through it. But during the negative half cycle diode is reverse biased & no current flows
through it. Since only one half of the input reaches the output, it is very inefficient to be used in
powersupplies.
32
2) Full wave rectifier.
Half wave rectifier is quite simple but it is very inefficient, for greater efficiency we would like to use
both the half cycles of the AC signal. This can be achieved by using a center tapped transformer i.e. we would
have to double the size of secondary winding & provide connection to the center. So during the positive half
cycle diode D1 conducts & D2 is in reverse biased condition. During the negative half cycle diode D2
conducts & D1 is reverse biased. Thus we get both the half cycles across the load.
One of the disadvantages of Full Wave Rectifier design is the necessity of using a center tapped transformer,
thus increasing the size & cost of the circuit. This can be avoided by using the Full Wave Bridge Rectifier.
3) Bridge Rectifier.
3) BridgeRectifier.
As the name suggests it converts the full wave i.e. both the positive & the negative half cycle into
DC thus it is much more efficient than Half Wave Rectifier & that too without using a center tapped
transformer thus much more cost effective than Full Wave Rectifier.
Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4. During the positive half cycle
diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3 conduct thus the diodes keep
switching the transformer connections so we get positive half cycles in the output.
33
If we use a center tapped transformer for a bridge rectifier we can get both positive & negative half
cycles which can thus be used for generating fixed positive & fixed negative voltages.
FILTER CAPACITOR
Even though half wave & full wave rectifier give DC output, none of them provides a constant output voltage.
For this we require to smoothen the waveform received from the rectifier. This can be done by using a
capacitor at the output of the rectifier this capacitor is also called as “FILTER CAPACITOR” or
“SMOOTHING CAPACITOR” or “RESERVOIR CAPACITOR”. Even after using this capacitor a small
amount of ripple will remain.
if we go on increasing the value of the filter capacitor then the Ripple will decrease. But then the costing will increase. The
value of the Filter capacitor depends on the current consumed by the circuit, the frequency of the waveform & the accepted
ripple.
Where,
Vr= accepted ripple voltage.( should not be more than 10% of the voltage)
F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so F=25hz
Whereas a full wave rectifier has Two peaks in one cycle so F=100hz.
VOLTAGE REGULATOR
A Voltage regulator is a device which converts varying input voltage into a constant regulated output voltage.
Voltage regulator can be of two types
34
Also called as Resistive Voltage regulator because they dissipate the excessive voltage resistively as heat.
2) Switching Regulators.
After filtering the rectifier output the signal is given to a voltage regulator. The maximum input voltage that
can be applied at the input is 35V.Normally there is a 2-3 Volts drop across the regulator so the input voltage
should be at least 2-3 Volts higher than the output voltage. If the input voltage gets below the Vmin of the
regulator due to the ripple voltage or due to any other reason the voltage regulator will not be able to produce
the correct regulated voltage.
3 Circuit diagram:
IC 7805:
7805 is an integrated three-terminal positive fixed linear voltage regulator. It supports an input voltage of 10
volts to 35 volts and output voltage of 5 volts. It has a current rating of 1 amp although lower current models
are available. Its output voltage is fixed at 5.0V. The 7805 also has a built-in current limiter as a safety
35
feature. 7805 is manufactured by many companies, including National Semiconductors and Fairchild
Semiconductors.
SPECIFICATIONS IC 7805
The diagram above shows the expected waveform from the UART when using the common 8N1 format. 8N1
signifies 8 Data bits, No Parity and 1 Stop Bit. The RS-232 line, when idle is in the Mark State (Logic 1). A
transmission starts with a start bit which is (Logic 0). Then each bit is sent down the line, one at a time. The
LSB (Least Significant Bit) is sent first. A Stop Bit (Logic 1) is then appended to the signal to make up the
transmission.
The data sent using this method, is said to be framed. That is the data is framed between a Start
and Stop Bit.
The bits are transmitted at specific time intervals determined by the baud rate of the serial signal.
This is the signal present on the RS-232 Port of your computer, shown below.
36
RS-232 Logic Waveform
Serial communication
When a processor communicates with the outside world, it provides data in byte sized chunks.
Computers transfer data in two ways: parallel and serial. In parallel data transfers, often more lines are used to
transfer data to a device and 8 bit data path is expensive. The serial communication transfer uses only a single
data line instead of the 8 bit data line of parallel communication which makes the data transfer not only
cheaper but also makes it possible for two computers located in two different cities to communicate over
telephone.
Serial data communication uses two methods, asynchronous and synchronous. The synchronous
method transfers data at a time while the asynchronous transfers a single byte at a time.
In asynchronous method, each character is placed between start and stop bits. This is called
framing. In data framing of asynchronous communications, the data, such as ASCII characters, are packed in
between a start and stop bit. We have a total of 10 bits for a character: 8 bits for the ASCII code and 1 bit each
for the start and stop bits. The rate of serial data transfer communication is stated in bps or it can be called as
baudrate.
ULN 2003
ULN is mainly suited for interfacing between low-level circuits and multiple peripheral power loads,.The
series ULN20XX high voltage, high current darlington arrays feature continuous load current ratings. The
driving circuitry in- turn decodes the coding and conveys the necessary data to the stepper motor, this module
aids in the movement of the arm through steppers
37
The driver makes use of the ULN2003 driver IC, which contains an array of 7 power
Darlington arrays, each capable of driving 500mA of current. At an approximate duty cycle,
depending on ambient temperature and number of drivers turned on, simultaneously typical
power loads totaling over 230w can be controller
Normally to turn on a transistor the base input voltage of the transistor will need to be greater that
0.7V. As two transistors are used in a Darlington Pair this value is doubled. Therefore the base voltage
will need to be greater than 0.7V x 2 = 1.4V.
STEPPER MOTOR
A stepper motor is an electromechanical device which converts electrical pulses into discrete
mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments
when electrical command pulses are applied to it in the proper sequence. The motors rotation has
several direct relationships to these applied input pulses. The sequence of the applied pulses is
directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is
directly related to the frequency of the input pulses and the length of rotation is directly related to the
number of input pulses applied.
38
Fundamentals of operation
Stepper motors operate differently from DC brush motors, which rotate when voltage is
applied to their terminals. Stepper motors, on the other hand, effectively have multiple "toothed"
electromagnets arranged around a central gear-shaped piece of iron. The electromagnets are
energized by an external control circuit, such as a microcontroller. To make the motor shaft turn, first
one electromagnet is given power, which makes the gear's teeth magnetically attracted to the
electromagnet'steeth.
Stepper motor characteristics
1. Stepper motors are constant power devices.
2. As motor speed increases, torque decreases. .
3. The torque curve may be extended by using current limiting drivers and increasing the
driving voltage
Stepper Motor Advantages and Disadvantages
Advantages:
1. The rotation angle of the motor is proportional to the input pulse.
2. The motor has full torque at standstill (if the windings are energized)
3. Precise positioning and repeatability of movement since good stepper motors have an accuracy of
3 – 5% of a step and this error is non cumulative from one step to the next.
Disadvantages
1. Resonances can occur if not properly controlled.
39
2. Not easy to operate at extremely high speeds.
IR LEDs
Be sure not to exceed I*max which is given in each LED specification and do not use test instrument
that contain sources/batteries with voltage greater that Vcw max given in specification. For LED
current restriction and further LED current measurement we recommend to use resistor (1-5 Ohms)
connected in serial to LED. This is important to note that un-grounded devices (e.g. computers) can
give V=1-5 V that is enough to destroy the LED!
LCD MODULE
The display takes varying amounts of time to accomplish the functions as listed. LCD bit 7 is
monitored for logic high (busy) to ensure the display is overwritten.
Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for
debugging purpose. The most common type of LCD controller is HITACHI 44780 which provides a
simple interface between the controller & an LCD. These LCD's are very simple to interface with the
controller as well as are cost effective.
40
2x16 Line Alphanumeric LCD Display
The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters), 2x16
(Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line).
The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines
depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e.
total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7
lines are required. How do we decide which mode to use? It’s simple if you have sufficient data lines
you can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to
use 8-bit mode because basically 4-bit mode takes twice as more time as compared to 8-bit mode.
Pin Symbol Function
1 Vss Ground
3 Vo Contrast Setting
4 RS Register Select
When RS is low (0), the data is to be treated as a command. When RS is high (1), the data being sent
is considered as text data which should be displayed on the screen.
When R/W is low (0), the information on the data bus is being written to the LCD. When RW is high
(1), the program is effectively reading from the LCD. Most of the times there is no need to read from
the LCD so this line can directly be connected to Gnd thus saving one controller line.
The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is
required to latch the data. The LCD interprets and executes our command at the instant the EN line
is brought low. If you never bring EN low, your instruction will never be executed.
41
CIRCUIT DIAGRAM:
42
43
CIRCUIT DESCRPTION:
We no need to wait for the other person or we no need to left from the car opening
the door.We can achieve the project through IR transmitter and IR receiver.To getting the signal
from IR sensor and controlling the persons these are all the things we can control through software
written in 89S52 controller. Generate the IR rays using 555 timer and IR led.
SOURCE CODE:
#include<reg51.h>
sfr ldata=0x90;//port 1
sbit rs=P2^5;
sbit rw=P2^6
sbit en=P2^7;
sbit enter=P3^0;
stepper();
void lcddata1();
delay(unsigned int);
unsigned char i;
44
main()
lcdcmd(0x38);
lcdcmd(0x0E);
lcdcmd(0x01);
lcdcmd(0x81);
lcddata1();
while(1)
if(enter==0)
if((d3==57)&&(d2==57)&&(d1==57))
{
lcdcmd(0xc7);
lcddata('9');
lcddata('9');
lcddata('9');
lcdcmd(0x0c);
45
else
lcdcmd(0xc7);
a=a+1;
x=a/10;
d1=a%10;
d2=x%10;
d3=x/10;
d3=d3+48;
delay(10);
lcddata(d3);
d2=d2+48;
lcddata(d2);
d1=d1+48;
lcddata(d1);
delay(10);
lcdcmd(0x0c);
stepper();
46
}
stepper()
for(s=0;s<14;s++)
for(z=0x01;z<0x0a;z=z*2)
P2=z;
delay(5);
for(s=0;s<14;s++)
for(z=0x08;z>0x00;z=z/2)
P2=z;
47
delay(5);
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void lcddata1()
unsigned char s;
//lcdready();
for(s=0;s<15;s++)
ldata=temp[s];
rs=1;
48
rw=0;
en=1;
delay(1);
en=0;
ldata=value;
rs=1;
rw=0;
en=1;
delay(1);
en=0;
return;
ldata=value;
rs=0;
49
rw=0;
en=1;
delay(1);
en=0;
return;
CHAPTER4
SOFTWARE DEVELOPMENT:
4.1 Introduction:
In this chapter the software used and the language in which the program code is defined is mentioned
and the program code dumping tools are explained. The chapter also documents the development of the
program for the application. This program has been termed as “Source code”. Before we look at the source
code we define the two header files that we have used in the code.
50
Keil development tools for the 8051 Microcontroller Architecture support every level of software
developer from the professional applications
Step1: open the NEW Uversion project which is in the project option in the tool bar.
Step2: save the project with the required name and click save button
Step:3 select the device from NXP options the window which comes after saving the project.
CHAPTER 5
5.1Advantages
CHAPTER 5
5.1Advantages
51
1. Low cost, less complexity
2. As we can reduce manpower increasing the economy to some extent.
3. Easy to operate the system.
5.2 Disadvantages
5.3 Applications
5.4 Future scope: As this world is readily growing up for Era of automation
and global communication this concept of providing security remotely regardless of load at which
the device operates and the function s they perform, will surly fuel the scope of technology. This
concept can definitely serve as a platform for new innovations and help us get better with time. We
have presented a method for constructing and modifying complex autonomous security model
while accomplishing the following goals:
. BIBLIOGRAPHY
52
1 .MITEL.DATABOOK.COM
2 WWW.ATMEL.DATABOOK.COM
3 WWW.FRANKLIN.COM
4 WWW.KEIL.COM
5 www.asWWWk.com
6 www.wikipedia.com
7 www.palowireless.com/zigbee
8 www.howstuffworks.com
REFERENCES
53
54