Sie sind auf Seite 1von 54


A line follower robot is basically a robot designed to follow a line or path already
predetermined by the user. This line or path may be as simple as a physical white line on
the floor or as complex path marking schemes e.g. embedded lines, magnetic markers and
laser guide markers. In order to detect these specific markers or lines, various sensing
schemes can be employed. These schemes may vary from simple low cost line sensing
circuit to expansive vision systems. The choice of these schemes would be dependent
upon the sensing accuracy and flexibility required. From the industrial point of view, line
following robot has been implemented in semi to fully autonomous plants. In this
environment, these robots functions as materials carrier to deliver products from one
manufacturing point to another where rail, conveyor and gantry solutions are not
possible. Apart from line following capabilities, these robots should also have the
capability to navigate junctions and decide on which junction to turn and which junction
ignore. This would require the robot to have 90 degree turn and also junction counting
capabilities. To add on to the complexity of the problem, sensor positioning also plays a
role in optimizing the robots performance for the tasks mentioned earlier.
Line-following robots with pick- and- placement capabilities are commonly used in
manufacturing plants. These move on a specified path to pick the components from
specified locations and place them on desired locations. Basically, a line-following robot
is a self-operating robot that detects and follows a line drawn on the floor. The path to be
taken is indicated by a white line on a black surface. The control system used must sense
the line and man oeuvre the robot to stay on course while constantly correcting the wrong
moves using feedback mechanism, thus forming a simple yet effective closed- loop


Robot movement is automatic.

Fit and Forget system.

Used for long distance applications.

Defense applications.

Used in home, industrial automation.

Cost effective.

Simplicity of building.


Line following robot follows a black line about 1 or 2 inches in width on a white


Line tracing robots are simple robots with an additional sensors placed on them.

It always needs a path to run either white or black since the IR rays should reflect

from the particular path.

Slow speed and instability on different line thickness or hard angles.


Guidance system for industrial robots moving on shop floor etc.

Industrial applications.

Home applications.


Supply Unit

Photo Sensor




To all sections



Fig.1.2 Block diagram of line follower

12 V Lead Acid


