Академический Документы
Профессиональный Документы
Культура Документы
PROJECT REPORT
ON
AUTOMATIC SPEED CONTROL SYSTEM BY THE COLOR
SENSOR FOR AUTOMOBILES
ABSTRACT
Speed control is in the need of the hour due to the increased rate of accidents reported in our
day-to-day life. During 2011, in India a whole of 4, 97,686 road accidents were reported
which is a result of lack of speed control and violating the road rules. Road accidents can be
prevented by adopting measures such as Traffic management, improving quality of road
infrastructure and safer vehicles. The existing techniques still doesnt able to reduce the
number of accidents.
Hence there is a need to implement Intelligent Speed Adaptation (ISA) in which vehicles
speed can be automatically controlled by various limit techniques which are based on zones,
highway, traffic density etc.
In this research work, it proposes automatic speed control system based on color strips for
highway road and the roads where the speed control within limit is required. The
methodology explains that a various color strips are marked on highway road or the roads
where the speed control within limit is required and vehicle will have a color sensor attached
which will recognize the color marked on the highway road and accordingly maintain the
vehicles speed in that particular limit. In this developed system, the color detecting sensor of
specific intensity is used to activate/deactivate the system of speed control within the color
strips marked on the road. In actual practice, the system works that when vehicle enter in
speed limiting roads like expresshigh way, high way and any other roads where the speed
limit is required etc., the vehicle sensor detect the color to activate the system and send the
signals to programmable ECU/MCU and the programmable ECU /MCU controls the position
of throttle valve/fuel pump/motor which result in controlling the speed of engine at given
Limit.
When the system activated then our vehicle is controlled at given limited speed or below that
limiting speed and cannot exceed beyond that limit till the next color strip crossed. This
reduces the road accidents and gets driving comfort for the driver, after implementation of
this automatic speed control system.
Keywords: Speed control, road accidents, color detecting Sensor, Programmable MCU,
Vehicle, implementation etc.
TABLE OF CONTENTS
ABSTRACT
CHAPTER-1: INTRODUCTION
Introduction of Project
Embedded Introduction
Microcontroller Introduction
CHAPTER-2: BLOCK DIAGRAM AND CIRCUIT DESCRIPTION
Block Diagram
Block Diagram Description
Circuit Diagram
Circuit Description
CHAPTER-3: COMPONENT DESCRIPTION
At89s52
Lcd
Rf Module
Motor Driver
Adc
Temperature Sensor
Heart Rate Sensor
Pir Sensor
Dc Motor
CHAPTER-4: ADVANTAGES, DISADVANTAGES AND APPLICATIONS
Advantages
Disadvantages
Applications
CHAPTER-5: SOFTWARE DESCRIPTION AND CODING
Introduction Of Keil
Code
CHAPTER-6 : RESULTS AND FUTURE SCOPE
Results
Future Scope
CONCLUSION
REFERENCE
CHAPTER-1
INTRODUCTION
INTRODUCTION OF PROJECT
Research on fully and partially automated roadway systems is being conducted in most
developed countries. The major technologies are unlikely to be introduced before the end of
the century and some are unlikely to be implemented within two decades. These systems
offer excellent opportunities to control vehicle speeds and movements in order to avoid
accidents but they rely, of course, on sophisticated features built into the roadway and
vehicle. Progress with these systems should be monitored but they are unlikely to offer any
significant short term solutions. But various types of accident are occurred on express
highway road, highway road, off road just because of small uncertain activities. Rash driving,
system failure, collision due to obstacles, exiting speed control limit etc. are just some causes
of accidents. For prevention of this accident, government made some rules. Such as helmet,
seat belt compulsion etc.
Speed control at particular type of road is also necessary to avoid accidents. For this, there is
no any system to control the speed of vehicle. Thats why, there is need to invent such system
which control the speed of vehicle automatically at given limit at particular limiting distance.
If this concept methodology system is possible, the problems related to traffic as well as
accidents due to collision will be controlled.
Now it is possible to control or set the speed of vehicle at a given limit on the roads like
highways, express high ways and any area where the speed limit is desired by the technique
suggested in methodology described in this paper.
In India mostly 65 km/hr.limit for high ways and below 80km/hr. limit for express highways.
This developed system is applicable for any speed limit which can be set or controlled as per
the roads.
In this paper, the proposed methodology is suggested that one such kind of speed control
system based on color strips for highway. The various design components of this system are
the color strips which are painted on highway roads and a color sensor located below the
bumper on chassis which will recognize the color on roads, the programmable MCU which
process signals from various components and send the signal to control the throttle valve/fuel
pump, speedometer and vehicle.
Embedded systems are electronic devices that incorporate microprocessors with in their
implementations. The main purposes of the microprocessors are to simplify the system design
and provide flexibility. Having a microprocessor in the device helps in removing the bugs,
making modifications, or adding new features are only matter of rewriting the software that
controls the device. Or in other words embedded computer systems are electronic systems
that include a microcomputer to perform a specific dedicated application. The computer is
hidden inside these products. Embedded systems are ubiquitous. Every week millions of tiny
computer chips come pouring out of factories finding their way into our everyday products.
Embedded systems are self-contained programs that are embedded within a piece of
hardware. Whereas a regular computer has many different applications and software that can
be applied to various tasks, embedded systems are usually set to a specific task that cannot be
altered without physically manipulating the circuitry. Another way to think of an embedded
system is as a computer system that is created with optimal efficiency, thereby allowing it to
complete specific functions as quickly as possible.
Embedded systems designers usually have a significant grasp of hardware technologies. They
use specific programming languages and software to develop embedded systems and
manipulate the equipment. When searching online, companies offer embedded systems
development kits and other embedded systems tools for use by engineers and businesses.
Embedded systems technologies are usually fairly expensive due to the necessary
development time and built in efficiencies, but they are also highly valued in specific
industries. Smaller businesses may wish to hire a consultant to determine what sort of
embedded systems will add value to their organization.
CHARACTERISTICS:
Two major areas of differences are cost and power consumption. Since many embedded
systems are produced in tens of thousands to millions of units range, reducing cost is a major
concern. Embedded systems often use a (relatively) slow processor and small memory size to
minimize costs.
The slowness is not just clock speed. The whole architecture of the computer is often
intentionally simplified to lower costs. For example, embedded systems often use peripherals
controlled by synchronous serial interfaces, which are ten to hundreds of times slower than
comparable peripherals used in PCs. Programs on an embedded system often run with real-
time constraints with limited hardware resources: often there is no disk drive, operating
system, keyboard or screen. A flash drive may replace rotating media, and a small keypad and
LCD screen may be used instead of a PC's keyboard and screen.
Firmware is the name for software that is embedded in hardware devices, e.g. in one or more
ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain 100%
reliability while running continuously for long periods, sometimes measured in years.
Firmware is usually developed and tested too much harsher requirements than is general-
purpose software, which can usually be easily restarted if a problem occurs.
PLATFORM:
There are many different CPU architectures used in embedded designs. This in contrast to the
desktop computer market which is limited to just a few competing architectures mainly the
Intel/AMD x86 and the Apple/Motorola/IBM Power PCs which are used in the Apple
Macintosh. One common configuration for embedded systems is the system on a chip, an
application-specific integrated circuit, for which the CPU was purchased as intellectual
property to add to the IC's design.
TOOLS:
Like a typical computer programmer, embedded system designers use compilers, assemblers
and debuggers to develop an embedded system. Those software tools can come from several
sources:
Software companies that specialize in the embedded market Ported from the GNU software
development tools. Sometimes, development tools for a personal computer can be used if the
embedded processor is a close relative to a common PC processor. Embedded system
designers also use a few software tools rarely used by typical computer programmers. Some
designers keep a utility program to turn data files into code, so that they can include any kind
of data in a program. Most designers also have utility programs to add a checksum or CRC to
a program, so it can check its program data before executing it.
OPERATING SYSTEM:
They often have no operating system, or a specialized embedded operating system
(often a real-time operating system), or the programmer is assigned to port one of these to the
new system.
DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type of debugger that
can interrupt the micro controllers internal microcode. The microcode interrupt lets the
debugger operate in hardware in which only the CPU works. The CPU-based debugger can
be used to test and debug the electronics of the computer from the viewpoint of the CPU.
Developers should insist on debugging which shows the high-level language, with
breakpoints and single stepping, because these features are widely available. Also, developers
should write and use simple logging facilities to debug sequences of real-time events. PC or
mainframe programmers first encountering this sort of programming often become confused
about design priorities and acceptable methods. Mentoring, code-reviews and ego less
programming are recommended.
START-UP:
All embedded systems have start-up code. Usually it disables interrupts, sets up the
electronics, tests the computer (RAM, CPU and software), and then starts the application
code. Many embedded systems recover from short-term power failures by restarting (without
recent self-tests). Restart times under a tenth of a second are common.
Many designers have found one of more hardware plus software-controlled LEDs useful to
indicate errors during development (and in some instances, after product release, to produce
troubleshooting diagnostics). A common scheme is to have the electronics turn off the LED(s)
at reset, whereupon the software turns it on at the first opportunity, to prove that the hardware
and start-up software have performed their job so far. After that, the software blinks the
LED(s) or sets up light patterns during normal operation, to indicate program execution
progress and/or errors. This serves to reassure most technicians/engineers and some users.
In this design, the software has a loop. The loop calls subroutines. Each subroutine manages a
part of the hardware or software. Interrupts generally set flags, or update counters that are
read by the rest of the software. A simple API disables and enables interrupts. Done right, it
handles nested calls in nested subroutines, and restores the preceding interrupt state in the
outermost enable. This is one of the simplest methods of creating an exocrine.
Typically, there's some sort of subroutine in the loop to manage a list of software timers,
using a periodic real time interrupt. When a timer expires, an associated subroutine is run, or
flag is set. Any expected hardware event should be backed-up with a software timer.
Hardware events fail about once in a trillion times.
State machines may be implemented with a function-pointer per state-machine (in C++, C or
assembly, anyway). A change of state stores a different function into the pointer. The function
pointer is executed every time the loop runs.
Many designers recommend reading each IO device once per loop, and storing the result so
the logic acts on consistent values. Many designers prefer to design their state machines to
check only one or two things per state. Usually this is a hardware event, and a software timer.
Designers recommend that hierarchical state machines should run the lower-level state
machines before the higher, so the higher run with accurate information.
Complex functions like internal combustion controls are often handled with multi-
dimensional tables. Instead of complex calculations, the code looks up the values. The
software can interpolate between entries, to keep the tables small and cheap.
One major disadvantage of this system is that it does not guarantee a time to respond to any
particular hardware event. Careful coding can easily assure that nothing disables interrupts
for long. Thus interrupt code can run at very precise timings. Another major weakness of this
system is that it can become complex to add new features. Algorithms that take a long time to
run must be carefully broken down so only a little piece gets done each time through the main
loop.
This system's strength is its simplicity, and on small pieces of software the loop is usually so
fast that nobody cares that it is not predictable. Another advantage is that this system
guarantees that the software will run. There is no mysterious operating system to blame for
bad behavior.
USER INTERFACES:
Interface designers at PARC, Apple Computer, Boeing and HP minimize the number of types
of user actions. For example, use two buttons (the absolute minimum) to control a menu
system (just to be clear, one button should be "next menu entry" the other button should be
"select this menu entry"). A touch-screen or screen-edge buttons also minimize the types of
user actions.
Another basic trick is to minimize and simplify the type of output. Designs should consider
using a status light for each interface plug, or failure condition, to tell what failed. A cheap
variation is to have two light bars with a printed matrix of errors that they select- the user can
glue on the labels for the language that she speaks.
For example, Boeing's standard test interface is a button and some lights. When you press the
button, all the lights turn on. When you release the button, the lights with failures stay on.
The labels are in Basic English.
Designers use colors. Red defines the users can get hurt- think of blood. Yellow defines
something might be wrong. Green defines everything's OK.
Another essential trick is to make any modes absolutely clear on the user's display. If an
interface has modes, they must be reversible in an obvious way. Most designers prefer the
display to respond to the user. The display should change immediately after a user action. If
the machine is going to do anything, it should start within 7 seconds, or give progress reports.
One of the most successful general-purpose screen-based interfaces is the two menu buttons
and a line of text in the user's native language. It's used in pagers, medium-priced printers,
network switches, and other medium-priced situations that require complex behavior from
users. When there's text, there are languages. The default language should be the one most
widely understood.
INTRODUCTION TO MICROCONTROLLER
Microcontrollers as the name suggests are small controllers. They are like single chip
computers that are often embedded into other systems to function as processing/controlling
unit. For example the remote control you are using probably has microcontrollers inside that
do decoding and other controlling functions. They are also used in automobiles, washing
machines, microwave ovens, toys ... etc, where automation is needed.
Micro-controllers are useful to the extent that they communicate with other devices, such as
sensors, motors, switches, keypads, displays, memory and even other micro-controllers.
Many interface methods have been developed over the years to solve the complex problem of
balancing circuit design criteria such as features, cost, size, weight, power consumption,
reliability, availability, manufacturability. Many microcontroller designs typically mix
multiple interfacing methods. In a very simplistic form, a micro-controller system can be
viewed as a system that reads from (monitors) inputs, performs processing and writes to
(controls) outputs.
Embedded system means the processor is embedded into the required application. An
embedded product uses a microprocessor or microcontroller to do one task only. In an
embedded system, there is only one application software that is typically burned into ROM.
Example: printer, keyboard, video game player
Microprocessor - A single chip that contains the CPU or most of the computer
Microcontroller - A single chip used to control other devices
Microcontroller differs from a microprocessor in many ways. First and the most important is
its functionality. In order for a microprocessor to be used, other components such as memory,
or components for receiving and sending data must be added to it.
In short that means that microprocessor is the very heart of the computer. On the other hand,
microcontroller is designed to be all of that in one. No other external components are needed
for its application because all necessary peripherals are already built into it. Thus, we save the
time and space needed to construct devices.
MICROPROCESSOR VS MICROCONTROLLER:
Microprocessor:
CPU, RAM, ROM, I/O and timer are all on a single chip
fix amount of on-chip ROM, RAM, I/O ports
for applications in which cost, power and space are critical
single-purpose
CHAPTER-2
BLOCK DIAGRAM
AND
CIRCUIT DESCRIPTION
Block Diagram
L.C.D
Power supply
Microcontroller
R-
DC
Color sensor ADC moto
r
Motor
driver L-
DC
moto
r
CIRCUIT DIAGRAM
CHAPTER-3
COMPONENT DESCRIPTION
REGULATOR:
While there are many circuits that will tolerate a smoothed power supply, some must
have a completely regular supply with no ripple voltage.
If you are using a regulator after the smoothing block of the power supply, then you
shouldn't need to worry about the ripple voltage, since the whole point of using a regulator is
to get a stable, accurate, known voltage for your circuits.
Wiring up a regulator IC
MICROCONTROLLER 89S52
FEATURES:
DESCRIPTION:
PIN DESCRIPTION:
GND - Ground.
Port 0:
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-
impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data
bus during accesses to external program and data memory. In this mode, P0 has internal pull-
ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes
during program verification. External pull-ups are required during program verification.
Port 1:
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL) because of the internal pull-ups. In
addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively.
Port 2:
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are
externally being pulled low will source current (I IL) because of the internal pull-ups. Port 2
emits the high-order address byte during fetches from external program memory and during
accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this
application, Port 2 uses strong internal pullups when emitting 1s. During accesses to external
data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2
Special Function Register. Port 2 also receives the high-order address bits and some control
signals during Flash programming and verification.
Port 3:
Port 3 is an 8-bit bi-directional 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 (I IL) because of the pullups. Port 3 also
serves the functions of various special features of the AT89C51. Port 3 also receives some
control signals for Flash programming and verification.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device.
ALE/PROG:
Address Latch Enable is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input (PROG)
during flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the
oscillator frequency and may be used for external timing or clocking purposes. However, that
one ALE pulse is skipped during each access to external data memory. If desired, ALE
operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active
only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting
the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN:
Program Store Enable is the read strobe to external program memory. When
the AT89C52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external
data memory.
EA/VPP:
External Access Enable (EA) must be strapped to GND in order to enable the
device to fetch code from external pro-gram memory locations starting at 0000H up to
FFFFH. However, if lock bit 1 is programmed, EA will be internally latched on reset. EA
should be strapped to VCC for internal program executions. This pin also receives the 12V
programming enable voltage (VPP) during Flash programming when 12V programming is
selected.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
It is an output from the inverting oscillator amplifier.
EXTERNAL
INTERRUPTS
TIMER/CO
INTERRUPT ON-CHIP ROM ON-CHIP UNTER
CONTROL FOR RAM
TIMER 1 COUNTER
PROGRAM INPUTS
CODE
TIMER 0
CPU
P0 P1 P2 P3 Tx Rx
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier, which can be configured for use as an on-chip oscillator. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source, XTAL2
should be left unconnected while XTAL1 is driven. There are no requirements on the duty
cycle of the external clock signal, since the input to the internal clocking circuitry is through
a divide-by-two flip-flop, but minimum and maximum voltage high and low time
specifications must be observed.
IDLE MODE:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the on-chip RAM and all the
special functions registers remain unchanged during this mode. The idle mode can be
terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle
is terminated by a hardware reset, the device normally resumes program execution, from
where it left off, up to two machine cycles before the internal reset algorithm takes control.
On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is
not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is
terminated by reset, the instruction following the one that invokes Idle should not be one that
writes to a port pin or to external memory.
OSCILLATOR CONNECTIONS:
Oscillator Connections
Liquid crystal display is a type of display which used in digital watches and
many portable computers. LCD displays utilize two sheets of polarizing material with a liquid
crystal solution between them. An electric current passed through the liquid causes the
crystals to align so that light cannot pass through them. Each crystal, therefore, is like a
shutter, either allowing light to pass through or blocking the light.
The liquid crystals can be manipulated through an applied electric voltage so that light
is allowed to pass or is blocked. By carefully controlling where and what wavelength (color)
of light is allowed to pass, the LCD monitor is able to display images. A back light provides
LCD monitors brightness.
Other advances have allowed LCDs to greatly reduce liquid crystal cell
response times. Response time is basically the amount of time it takes for a pixel to change
colors. In reality response time is the amount of time it takes a liquid crystal cell to go from
being active to inactive.
From this description, the interface is a parallel bus, allowing simple and fast
reading/writing of data to and from the LCD. This waveform will write an ASCII Byte out to
the LCD's screen.
PIN DESCRIPTIONS:
1 VSS -- Ground
2 VCC -- +5V power supply
3 VEE -- Power supply to
control contrast
4 RS I RS=0 to select
command register
RS=1 to select data
register
5 R/W I R/W=0 for write
R/W=1 for read
6 EN I/O Enable
7 DB0 I/O The 8-bit data bus
8 DB1 I/O The 8-bit data bus
9 DB2 I/O The 8-bit data bus
10 DB3 I/O The 8-bit data bus
11 DB4 I/O The 8-bit data bus
12 DB5 I/O The 8-bit data bus
13 DB6 I/O The 8-bit data bus
14 DB7 I/O The 8-bit data bus
The three control lines are referred to as EN, RS, and RW.
EN:
The EN line is called "Enable". This control line is used to tell the LCD that
you are sending it data. To send data to the LCD, your program should first set this line high
(1) and then set the other two control lines and/or put data on the data bus. When the other
lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take
the data currently found on the other control lines and on the data bus and to treat it as a
command.
RS:
The RS line is the "Register Select" line. When RS is low (0), the data is to be
treated as a command or special instruction (such as clear screen, position cursor, etc.). When
RS is high (1), the data that is sent is a text data which should be displayed on the screen. For
example, to display the letter "T" on the screen you would set RS high.
RW:
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the program is
effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read
command. All others are write commands, so RW will almost be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation
selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1,
DB2, DB3, DB4, DB5, DB6, and DB7.
The ASCII code to be displayed is eight bits long and is sent to the LCD either
four or eight bits at a time.
If four bit mode is used, two "nibbles" of data (Sent high four bits and then
low four bits with an "E" Clock pulse with each nibble) are sent to make up a full eight bit
transfer.
The "E" Clock is used to initiate the data transfer within the LCD. Deciding
how to send the data to the LCD is most critical decision to be made for an LCD interface
application.
LCD interfacing with 8051 is a real-world application. In recent years the LCD is
finding widespread use replacing LEDs (seven segment LEDs or other multi segment
LEDs).
This is due to following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters. An intelligent LCD displays two lines, 20
characters per line, which is interfaced to the 8051.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to keep
displaying the data.
PROTOTYPE CIRCUIT:
For a LCD module to be used effectively in any piece of equipment, a microprocessor
or a micro controller is usually required to drive it. However, before attempting to wire the
two together some initial experiments can be performed by connecting a series of switches to
the pins of the module. This can be a quite beneficial step, if even you are thoroughly
conversant with the workings of microprocessors.
When LCD is powered up the display should show a series of dark squares,
possibly only on part of display. These characters are actually in their off state, so the contrast
control should be adjusted anti-clockwise until the squares are just visible.
The display module resets itself to an initial state when power is applied, which curiously
the display has blanked off so that even if characters are entered, they cannot be seen. It is
therefore necessary to issue a command at this point, to switch the display on.
CIRCUIT DESCRIPTION OF LCD EXPERIMENT:
PIN DESCRIPTION:
G +5V -5v
1 2 3
07 08 09 10 11 12 13 14 4 5 6
D0 D1 D2 D3 D4 D5 D6 D7 RS R/W EN
The LCD plays a major role in the entire operation as it has the ability to display the certain
data that the user has entitled. LCD display varies from input to input as there is no specific
outline for it to operate.
Motors
DEFINITION
Motor is a device that creates motion, not an engine; it usually refers to either an electrical
motor or an internal combustion engine.
DC Motors
The brushed DC motor is one of the earliest motor designs. Today, it is the motor of choice in
the majority of variable speed and torque control applications.
Advantages
The design of the brushed DC motor is quite simple. A permanent magnetic field is created in
the stator by either of two means:
Permanent magnets
Electro-magnetic windings
If the field is created by permanent magnets, the motor is said to be a "permanent magnet DC
motor" (PMDC). If created by electromagnetic windings, the motor is often said to be a
"shunt wound DC motor" (SWDC). Today, because of cost-effectiveness and reliability, the
PMDC motor is the motor of choice for applications involving fractional horsepower DC
motors, as well as most applications up to about three horsepower.
At five horsepower and greater, various forms of the shunt wound DC motor are most
commonly used. This is because the electromagnetic windings are more cost effective than
permanent magnets in this power range.
Caution: If a DC motor suffers a loss of field (if for example, the field power connections are
broken), the DC motor will immediately begin to accelerate to the top speed which the
loading will allow. This can result in the motor flying apart if the motor is lightly loaded. The
possible loss of field must be accounted for, particularly with shunt wound DC motors.
Opposing the stator field is the armature field, which is generated by a changing
electromagnetic flux coming from windings located on the rotor. The magnetic poles of the
armature field will attempt to line up with the opposite magnetic poles generated by the stator
field. If we stopped the design at this point, the motor would spin until the poles were
opposite one another, settle into place, and then stop -- which would make a pretty useless
motor!
However, we are smarter than that. The section of the rotor where the electricity enters the
rotor windings is called the commutator. The electricity is carried between the rotor and the
stator by conductive graphite-copper brushes (mounted on the rotor) which contact rings on
stator. Imagine power is supplied:
The motor rotates toward the pole alignment point. Just as the motor would get to this point,
the brushes jump across a gap in the stator rings. Momentum carries the motor forward over
this gap. When the brushes get to the other side of the gap, they contact the stator rings again
and -- the polarity of the voltage is reversed in this set of rings! The motor begins accelerating
again, this time trying to get to the opposite set of poles. (The momentum has carried the
motor past the original pole alignment point.) This continues as the motor rotates.
In most DC motors, several sets of windings or permanent magnets are present to smooth out
the motion.
Controlling the speed of a brushed DC motor is simple. The higher the armature voltage, the
faster the rotation. This relationship is linear to the motor's maximum speed.
The maximum armature voltage which corresponds to a motor's rated speed (these motors are
usually given a rated speed and a maximum speed, such as 1750/2000 rpm) are available in
certain standard voltages, which roughly increase in conjuntion with horsepower. Thus, the
smallest industrial motors are rated 90 VDC and 180 VDC. Larger units are rated at 250 VDC
and sometimes higher.
Specialty motors for use in mobile applications are rated 12, 24, or 48 VDC. Other tiny
motors may be rated 5 VDC.
Most industrial DC motors will operate reliably over a speed range of about 20:1 -- down to
about 5-7% of base speed. This is much better performance than the comparible AC motor.
This is partly due to the simplicity of control, but is also partly due to the fact that most
industrial DC motors are designed with variable speed operation in mind, and have added
heat dissipation features which allow lower operating speeds.
In a brushed DC motor, torque control is also simple, since output torque is proportional to
current. If you limit the current, you have just limited the torque which the motor can
achieve. This makes this motor ideal for delicate applications such as textile manufacturing.
The result of this design is that variable speed or variable torque electronics are easy to
design and manufacture. Varying the speed of a brushed DC motor requires little more than a
large enough potentiometer. In practice, these have been replaced for all but sub-fractional
horsepower applications by the SCR and PWM drives, which offer relatively precisely
control voltage and current. Common DC drives are available at the low end (up to 2
horsepower) for under US$100 -- and sometimes under US$50 if precision is not important.
Disadvantages
Expensive to produce
Can't reliably control at lowest speeds
Physically larger
High maintenance
Dust
WORKING OF DC MOTOR
Principle
When a rectangular coil carrying current is placed in a magnetic field, a torque acts on the
coil which rotates it continuously.
When the coil rotates, the shaft attached to it also rotates and thus it is able to do mechanical
work.
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 1. 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)
rotate 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, commentator 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 commentator 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 rotor).
Construction and Working
Parts of a DC Motor
Armature
A D.C. motor consists of a rectangular coil made of insulated copper wire wound on a soft
iron core. This coil wound on the soft iron core forms the armature. The coil is mounted on
an axle and is placed between the cylindrical concave poles of a magnet.
Commutator
A commutator is used to reverse the direction of flow of current. Commutator is a copper ring
split into two parts C1 and C2. The split rings are insulated form each other and mounted on
the axle of the motor. The two ends of the coil are soldered to these rings. They rotate along
with the coil. Commutator rings are connected to a battery. The wires from the battery are not
connected to the rings but to the brushes which are in contact with the rings.
Brushes
Two small strips of carbon, known as brushes press slightly against the two split rings, and
the split rings rotate between the brushes.
Working of a DC Motor
When the coil is powered, a magnetic field is generated around the armature. The left side of
the armature is pushed away from the left magnet and drawn towards the right, causing
rotation.
When the coil turns through 900, the brushes lose contact with the commutator and the
current stops flowing through the coil.
1. Direction of rotation
2. Motor Speed
3. Motor Torque
4. Motor Start and Stop
Direction of Rotation
A DC Motor has two wires. We can call them the positive terminal and the negative terminal,
although these are pretty much arbitrary names (unlike a battery where these polarities are
vital and not to be mixed!). On a motor, we say that when the + wire is connected to +
terminal on a power source, and the - wire is connected to the - terminal source on the same
power source, the motor rotates clockwise (if you are looking towards the motor shaft). If you
reverse the wire polarities so that each wire is connected to the opposing power supply
terminal, then the motor rotates counter clockwise. Notice this is just an arbitrary selection
and that some motor manufacturers could easily choose the opposing convention. As long as
you know what rotation you get with one polarity, you can always connect in such a fashion
that you get the direction that you want on a per polarity basis.
DC Motor Rotation vs Polarity
Facts:
DC Motor rotation has nothing to do with the voltage magnitude or the current
magnitude flowing through the motor.
DC Motor rotation does have to do with the voltage polarity and the direction of the
current flow.
DC Motor Speed
Whereas the voltage polarity controls DC motor rotation, voltage magnitude controls motor
speed. Think of the voltage applied as a facilitator for the strengthening of the magnetic field.
In other words, the higher the voltage, the quicker will the magnetic field
become strong. Remember that a DC motor has an electromagnet and a series of permanent
magnets. The applied voltage generates a magnetic field on the electromagnet portion. This
electromagnet field is made to oppose the permanent magnet field. If the electromagnet field
is very strong, then both magnetic entities will try to repel each other from one side, as well
as atract each other from the other side. The stronger the induced magnetic field, the quicker
will this separation/attaction will try to take place. As a result, motor speed is directly
proportional to applied voltage.
Motor Speed Curve
One aspect to have in mind is that the motor speed is not entirely lineal. Each motor will
have their own voltage/speed curve. One thing I can guarantee from each motor is that at very
low voltages, the motor will simply not move. This is because the magnetic field strength is
not enough to overcome friction. Once friction is overcome, motor speed will start to increase
as voltage increase.
The following video shows the concept of speed control and offers some ideas on how this
can be achieved.
Motor Torque
In the previous segment I kind of described speed as having to do with the strength of the
magnetic field, but this is in reality misleading. Speed has to do with how fast the magnetic
field is built and the attraction/repel forces are installed into the two magnetic structures.
Motor strength, on the other hand, has to do with magnetic field strength. The stronger the
electromagnet attracts the permanent magnet, the more force is exerted on the motor load.
Per example, imagine a motor trying to lift 10 pounds of weight. This is a force that when
multiplied by a distance (how much from the ground we are lifting the load) results in
WORK. This WORK when exerted through a predetermined amount of time (for how long
we are lifting the weight) gives us power. But whatever power came in, must come out as
energy can not be created or destroyed. So that you know, the power that we are supplying to
the motor is computed by
P = IV
Hence, if the voltage (motor speed) is maintained constant, how much load we are moving
must come from the current. As you increase load (or torque requirements) current must also
increase.
Motor Loading
One aspect about DC motors which we must not forget is that loading or increase of torque
can not be infinite as there is a point in which the motor simply can not move. When this
happens, we call this loading Stalling Torque. At the same time this is the maximum
amount of current the motor will see, and it is refer to Stalling Current. Stalling deserves a
full chapter as this is a very important scenario that will define a great deal of the controller to
be used. I promise I will later write a post on stalling and its intricacies.
You are already well versed on how to control the motor speed, the motor torque and the
motor direction of rotation. But this is all fine and dandy as long as the motor is actually
moving. How about starting it and stopping it? Are these trivial matters? Can we just ignore
them or should we be careful about these aspects as well? You bet we should!
Starting a motor is a very hazardous moment for the system. Since you have an inductance
whose energy storage capacity is basically empty, the motor will first act as an inductor. In a
sense, it should not worry us too much because current can not change abruptly in an
inductor, but the truth of the matter is that this is one of the instances in which you will see
the highest currents flowing into the motor. The start is not necessarily bad for the motor
itself as in fact the motor can easily take this Inrush Current. The power stage, on the other
hand and if not properly designed for, may take a beating.
Once the motor has started, the motor current will go down from inrush levels to whatever
load the motor is at. Per example, if the motor is moving a few gears, current will be
proportional to that load and according to torque/current curves.
Stopping the motor is not as harsh as starting. In fact, stopping is pretty much a breeze. What
we do need to concern ourselves is with how we want the motor to stop. Do we want it to
coast down as energy is spent in the loop, or do we want the rotor to stop as fast as possible?
If the later is the option, then we need braking. Braking is easily accomplished by shorting
the motor outputs. The reason why the motor stops so fast is because as a short is applied to
the motor terminals, the Back EMF is shorted. Because Back EMF is directly proportional to
speed, making Back EMF = 0, also means making speed = 0.
MOTORDRIVER CIRCUIT
The name "H-Bridge" is derived from the actual shape of the switching circuit which control
the motoion of the motor. It is also known as "Full Bridge". Basically there are four switching
elements in the H-Bridge as shown in the figure below.
As you can see in the figure above there are four switching elements named as "High side
left", "High side right", "Low side right", "Low side left". When these switches are turned on
in pairs motor changes its direction accordingly. Like, if we switch on High side left and Low
side right then motor rotate in forward direction, as current flows from Power supply through
the motor coil goes to ground via switch low side right. This is shown in the figure below.
Similarly, when you switch on low side left and high side right, the current flows in opposite
direction and motor rotates in backward direction. This is the basic working of H-Bridge. We
can also make a small truth table according to the switching of H-Bridge explained above.
Truth Table
High Left High Right Low Left Low Right Description
On Off Off On Motor runs clockwise
Off On On Off Motor runs anti-clockwise
On On Off Off Motor stops or decelerates
Off Off On On Motor stops or decelerates
As already said, H-bridge can be made with the help of trasistors as well as MOSFETs, the
only thing is the power handling capacity of the circuit. If motors are needed to run with high
current then lot of dissipation is there. So head sinks are needed to cool the circuit.
Now you might be thinkin why i did not discuss the cases like High side left on and Low side
left on or high side right on and low side right on. Clearly seen in the diagra, you don't want
to burn your power supply by shorting them. So that is why those combinations are not
discussed in the truth table.
L293D DRIVER
Because of induction of the windings, power requirements, and temperature management, some glue circuitry is
necessary between digital controllers and motor. In our project to interface DC motor with microcontroller we use L293D
driver.
L293D are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional
drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed to provide
bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed
to drive inductive loads such as relays, solenoids, DC.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a
Darlington transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with drivers 1
and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the
associated drivers are enabled, and their outputs are active in phase with their inputs. When the enable
input is low, those drivers are disabled, and their outputs are off and in the high-impedance state.
FEATURES OF L293D
By using single 16 pin L293D driver we can interface 2 dc motor. In our project we use 2 Dc motors one for front
wheels used to turn left or right and other for movement of motor as forward and reverse direction. For one motor we give
two inputs to rotate forward and backward directions or to turn right/left. Below figure is an example for interfacing a single
Dc motor to L293D driver. Where 2 & 7 pin of L293D are inputs from microcontroller ports these input are enable only
when 1pin of L293D is high and 3 & 6 pins of L293D are inputs to dc motor. Diodes used externally for inductive transient
suppression. Supply is from power supply generator. In this when enable low then motor stops and when enable is high and
both inputs are same that is either high or low then also motor stops. It works only when one input is high and enable is high.
ADC MCP3204
Analog to digital converters are among the most widely used devices for data acquisition.
Digital computers use binary values, but in physical world everything is analog. Temperature,
pressure, humidity, are a few examples of physical quantities that we deal with everyday. A
physical quantity is converted to electrical signals using a device called a transducer.
Transducers are also referred to as sensors. Sensors for temperature, velocity, pressure, light,
and many other natural quantities produce an output that is voltage(or current). Therefore, we
need an analog to digital converter to translate analog signals to digital numbers so that
microcontroller can read and process them. An ADC has n-bit resolution where n can be
8,10,12,16 or even 24 bits. The higher resolution ADC provides smaller step size, where step
size is the smallest change that can be discerned by an ADC. In addition to resolution,
converter time is another major factor in judging an ADC. Conversion time is defined as the
time it takes the ADC to convert the analog input to digital number.
MCP3204
Features
12-bit resolution
Applications
Sensor Interface
Process Control
Data Acquisition
Battery Operated Systems
Description
The Microchip Technology Inc. MCP3204/3208 devices are successive approximation 12-bit
Analog-to-Digital (A/D) Converters with on-board sample and hold circuitry. The MCP3204
is programmable to pro-vide two pseudo-differential input pairs or four single-ended inputs.
The MCP3208 is programmable to pro-vide four pseudo-differential input pairs or eight
single-ended inputs. Differential Nonlinearity (DNL) is speci-fied at 1 LSB, while Integral
Nonlinearity (INL) is offered in 1 LSB (MCP3204/3208-B) and 2 LSB (MCP3204/3208-
C) versions.
Communication with the devices is accomplished using a simple serial interface compatible
with the SPI proto-col. The devices are capable of conversion rates of up to 100 ksps. The
MCP3204/3208 devices operate over a broad voltage range (2.7V - 5.5V). Low current
design permits operation with typical standby and active currents of only 500 nA and 320 A,
respec-tively. The MCP3204 is offered in 14-pin PDIP, 150 mil SOIC and TSSOP packages.
The MCP3208 is offered in 16-pin PDIP and SOIC packages.
ELECTRICAL CHARACTERISTICS
VDD................................................................................... 7.0V
All inputs and outputs w.r.t. VSS ............... -0.6V to VDD +0.6V
*Notice: Stresses above those listed under "Maximum Ratings" may cause permanent
damage to the device. This is a stress rating only and functional operation of the device at
those or any other conditions above those indicated in the operation listings of this
specification is not implied. Exposure to maximum rating conditions for extended periods
may affect device reliability.
PIN DIAGRAM
PIN DESCRIPTIONS
CH0 - CH4
Analog inputs for channels 0 - 7 for the multiplexed inputs. Each pair of channels can be
programmed to be used as two independent channels in single-ended mode or as a single
pseudo-differential input, where one channel is IN+ and one channel is IN. See Section 4.1,
Analog Inputs, and Section 5.0, Serial Communications, for information on
programming the channel configuration.
The SPI clock pin is used to initiate a conversion and clock out each bit of the conversion as
it takes place. See Section 6.2, Maintaining Minimum Clock Speed, for constraints on
clock speed.
The SPI port serial data input pin is used to load channel configuration data into the device.
The SPI serial data output pin is used to shift out the results of the A/D conversion. Data will
always change on the falling edge of each clock as the conversion takes place.
The CS/SHDN pin is used to initiate communication with the device when pulled low and
will end a conver-sion and put the device in low power standby when pulled high. The
CS/SHDN pin must be pulled high between conversions.
DEVICE OPERATION
The MCP3204/3208 A/D converters employ a conven-tional SAR architecture. With this
architecture, a sam-ple is acquired on an internal sample/hold capacitor for 1.5 clock cycles
starting on the fourth rising edge of the serial clock after the start bit has been received. Fol-
lowing this sample time, the device uses the collected charge on the internal sample/hold
capacitor to pro-duce a serial 12-bit digital output code. Conversion rates of 100 ksps are
possible on the MCP3204/3208. See Section 6.2, Maintaining Minimum Clock Speed, for
information on minimum clock rates. Communica-tion with the device is accomplished using
a 4-wire SPI-compatible interface.
Analog Inputs
The MCP3204/3208 devices offer the choice of using the analog input channels configured as
single-ended inputs or pseudo-differential pairs. The MCP3204 can be configured to provide
two pseudo-differential input pairs or four single-ended inputs, while the MCP3208 can be
configured to provide four pseudo-differential input pairs or eight single-ended inputs.
Configuration is done as part of the serial command before each con-version begins. When
used in the pseudo-differential mode, each channel pair (i.e., CH0 and CH1, CH2 and CH3
etc.) is programmed to be the IN+ and IN- inputs as part of the command string transmitted to
the device. The IN+ input can range from IN- to (VREF + IN-). The IN- input is limited to
100 mV from the VSS rail.
The IN- input can be used to cancel small signal com-mon-mode noise which is present on
both the IN+ and IN- inputs.
When operating in the pseudo-differential mode, if the voltage level of IN+ is equal to or less
than IN-, the resultant code will be 000h. If the voltage at IN+ is equal to or greater than
{[VREF + (IN-)] - 1 LSB}, then the output code will be FFFh. If the voltage level at IN- is
more than 1 LSB below VSS, the voltage level at the IN+ input will have to go below VSS to
see the 000h output code. Conversely, if IN- is more than 1 LSB above VSS, then the FFFh
code will not be seen unless the IN+ input level goes above VREF level.
For the A/D converter to meet specification, the charge holding capacitor (CSAMPLE) must
be given enough time to acquire a 12-bit accurate voltage level during the 1.5 clock cycle
sampling period.
This diagram illustrates that the source impedance (RS) adds to the internal sampling switch
(RSS) impedance, directly effecting the time that is required to charge the capacitor
(Csample). Consequently, larger source impedances increase the offset, gain and integral
linearity errors of the conversion (see Figure 4-2).
Reference Input
For each device in the family, the reference input (VREF) determines the analog input
voltage range. As the reference input is reduced, the LSB size is reduced accordingly. The
theoretical digital output code pro-duced by the A/D converter is a function of the analog
input signal and the reference input, as shown below.
THIS COLOR SENSOR
The TCS230 has an array of photodetectors, each with either a red, green, or blue filter,
or no filter (clear). The filters of each color are distributed evenly throughout the array
to eliminate location bias among the colors.
Specifications
TCS230 has four photodiode types. Red, blue, green and clear,
reducing the
Amplitude of the incident light uniformity greatly, so that to increase
the accuracy and simplify the optical. When the light project to the
TCS230 we can choose the different type of photodiode by different
combinations of S2 and S3. Look at the form as follows.
TCS230 can output the frequency of different square wave. Different color and light intensity
correspond with different frequency of square wave. There is a relationship between the
output and light intensity. The range of the typical output frequency is 2HZ~500KHZ. We can
get different scaling factor by different combinations of S0 and S1. Look at the form as
follows.
CHAPTER-4
ADVANTAGES, DISADVANTAGES
AND APPLICATIONS
ADVANTAGES:
DISADVANTAGES:
APPLICATION:
CHAPTER-5
SOFTWARE DESCRIPTION AND
CODING
INTRODUCTION TO KIEL SOFTWARE
KIEL U VISION2:
APPLICATIONS:
The following limitations apply to the evaluation versions of the C51, C251, or C166
tool chains. C51 Evaluation Software Limitations:
. The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code but
source Code may be any size. Programs that generate more than 2 Kbytes of object code will
not compile, assemble, or link the startup code generated includes LJMP's and cannot be used
in single-chip devices supporting Less than 2 Kbytes of program space like the Philips
750/751/752.
. The debugger supports files that are 2 Kbytes and smaller.
. Programs begin at offset 0x0800 and cannot be programmed into single-chip devices.
. No hardware support is available for multiple DPTR registers.
. No support is available for user libraries or floating-point arithmetic.
EVALUATION SOFTWARE:
. Code-Banking Linker/Locator
. Library Manager.
. RTX-51 Tiny Real-Time Operating System
PERIPHERAL SIMULATION:
The u vision2 debugger provides complete simulation for the CPU and on chip
peripherals of most embedded devices. To discover which peripherals of a device are
supported, in u vision2. Select the Simulated Peripherals item from the Help menu. You may
also use the web-based device database. We are constantly adding new devices and
simulation support for on-chip peripherals so be sure to check Device Database often.
code:
CHAPTER-6
RESULTS AND FUTURE SCOPE
RESULTS
Images
FUTURE SCOPE
5. Conclusions
[6] Accident Control and Safety Measures in Mass Transit Operations in Nigeria.
Australia,1995.