An embedded system is a system which is going to do a predefined specified task is the
embedded system and is even defined as combination of both software and hardware. A
general-purpose definition of embedded systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects
the fact that they are an integral part of the system. At the other extreme a generalpurpose computer may be used to control the operation of a large complex processing
plant, and its presence will be obvious.
All embedded systems are including computers or microprocessors. Some of these
computers are however very simple systems as compared with a personal computer.
The simplest devices consist of a single microprocessor (often called a "chip), which
may itself be packaged with other chips in a hybrid system or Application Specific
Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to
a switch or activator which (for example) may start or stop the operation of a machine or,
by operating a valve, may control the flow of fuel to an engine.
As the embedded system is the combination of both software and hardware








Figure:1.3 Block diagram of Embedded System

Software deals with the languages like ALP, C, and VB etc., and Hardware deals with
Processors, Peripherals, and Memory.
Memory: It is used to store data or address.
Peripherals: These are the external devices connected
Processor: It is an IC which is used to perform some task
Applications of embedded systems

Manufacturing and process control

Construction industry


Buildings and premises

Domestic service


Office systems and mobile equipment

Banking, finance and commercial

Medical diagnostics, monitoring and life support

Testing, monitoring and diagnostic systems


Fig:2.1 Power Supply


A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductorsthe transformer's coils. A varying current in the
first or primary winding creates a varying magnetic flux in the transformer's core, and
thus a varying magnetic field through the secondary winding. This varying magnetic field
induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This
effect is called mutual induction. Basic Principle

A transformer makes use of Faraday's law and the ferromagnetic properties of an iron
core to efficiently raise or lower AC voltages. It of course cannot increase power so that if
the voltage is raised, the current is proportionally lowered and vice versa.
A transformer consists of two coils (often called 'windings') linked by an iron core, as
shown in figure below. There is no electrical connection between the coils; instead they
are linked by a magnetic field created in the core.

Fig:2.2.2 Basic Transformer

Transformers are used to convert electricity from one voltage to another with minimal
loss of power. They only work with AC (alternating current) because they require a
changing magnetic field to be created in their core. Transformers can increase voltage
(step-up) as well as reduce voltage (step-down).
Alternating current flowing in the primary (input) coil creates a continually changing
magnetic field in the iron core. This field also passes through the secondary (output) coil
and the changing strength of the magnetic field induces an alternating voltage in the
secondary coil. If the secondary coil is connected to a load the induced voltage will make

an induced current flow. The correct term for the induced voltage is 'induced
electromotive force' which is usually abbreviated to induced e.m.f.
The iron core is laminated to prevent 'eddy currents' flowing in the core. These are
currents produced by the alternating magnetic field inducing a small voltage in the core,
just like that induced in the secondary coil. Eddy currents waste power by needlessly
heating up the core but they are reduced to a negligible amount by laminating the iron
because this increases the electrical resistance of the core without affecting its magnetic
properties. Transformers have two great advantages over other methods of changing
1. They provide total electrical isolation between the input and output, so they can
be safely used to reduce the high voltage of the mains supply.
2. Almost no power is wasted in a transformer. They have a high efficiency (power
out / power in) of 95% or more. Classification of Transformer

Step-Up Transformer
Step-Down Transformer

2.1.3 Rectifier
The purpose of a rectifier is to convert an AC waveform into a DC waveform
(OR) Rectifier converts AC current or voltages into DC current or voltage. There are two
different rectification circuits, known as 'half-wave' and 'full-wave' rectifiers. Both use
components called diodes to convert AC into DC. The Half-wave Rectifier

The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as
shown in figure.

Fig:2.3.1(a) Half Wave Rectifier

While the output of the half-wave rectifier is DC (it is all positive), it would not be
suitable as a power supply for a circuit. Firstly, the output voltage continually varies
between 0V and Vs-0.7V, and secondly, for half the time there is no output at all. The Full-wave Rectifier

The circuit in figure addresses the second of these problems since at no time is the output
voltage 0V. This time four diodes are arranged so that both the positive and negative
parts of the AC waveform are converted to DC.

Fig:2.3.2(a) Full-Wave Rectifier

When the AC input is positive, diodes A and B are forward-biased, while diodes C and D
are reverse-biased. When the AC input is negative, the opposite is true - diodes C and D
are forward-biased, while diodes A and B are reverse-biased.
While the full-wave rectifier is an improvement on the half-wave rectifier, its output still
isn't suitable as a power supply for most circuits since the output voltage still varies
between 0V and Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out.
2.1.4 Capacitor Filter

The capacitor-input filter, also called "Pi" filter due to its shape that looks like the
Greek letter pi, is a type of electronic filter. Filter circuits are used to remove unwanted or
undesired frequencies from a signal.

Fig:2.4(a) Capacitor Filter

A typical capacitor input filter consists of a filter capacitor C1, connected across the
rectifier output, an inductor L, in series and another filter capacitor connected across the
1. The capacitor C1 offers low reactance to the AC component of the rectifier output
while it offers infinite reactance to the DC component. As a result the capacitor
shunts an appreciable amount of the AC component while the DC component
continues its journey to the inductor L


2. The inductor L offers high reactance to the AC component but it offers almost
zero reactance to the DC component. As a result the DC component flows through
the inductor while the AC component is blocked.
3. The capacitor C2 bypasses the AC component which the inductor had failed to
block. As a result only the DC component appears across the load RL.

2.1.5Voltage Regulator
A voltage regulator is an electrical regulator designed to automatically maintain a
constant voltage level. It may use an electromechanical mechanism, or passive or active
electronic components. Depending on the design, it may be used to regulate one or more
AC or DC voltages. There are two types of regulator are they.
Positive Voltage Series (78xx) and
Negative Voltage Series (79xx)
78 indicate the positive series and xxindicates the voltage rating. Suppose 7805
produces the maximum 5V.05indicates the regulator output is 5V.
78 indicate the negative series and xxindicates the voltage rating. Suppose 7905
produces the maximum -5V.05indicates the regulator output is -5V.
These regulators consists the three pins there are
Pin1: It is used for input pin.
Pin2: This is ground pin for regulator
Pin3: It is used for output pin. Through this pin we get the output.


Fig:2.5 Regulator


CPU accesses the switches through ports. Therefore these switches are connected
to a microcontroller. This switch is connected between the supply and ground terminals.
A single microcontroller (consisting of a microprocessor, RAM and EEPROM and
several ports all on a single chip) takes care of hardware and software interfacing of the
These switches are connected to an input port. When no switch is pressed, reading
the input port will yield 1s since they are all connected to high (Vcc). But if any switch is
pressed, one of the input port pins will have 0 since the switch pressed provides the path
to ground. It is the function of the microcontroller to scan the switches continuously to
detect and identify the switch pressed.
The switches that we are using in our project are 4 leg micro switches of
momentary type.




Fig:2.6 Interfacing switch with the microcontroller
By reading the pin status, the microcontroller identifies whether the switch is
pressed or not. When the switch is pressed, the corresponding related to this switch press
written in the program will be executed.


The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller
with 8K bytes of in-system programmable Flash memory. The device is manufactured
using Atmels high-density nonvolatile memory technology and is compatible with the
industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with in-system programmable
Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to many embedded control

2.2.1 Standard Features

8K bytes of Flash,

256 bytes of RAM,

32 I/O lines,

Watchdog timer,

two data pointers,

three 16-bit timer/counters,

a six-vector two-level interrupt architecture,

a full duplex serial port, on-chip oscillator, and

clock circuitry.


In addition, the AT89S52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes.
The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial
port, and interrupt system to continue functioning. The Power-down mode saves the
RAM contents but freezes the oscillator, disabling all other chip functions until the next
interrupt or hardware reset.





block diagram of microcontroller PIN DESCRIPTION



Supply voltage.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 can also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode, P0
has internal pullups. Port 0 also receives the code bytes during Flash programming and
outputs the code bytes during program verification. External pullups are required during
program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally
being pulled low will source current (IIL) because of the internal pullups. In addition,
P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2)
and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the
following table. Port 1 also receives the low-order address bytes during Flash
programming and verification.


Table:3.3.1(a) port 1 alternate pin functions

Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally
being pulled low will source current (IIL) because of the internal pullups. Port 2 emits the
high-order address byte during fetches from external program memory and during
accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents
of the P2 Special Function Register. Port 2 also receives the high-order address bits and
some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally
being pulled low will source current (IIL) because of the pullups. Port 3 also serves the
functions of various special features of the AT89S52, as shown in the following table.
Port 3 also receives some control signals for Flash programming and verification.


Table:3.3.1(b) port 3 alternate functions

Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives High for 96 oscillator periods after the Watchdog times
out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In
the default state of bit DISRTO, the RESET HIGH out feature is enabled.
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG)
during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6
the oscillator frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external data memory. If
desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit
set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is
weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in
external execution mode.


Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access to
external data memory.
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions. This pin also receives the
12-volt programming enable voltage (VPP) during Flash programming.
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
Output from the inverting oscillator amplifier.


The microcontroller memory is divided into Program Memory and Data Memory.
Program Memory (ROM) is used for permanent saving program being executed, while
Data Memory (RAM) is used for temporarily storing and keeping intermediate results
and variables. Depending on the model in use (still referring to the whole 8052
microcontroller family) at most a few Kb of ROM and 128 or 256 bytes of RAM can be
used. However all 8052 microcontrollers have 16-bit addressing bus and can address 64
kb memory. It is neither a mistake nor a big ambition of engineers who were working on
basic core development. It is a matter of very clever memory organization which makes
these controllers a real programmers tidbit. Program Memory
The oldest models of the 8052 microcontroller family did not have any internal program
memory. It was added from outside as a separate chip. These models are recognizable by
their label beginning with 803 (for ex. 8031 or 8032). All later models have a few Kbytes
ROM embedded, Even though it is enough for writing most of the programs, there are


situations when additional memory is necessary. A typical example of it is the use of so

called lookup tables. They are used in cases when something is too complicated or when
there is no time for solving equations describing some process. The example of it can be
totally exotic or totally common. In those cases all needed estimates and approximates
are executed in advance and the final results are put in the tables (similar to logarithmic
EA=0 In this case, internal program memory is completely ignored, only a program
stored in external memory is to be executed.
EA=1 In this case, a program from built-in ROM is to be executed first (to the last
location). Afterwards, the execution is continued by reading additional memory.
In both cases, P0 and P2 are not available to the user because they are used for data and
address transmission. Besides, the pins ALE and PSEN are used too. Data Memory
Data Memory is used for temporarily storing and keeping data and intermediate results
created and used during microcontrollers operating. Besides, this microcontroller family
includes many other registers such as: hardware counters and timers, input/output ports,
serial data buffers etc. The previous versions have the total memory size of 256 locations,
while for later models this number is incremented by additional 128 available registers. In
both cases, these first 256 memory locations (addresses 0-FFh) are the base of the
memory Common to all types of the 8052 microcontrollers. Locations available to the
user occupy memory space with addresses from 0 to 7Fh. First 128 registers and this part
of RAM are divided in several blocks.
The first block consists of 4 banks each including 8 registers designated as R0 to R7.
Prior to access them, a bank containing that register must be selected. Next memory
block (in the range of 20h to 2Fh) is bit- addressable, which means that each bit being
there has its own address from 0 to 7Fh. Since there are 16 such registers, this block
contains in total of 128 bits with separate addresses (The 0th bit of the 20h byte has the
bit address 0 and the 7th bit of the 2Fh byte has the bit address 7Fh). The third groups of


registers occupy addresses 2Fh-7Fh (in total of 80 locations) and does not have any
special purpose or feature.
In case on-chip memory is not enough, it is possible to add two external memory chips
with capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data
Similar occurs when it is a needed to read some location from external Data Memory.
Addressing is performed in the same way, while reading or writing is performed via
signals which appear on the control outputs RD or WR.


Fig:3.4.2(b) memory organisation


2.2.4 Addressing
While operating, processor processes data according to the program instructions. Each
instruction consists of two parts. One part describes what should be done and another part
indicates what to use to do it. This later part can be data (binary number) or address
where the data is stored. All 8052 microcontrollers use two ways of addressing depending
on which part of memory should be accessed: Direct Addressing
On direct addressing, a value is obtained from a memory location while the address of
that location is specified in instruction. Only after that, the instruction can process data
(how depends on the type of instruction: addition, subtraction, copy). Obviously, a
number being changed during operating a variable can reside at that specified address.
For example:
Since the address is only one byte in size ( the greatest number is 255), this is how only
the first 255 locations in RAM can be accessed in this case the first half of the basic
RAM is intended to be used freely, while another half is reserved for the SFRs. Indirect Addressing
On indirect addressing, a register which contains address of another register is specified
in the instruction. A value used in operating process resides in that another register. For
Only RAM locations available for use are accessed by indirect addressing (never in the
SFRs). For all latest versions of the microcontrollers with additional memory block
(those 128 locations in Data Memory), this is the only way of accessing them. Simply,
when during operating, the instruction including @ sign is encountered and if the
specified address is higher than 128 (7F hex.), the processor knows that indirect
addressing is used and jumps over memory space reserved for the SFRs.
On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit
addresses. Since only 8 bits are available, it is possible to access only registers of internal
RAM in this way (128 locations in former or 256 locations in latest versions of the


microcontrollers). If memory extension in form of additional memory chip is used then

the 16-bit DPTR Register (consisting of the registers DPTRL and DPTRH) is used for
specifying addresses. In this way it is possible to access any location in the range of 64K.
2.2.5 REGISTERS SFRs (Special Function Registers)
SFRs are a kind of control table used for running and monitoring microcontrollers
operating. Each of these registers, even each bit they include, has its name, address in the
scope of RAM and clearly defined purpose ( for example: timer control, interrupt, serial
connection etc.). Even though there are 128 free memory locations intended for their
storage, the basic core, shared by all types of 8052 controllers, has only 21 such registers.
Rest of locations are intentionally left free in order to enable the producers to further
improved models keeping at the same time compatibility with the previous versions. It
also enables the use of programs written a long time ago for the microcontrollers which
are out of production now. A Register (Accumulator)
This is a general-purpose register which serves for storing intermediate results
during operating. A number (an operand) should be added to the accumulator prior to
execute an instruction upon it. Once an arithmetical operation is preformed by the ALU,
the result is placed into the accumulator. If a data should be transferred from one register
to another, it must go through accumulator. For such universal purpose, this is the most
commonly used register that none microcontroller can be imagined without (more than a
half 8052 microcontroller's instructions used use the accumulator in some way). B Register
B register is used during multiply and divide operations which 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).
During programming, each of registers is called by name so that their exact address is not
so important for the user. During compiling into machine code (series of hexadecimal


numbers recognized as instructions by the microcontroller), PC will automatically,

instead of registers name, write necessary addresses into the microcontroller. R Registers (R0-R7)
This is a common name for the total 8 general purpose registers (R0, R1, R2
...R7). Even they are not true SFRs, they deserve to be discussed here because of their
purpose. The bank is active when the R registers it includes are in use. Similar to the
accumulator, they are used for temporary storing variables and intermediate results.
Which of the banks will be active depends on two bits included in the PSW Register.
These registers are stored in four banks in the scope of RAM.

To generate a 36 KHz pulsating infrared is quite easy, more difficult is to receive
and identify this frequency. This is why some companies produce infrared receives, that
contains the filters, decoding circuits and the output shaper, that delivers a square wave,
meaning the existence or not of the 36kHz incoming pulsating infrared.
It means that those 3 dollars small units, have an output pin that goes high (+5V)
when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not
this radiation.

Fig: 4.1(a) IR transmitter


A square wave of approximately 27uS (microseconds) injected at the base of a transistor,

can drive an infrared LED to transmit this pulsating light wave. Upon its presence, the
commercial receiver will switch its output to high level (+5V).If you can turn on and off
this frequency at the transmitter, your receiver's output will indicate when the transmitter
is on or off.

Fig: 4.1(b) waveform for transmitter

Those IR demodulators have inverted logic at its output, when a burst of IR is sensed it
drives its output to low level, meaning logic level = 1.
The TV, VCR, and Audio equipment manufacturers for long use infra-red at their remote
controls. To avoid a Philips remote control to change channels in a Panasonic TV, they
use different codification at the infrared, even that all of them use basically the same
transmitted frequency, from 36 to 50 KHz. So, all of them use a different combination of
bits or how to code the transmitted data to avoid interference.
Various remote control systems are used in electronic equipment today. The RC5
control protocol is one of the most popular and is widely used to control numerous home
appliances, entertainment systems and some industrial applications including utility
consumption remote meter reading, contact-less apparatus control, telemetry data
transmission, and car security systems. Philips originally invented this protocol and
virtually all Philips remotes use this protocol. Following is a description of the RC5.


When the user pushes a button on the hand-held remote, the device is activated and sends
modulated infrared light to transmit the command. The remote separates command data
into packets. Each data packet consists of a 14-bit data word, which is repeated if the user
continues to push the remote button. The data packet structure is as follows:

2 start bits,

1 control bit,

5 address bits,

6 command bits.

The start bits are always logic 1 and intended to calibrate the optical receiver automatic
gain control loop. Next, is the control bit. This bit is inverted each time the user releases
the remote button and is intended to differentiate situations when the user continues to
hold the same button or presses it again. The next 5 bits are the address bits and select the
destination device. A number of devices can use RC5 at the same time. To exclude
possible interference, each must use a different address. The 6 command bits describe the
actual command. As a result, a RC5 transmitter can send the 2048 unique commands. The
transmitter shifts the data word, applies Manchester encoding and passes the created onebit sequence to a control carrier frequency signal amplitude modulator. The amplitude
modulated carrier signal is sent to the optical transmitter, which radiates the infrared
light. In RC5 systems the carrier frequency has been set to 36 kHz. Figure below displays
the RC5 protocol.
The receiver performs the reverse function. The photo detector converts optical
transmission into electric signals, filters it and executes amplitude demodulation. The
receiver output bit stream can be used to decode the RC5 data word. This operation is
done by the microprocessor typically, but complete hardware implementations are present
on the market as well. Single-die optical receivers are being mass produced by a number
of companies such as Siemens, Temic, Sharp, Xiamen Hualian, Japanese Electric and


others. Please note that the receiver output is inverted (log. 1 corresponds to illumination

The IR LED emitting infrared light is put on in the transmitting unit. To generate IR
signal, 555 IC based astable multivibrator is used. Infrared LED is driven through
transistor BC 548.
IC 555 is used to construct an astable multivibrator which has two quasi-stable
states. It generates a square wave of frequency 38 kHz and amplitude 5Volts. It is
required to switch ON the IR LED. The IR transmitter circuit is as shown below: 555 TIMER:

Fig:4.2.1(a) 555- timer

The 555 is an integrated circuit (chip) implementing a variety of timer and

multivibrator applications. It was designed in 1970 and introduced in 1971 by Signetics


(later acquired by Philips). The original name was the SE555/NE555 and was called
"The IC Time Machine". It is still in wide use, thanks to its ease of use, low price and
good stability. As of 2003, 1 billion units are manufactured every year.
The 555 timer is one of the most popular and versatile integrated circuits ever
produced. It includes 23 transistors, 2 diodes and 16 resistors on a silicon chip installed in
an 8-pin mini dual-in-line package (DIP-8). The 556 is a 14-pin DIP that combines two
555s on a single chip.

Fig:4.2.1(b) 555 timer pin

Pin Functions - 8 pin package

Ground (Pin 1)
This pin is connected directly to ground.
Trigger (Pin 2)
This pin is the input to the lower comparator and is used to set the latch, which in turn
causes the output to go high.
Output (Pin 3)


Output high is about 1.7V less than supply. Output high is capable of sourcing up to
200mA while output low is capable of sinking up to 200mA.
Reset (Pin 4)
This is used to reset the latch and return the output to a low state. The reset is an
overriding function. When not used connect to V+.

Control (Pin 5)
Allows access to the 2/3V+ voltage divider point when the 555 timer is used in voltage
control mode. When not used connect to ground through a 0.01 uF capacitor.
Threshold (Pin 6)
This is an input to the upper comparator.
Discharge (Pin 7)
This is the open collector to Q14.
V+ (Pin 8)
This connects to Vcc and the Philips data book states the ICM7555 CMOS version
operates 3V - 16V DC while the NE555 version is 3V - 16V DC.

The 555 has three operating modes:

Monostable mode: in this mode, the 555 functions as a "one-shot". Applications

include timers, missing pulse detection, bounce free switches, touch switches,
Frequency Divider, Capacitance Measurement, Pulse Width Modulation (PWM)

Astable mode: Free Running mode: the 555 can operate as an oscillator. Uses
include LED and lamp flashers, pulse generation, logic clocks, tone generation,
security alarms, pulse position modulation, etc.


Bistable mode: The 555 can operate as a flip-flop, if the DIS pin is not connected
and no capacitor is used. Uses include bounce free latched switches, etc.
This circuit diagram shows how a 555 timer IC is configured to function as an

astable multivibrator. An astable multivibrator is a timing circuit whose 'low' and

'high' states are both unstable. As such, the output of an astable multivibrator toggles
between 'low' and 'high' continuously, in effect generating a train of pulses. This
circuit is therefore also known as a 'pulse generator' circuit.
In this circuit, capacitor C1 charges through R1 and R2, eventually building up
enough voltage to trigger an internal comparator to toggle the output flip-flop. Once
toggled, the flip-flop discharges C1 through R2 into pin 7, which is the discharge pin.
When C1's voltage becomes low enough, another internal comparator is triggered to
toggle the output flip-flop. This once again allows C1 to charge up through R1 and R2
and the cycle starts all over again.
C1's charge-up time t1 is given by: t1 = 0.693(R1+R2) C1. C1's discharge time
t2 is given by: t2 = 0.693(R2) C1. Thus, the total period of one cycle is t1+t2 = 0.693
C1 (R1+2R2). The frequency f of the output wave is the reciprocal of this period, and
is therefore given by:
f = 1.44/ (C1 (R1+2R2))
where f is in Hz if R1 and R2 are in megaohms and C1 is in microfarads.


Fig:4.2.1(c) astable multivibrater

The TSOP17.. Series are miniaturized receivers for infrared remote control
systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is
designed as IR filter.
The demodulated output signal can directly be decoded by a microprocessor.
TSOP17.. is the standard IR remote control receiver series, supporting all major
transmission codes.

Photo detector and preamplifier in one package

Internal filter for PCM frequency

Improved shielding against electrical field disturbance

TTL and CMOS compatibility

Output active low


Low power consumption

High immunity against ambient light

Continuous data transmission possible (up to 2400 bps)

Suitable burst length .10 cycles/burst

Fig: 4.3(a) block diagram of IR receiver

Fig: 4.3(b) application circuit

Suitable Data Format
The circuit of the TSOP17 is designed in that way that unexpected output pulses
due to noise or disturbance signals are avoided. A bandpass filter, an integrator stage and
an automatic gain control are used to suppress such disturbances. The distinguishing
mark between data signal and disturbance signal are carrier frequency, burst length and
duty cycle. The data signal should fulfill the following condition:
Carrier frequency should be close to center frequency of the bandpass (e.g. 38 KHz).


Burst length should be 10 cycles/burst or longer.

After each burst which is between 10 cycles and 70 cycles a gap time of at least 14
cycles is necessary.
For each burst which is longer than 1.8ms a corresponding gap time is necessary at
some time in the data stream. This gap time should have at least same length as the burst.
Up to 1400 short bursts per second can be received continuously.
Some examples for suitable data format are: NEC Code, Toshiba Micom Format,
Sharp Code, RC5 Code, RC6 Code, R2000 Code and Sony Format (SIRCS). When a
disturbance signal is applied to the TSOP17.. It can still receive the data signal. However
the sensitivity is reduced to that level that no unexpected pulses will occur. Some
examples for such disturbance signals which are suppressed by the TSOP17 are:
DC light (e.g. from tungsten bulb or sunlight)
Continuous signal at 38 kHz or at any other frequency
Signals from fluorescent lamps with electronic ballast

2.3.4 IR Emitter and phototransistor:

An infrared emitter is an LED made from gallium arsenide, which emits nearinfrared energy at about 880nm. The infrared phototransistor acts as a transistor with the
base voltage determined by the amount of light hitting the transistor. Hence it acts as a
variable current source. Greater amount of IR light cause greater currents to flow through
the collector-emitter leads.
The variable current traveling through the resistor causes a voltage drop in the pull-up
resistor. This voltage is measured as the output of the device


Fig: 4.4

3.3.5 Photo Sensors array:

IR reflectance sensors contain a matched infrared transmitter and infrared receiver pair.
These devices work by measuring the amount of light that is reflected into the receiver.
Because the receiver also responds to ambient light, the device works best when well
shielded from ambient light, and when the distance between the sensor and the reflective
surface is small(less than 5mm). IR reflectance sensors are often used to detect white and
black surfaces. White surfaces generally reflect well, while black surfaces reflect poorly.
One of such applications is the line follower of a robot.







fig: 4.5(b) Schematic Diagram for a Single Pair of Infrared Transmitter and


Fig:4.5(c) schematic of a single sensor

2.4 LM 324

Wide gain bandwidth . : 1.3MHZ input common-mode voltage range

Includes ground .largevoltage gain : 100DB .very lowsupply current/ampli :

375ma .low input bias current : 20NA low input offset voltage : 5mv max.

Low input offset current : 2NA wide power supply range :

Single supply : +3v to +30v

Dual supplies : 1.5v to 15v

These circuits consist of four independent, high gain, internally frequency compensated
operational amplifiers .They operate from a single power supply over a wide range of
voltages. Operation from split power supplies is also possible and the low power supply
current drain is independent of the magnitude of the power supply voltage.


Fig:6.2(a) pin configuration (top view)


DC motor
A DC motor is an electric motor that runs on direct current (DC) electricity.
DC Motor Connections
Figure shows schematically the different methods of connecting the field and armature
circuits in a DC Motor. The circular symbol represents the armature circuit, and the
squares at the side of the circle represent the brush commutator system. The direction of
the arrows indicates the direction of the magnetic fields.

Fig:7 DC motor connections


2.5.1 Principles of operation

In any electric motor, operation is based on simple electromagnetism. A current-carrying
conductor generates a magnetic field; when this is then placed in an external magnetic
field, it will experience a force proportional to the current in the conductor, and to the
strength of the external magnetic field. As you are well aware of from playing with
magnets as a kid, opposite (North and South) polarities attract, while like polarities
(North and North, South and South) repel. The internal configuration of a DC motor is
designed to harness the magnetic interaction between a current-carrying conductor and an
external magnetic field to generate rotational motion.
Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet
or winding with a "North" polarization, while green represents a magnet or winding with
a "South" polarization).

Fig:7.1(a) internal structure of motor

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator,
field magnet(s), and brushes. In most common DC motors (and all that Beamers will see),
the external magnetic field is produced by high-strength permanent magnets. The stator is
the stationary part of the motor -- this includes the motor casing, as well as two or more
permanent magnet pole pieces. The rotor (together with the axle and attached
commutator) rotates with respect to the stator. The rotor consists of windings (generally
on a core), the windings being electrically connected to the commutator. The above
diagram shows a common motor layout -- with the rotor inside the stator (field) magnets.


The geometry of the brushes, commutator contacts, and rotor windings are such that
when power is applied, the polarities of the energized winding and the stator magnet(s)
are misaligned, and the rotor will rotate until it is almost aligned with the stator's field
magnets. As the rotor reaches alignment, the brushes move to the next commutator
contacts, and energize the next winding. Given our example two-pole motor, the rotation
reverses the direction of current through the rotor winding, leading to a "flip" of the
rotor's magnetic field, driving it to continue rotating.
In real life, though, DC motors will always have more than two poles (three is a very
common number). In particular, this avoids "dead spots" in the commutator. You can
imagine how with our example two-pole motor, if the rotor is exactly at the middle of its
rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile,
with a two-pole motor, there is a moment where the commutator shorts out the power
supply (i.e., both brushes touch both commutator contacts simultaneously). This would
be bad for the power supply, waste energy, and damage motor components as well. Yet
another disadvantage of such a simple motor is that it would exhibit a high amount of
torque "ripple" (the amount of torque it could produce is cyclic with the position of the

Fig:7.1(b) motor rotation in clockwise direction

So since most small DC motors are of a three-pole design, let's tinker with the workings
of one via an interactive animation.


Fig:7.1(c) 3 pole design

You'll notice a few things from this -- namely, one pole is fully energized at a time (but
two others are "partially" energized). As each brush transitions from one commutator
contact to the next, one coil's field will rapidly collapse, as the next coil's field will
rapidly charge up (this occurs within a few microsecond). We'll see more about the
effects of this later, but in the meantime you can see that this is a direct result of the coil
windings' series wiring:

Fig:7.1(d) iron core amature

The use of an iron core armature (as in the Mabuchi, above) is quite common, and has a
number of advantages. First off, the iron core provides a strong, rigid support for the
windings -- a particularly important consideration for high-torque motors. The core also
conducts heat away from the rotor windings, allowing the motor to be driven harder than
might otherwise be the case. Iron core construction is also relatively inexpensive
compared with other construction types.


But iron core construction also has several disadvantages. The iron armature has a
relatively high inertia which limits motor acceleration. This construction also results in
high winding inductances which limit brush and commutator life.
In small motors, an alternative design is often used which features a 'coreless' armature
winding. This design depends upon the coil wire itself for structural integrity. As a result,
the armature is hollow, and the permanent magnet can be mounted inside the rotor coil.
Coreless DC motors have much lower armature inductance than iron-core motors of
comparable size, extending brush and commutator life.

Fig:7.1(e) parts of motor

DC motor behavior
High-speed output
This is the simplest trait to understand and treat -- most DC motors run at very high
output speeds (generally thousands or tens of thousands of RPM). While this is fine for
some BEAM bots (say, photo poppers or solar rollers), many BEAM bots (walkers,
heads) require lower speeds -- you must put gears on your DC motor's output for these
An H-bridge is an electronic circuit which enables DC electric motors to be run forwards
or backwards. These circuits are often used in robotics. H-bridges are available as
integrated circuits, or can be built from discrete components.


Fig:8 H-bridge switch diagram

The two basic states of a H-bridge. The term "H-bridge" is derived from the
typical graphical representation of such a circuit. An H-bridge is built with four switches
(solid-state or mechanical). When the switches S1 and S4 (according to the first figure)
are closed (and S2 and S3 are open) a positive voltage will be applied across the motor.
By opening S1 and S4 switches and closing S2 and S3 switches, this voltage is reversed,
allowing reverse operation of the motor.
Using the nomenclature above, the switches S1 and S2 should never be closed at the
same time, as this would cause a short circuit on the input voltage source. The same
applies to the switches S3 and S4. This condition is known as shoot-through.

2.6.1 Operation
The H-Bridge arrangement is generally used to reverse the polarity of the motor, but can
also be used to 'brake' the motor, where the motor comes to a sudden stop, as the motors
terminals are shorted, or to let the motor 'free run' to a stop, as the motor is effectively
disconnected from the circuit. The following table summarizes operation.

S1 S2 S3 S4


1 0

Motor moves right

0 1

Motor moves left

0 0

Motor free runs

0 1

Motor brakes

Table: 8.1 H-bridge switch operation


2.6.2 H-Bridge Driver:

The switching property of this H-Bridge can be replaced by a Transistor or a Relay or a
Mosfet or even by an IC. Here we are replacing this with an IC named L293D as the
driver whose description is as given below.




1.2A PEAK OUTPUT CURRENT (non repetitive)







The Device is a monolithic integrated high voltage, high current four channel driver
designed to accept standard DTL or TTL logic levels and drive inductive loads (such as
relays solenoides, DC and stepping motors) and switching power transistors. To simplify
use as two bridges each pair of channels is equipped with an enable input. A separate
supply input is provided for the logic, allowing operation at a lower voltage and internal
clamp diodes are included. This device is suitable for use in switching applications at
frequencies up to 5 kHz. The L293D is assembled in a 16 lead plastic package which has
4 center pins connected together and used for heat sinking The L293DD is assembled in a
20 lead surface mount which has 8 center pins connected together and used for heat



Fig: 8.5(a) block diagram of H-bridge


fig:8.5(b) pin configuration of H-bridge


Robotics is an interesting subject to discuss about and in this advanced world Robots are
becoming a part of our life. In this project we are going to discuss about a robot which is
capable of following a line without the help of any external source.
The Embedded Line following robot uses two motors to control rear wheels and the
single front wheel is free. It has 3-infrared sensors on the bottom for detection of black
tracking tape. When the middle sensor detects the black color, this sensor output is given
to the comparator LM324. The output of comparator compares this sensor output with a
reference voltage and gives an output. The output of comparator will be low when it
receives an input from the sensor.
We follow a simple logic to implement this project. As we know that black colour is
capable of absorbing the radiation and white colour or a bright colour reflects the
radiation back. Here we use 3 pairs of IR TX and Rx .The robot uses these IR sensors to
sense the line and the arrangement is made such that sensors face the ground. The output
from the sensors is an analog signal which depends on the amount of light reflected back
and this analog signal is given to the comparator to produce 0s and 1s.
Internally we have an OTP (one time programmable) processor which is used to
control the rotation of the wheels. The rotation of these wheels depends up on the
response from the comparator. Let us assume that when a sensor is on the black line it
reads 0 and when it is on the bright surface it reads 1.
Here we can get three different cases, they are:
1. Straight direction
2. Right curve
3. Left curve


3.1.1 Straight direction:

We can expect our robot to move in straight direction when the middle sensors response
is low and the remaining two sensors response is high. i.e., according to our arrangement
the middle sensor will always be on the line and as the line is black in colour it will not
reflect the emitted radiation back and the response of the sensor will be low and the
response of the remaining two sensors will be high as they will be on the bright surface.
3.1.2 Right curve:
When a right curve is found on the line the responses will change i.e. the response of the
first sensor which is to the right will become low as that sensor will be facing the black
line and the reaming sensors response will be high. We this data is achieved the control of
the wheels is changed i.e. the right wheel is held and the left wheel is made to move
freely until the response from the middle sensor becomes low. Then the same process
repeats again.
3.1.3 Left curve:
When a left curve is found on the line the response of the left most sensor will be
changed from high to low as the sensor will now face the black or the dark surface. Then
the control of the wheel changes i.e. by holding the left wheel and allowing the right
wheel to move freely until the middle sensor changes its response fro high to low.
The same process continues for all the turns and the robot moves continuously until the
supply is remove


Check for line

Line detected go right

Check for line

If no line turn left till line detected


Keil compiler is a software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which
is to be dumped into the microcontroller for further processing. Keil compiler also
supports C language code.
1. Install the Keil Software in the PC in any of the drives.
2. After installation, an icon will be created with the name Keil uVision3. Just
drag this icon onto the desktop so that it becomes easy whenever you try to write
programs in keil.
3. Double click on this icon to start the keil compiler.
4. A page opens with different options in it showing the project workspace at the
leftmost corner side, output window in the bottom and an ash coloured space for
the program to be written.
5. Now to start using the keil, click on the option project.
6. A small window opens showing the options like new project, import project, open
project etc. Click on New project.
7. A small window with the title bar Create new project opens. The window asks
the user to give the project name with which it should be created and the
destination location. The project can be created in any of the drives available. You
can create a new folder and then a new file or can create directly a new file.


8. After the file is saved in the given destination location, a window opens where a
list of vendors will be displayed and you have to select the device for the target
you have created.
9. The most widely used vendor is Atmel. So click on Atmel and now the family of
microcontrollers manufactured by Atmel opens. You can select any one of the
microcontrollers according to the requirement.
10. When you click on any one of the microcontrollers, the features of that particular
microcontroller will be displayed on the right side of the page. The most
appropriate microcontroller with which most of the projects can be implemented
is the AT89S52. Click on this microcontroller and have a look at its features. Now
click on OK to select this microcontroller.
11. A small window opens asking whether to copy the startup code into the file you
have created just now. Just click on No to proceed further.
12. Now you can see the TARGET and SOURCE GROUP created in the project
13. Now click on File and in that New. A new page opens and you can start
writing program in it.
14. After the program is completed, save it with any name but with the .asm
extension. Save the program in the file you have created earlier.
15. You can notice that after you save the program, the predefined keywords will be
highlighted in bold letters.
16. Now add this file to the target by giving a right click on the source group. A list of
options open and in that select Add files to the source group. Check for this file
where you have saved and add it.
17. Right click on the target and select the first option Options for target. A window
opens with different options like device, target, output etc. First click on target.
18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with
the PC, just enter this frequency value in the Xtal (MHz) text area and put a tick
on the Use on-chip ROM. This is because the program what we write here in the
keil will later be dumped into the microcontroller and will be stored in the inbuilt
ROM in the microcontroller.


19. Now click the option Output and give any name to the hex file to be created in
the Name of executable text area and put a tick to the Create HEX file option
present in the same window. The hex file can be created in any of the drives. You
can change the folder by clicking on Select folder for Objects.
20. Now to check whether the program you have written is errorless or not, click on
the icon exactly below the Open file icon which is nothing but Build Target
icon. You can even use the shortcut key F7 to compile the program written.
21. To check for the output, there are several windows like serial window, memory
window, project window etc. Depending on the program you have written, select
the appropriate window to see the output by entering into debug mode.
22. The icon with the letter d indicates the debug mode.
23. Click on this icon and now click on the option View and select the appropriate
window to check for the output.
24. After this is done, click the icon debug again to come out of the debug mode.
25. The hex file created as shown earlier will be dumped into the microcontroller with
the help of another software called Proload.


Proload is software which accepts only hex files. Once the machine code is
converted into hex code, that hex code has to be dumped into the microcontroller placed
in the programmer kit and this is done by the Proload. Programmer kit contains a
microcontroller on it other than the one which is to be programmed. This microcontroller
has a program in it written in such a way that it accepts the hex file from the keil
compiler and dumps this hex file into the microcontroller which is to be programmed. As
this programmer kit requires power supply to be operated, this power supply is given
from the power supply circuit designed above. It should be noted that this programmer kit
contains a power supply section in the board itself but in order to switch on that power
supply, a source is required. Thus this is accomplished from the power supply board with
an output of 12volts or from an adapter connected to 230 V AC.
1. Install the Proload Software in the PC.
2. Now connect the Programmer kit to the PC (CPU) through serial cable.
3. Power up the programmer kit from the ac supply through adapter.
4. Now place the microcontroller in the GIF socket provided in the programmer kit.
5. Click on the Proload icon in the PC. A window appears providing the information
like Hardware model, com port, device type, Flash size etc. Click on browse
option to select the hex file to be dumped into the microcontroller and then click
on Auto program to program the microcontroller with that particular hex file.
6. The status of the microcontroller can be seen in the small status window in the
bottom of the page.
7. After this process is completed, remove the microcontroller from the programmer
kit and place it in your system board. Now the system board behaves according to
the program written in the microcontroller.


The objective of the line following robot is to follow a line on its given path which is
obtained for which it uses IR sensors which detects the line and sends the information to
LM324 comparator and then to H bridge which controls the working of the wheels.
Microcontroller controls the other operations.


In this project we have studied and implemented a Line Following Robot using a
Microcontroller for blind people. The programming and interfacing of microcontroller
has been mastered during the implementation.


Smarter versions of line followers are used to deliver mails within office building
and deliver medications in a hospital.

This technology has been suggested for running buses and other mass transit
systems and may end up as a part of autonomous cars navigating the freeway.


4. Magazines-Electronics for you
5. Electrikindia.
6. www.electronic