Sie sind auf Seite 1von 37

“PARALLEL PARKING REMOTE CONTROL CAR” PROJECT REPORT

| Avijit,Danish,Debajyoti,Santosh,Shubhrajit |
2

A
Project Report On
AUTONOMOUS PARALLEL PARKING RC CAR
In partial fulfillment of requirements for the degree of
Bachelor of Technology
In
Electronics & Instrumentation Engineering

SUBMITTED BY:
AVIJIT BHATTACHARYA(071230105010)
MOHAMMAD DANISH MUMTAZ(071230105014)
SANTOSH KUMAR(071230105016)
SHUBHRAJIT SARKAR(071230105015)
DEBAJYOTI SANYAL(071230105055)

Under the Guidance Of


Prof.N.Manna(HoD-Electronics & Instrumentation Department)

DEPARTMENT OF ELECTRONICS & INSTRUMENTATION ENGINEERING

JIS COLLEGE OF ENGINEERING


3
Certificate

This is to certify that the Project entitled “AUTONOMOUS


PARALLEL PARKING RC CAR” has been submitted by Avijit Bhattacharya
(071230105010), Mohammad Danish Mumtaz (071230105014), Santosh Kumar
(071230105016), Shubhrajit Sarkar (071230105015),Debajyoti Sanyal
(071230105055) under my guidance in partial fulfillment of the degree of
Bachelor of Technology in Electronics & Instrumentation Engineering Of JIS
College Of Engineering, Kalyani during the academic session 2007-11.

Guide HoD,EIE Department


(Prof N.Manna) (Prof N.Manna)
4

Contents
Abstract…………………………………………………………………………5

Acknowledgement………………………………………………………………6

Introduction……………………………………………………………………..7

Objective………………………………………………………………………..8

Constraints………………………………………………………………………9

Assumptions & Limitations……………………………………………………10

Operating Environment………………………………………………………..11

Intended User and Uses………………………………………………………..11

Standard Consideration………………………………………………………..12

Health and Safety Consideration………………………………………………..12

Environmental Consideration……………………………………………………13

Ethical Consideration…………………………………………………………….13

Concept Development……………………………………………………………14

Logical Structure…………………………………………………………………14

Remote Control Car……………………………………………………………….17

H-Bridge…………………………………………………………………………..17

Infrared Sensor……………………………………………………………………20

The Electronic Circuit…………………………………………………………….21

Why AVR…………………………………………………………………………28

Algorithm Module…………………………………………………………...........29

Conclusion………………………………………………………………………..34
5

Abstract

The autonomous vehicle that will be designed by our group will have
the ability to maneuver itself while avoiding objects in its path, and also have the
advanced feature of parallel parking between two objects. There are various
objectives that our group will try to fulfill while abiding by certain design
constraints. The various objectives requested are a vehicle that can be used indoors
and outdoors having the ability to operate on various terrains including tile,carpet
and gravel paths.The Vehicle should be light weight.

Our design is based on a project from two Cornell students who


designed a vehicle that has the ability to follow a line. Although our design is quite
different from theirs,we will be implementing variations on their motor driver
circuits microcontroller. We will be complying with a US patent that covers a
“System Detecting Objects External to a Vehicle” which uses lasers instead of
infra red sensors to control the vehicle autonomous behavior.
6
Acknowledgement

Apart from the efforts of ours, the success of any project depends
largely on the encouragement and guidelines of many others. We take this
opportunity to express our gratitude to the people who have been instrumental in
the successful completion of this project.

We would like to show greatest appreciation to Prof. N. Manna. We


can’t say just thank you for his tremendous support and help. We felt motivated
and encouraged every time we attended his meeting. Without his encouragement
and guidance this project would not have materialized.

The guidance and support received from all the faculty members of
EIE department who contributed and to this project, was vital for the success of the
project. We are grateful for their constant support and help.
7

INTRODUCTION:

We have created an RC Car that can identify a parking space and parallel park by itself. The RC
Car drives down a street searching for a parking space to its right using a distance sensor. When
the car has identified a space, the car checks to see whether that space is large enough to park in.
If it determines that there is sufficient space, the car will begin parallel parking into that space. It
uses information from sensors placed on the front, right, and rear of the car to direct the car into
the parking space. Once the car has parked, it will remain in that position until it is reset.

PARALLEL PARKING:

Parallel parking is a method of parking a vehicle in line with other parked cars. Cars parked in
parallel are in one line, parallel to the curb, with the front bumper of each car facing the back
bumper of the adjacent one. Parallel parking requires driving the car in reverse gear into the
parking space. Roads that facilitate said parking have an extra lane or a large shoulder for parked
cars. It is also employed anytime parking facilities are not available—usually in large
metropolitan areas where there is a high density of vehicles and few (or restricted)
accommodations such as multi-storey car parks.

Parallel parking is considered to be one of the hardest skills for new drivers to learn. Parallel
parking allows a vehicle to park in a smaller space than would be true of forward parking.
Driving forward into a parking space on the side of a road is typically not possible unless two
successive parking spaces are empty. Reversing into the spot via the parallel parking technique
allows one to take advantage of a single empty space not much longer than the car (in order to
complete the parking within three wheel-turns the parking space would generally need to be
about one and a half car-length long).

Beginning drivers learn to use reference points to align themselves in relation to the car in front
of the space, to determine the proper angle for backing, and to determine when to turn the
steering wheel while backing. They may find it easier to briefly stop at each reference point and
turn for the next step.

Two major types of parallel parking technique differ in whether they will use two or three
positions of the steering wheel while backing. A skilled driver may be able to parallel park
8

successfully by backing with the steering wheel turned all the way to the right (or left, in right-
hand drive countries) and then immediately cranking the wheel all the way to the left (or right, in
right-hand drive countries) at a critical point. For beginning drivers, those with larger cars or bad
sight lines, this may risk collision with either the car in front of or behind the parking space, or it
could also result in the car being parked too far away from the curb. Such drivers may find it
easier to include an intermediate step, where after having achieved the ideal angle for backing up
they back up with the wheels straight until the rear end of the car is far enough back to allow
them to make their final reverse turn. While steering wheel positions in between full-right,
straight, and full-left are possible to use, beginners may be able to gauge their progress more
effectively by turning the wheel all the way to the right or left.

A 2009 Ruhr University Bochum study argued that a driver's gender may affect parking ability.
According to the research, female drivers took an average of 20 seconds longer to park than male
drivers, yet were still less likely than men to park accurately.[1] However, this study was
completed using an extremely small sample group - 65 people - such that the conclusion that
women are inherently worse at parking or deficient in spatial reasoning is questionable.

In the early 21st century, car manufacturers are addressing this need by introducing automatic
parking.

OBJECTIVES:

The following is the list of objectives for the Autonomous Vehicle:

1. Easy to Use

1.1. Can be turned on and off with the touch of a button

1.2. Vehicle will be able to control its autonomous behavior

1.3. Battery can be changed easily and charged quickly

2. Marketable

2.1. Can be used indoors and outdoors

2.2. Can be operated on various surfaces, including wood floors, tile, and carpet
9

2.3. Vehicle can be used during day or night (light or dark and shade)

3. Functionality

3.1. Vehicle will be fast and lightweight

3.2. Vehicle will be able to control its speed depending on its distance from objects

CONSTRAINTS:

The following is a list of constraints for the Autonomous Vehicle:

1. Functionality

1.1. Vehicle must be able to travel at speeds of at least 15mph

1.2. Vehicle must not weigh more than 10 pounds (including battery weight)

1.3. Vehicle must avoid objects located directly in its path

2. Easy to Use

2.1. Vehicle must initiate autonomous behavior automatically

2.2. Must pause for 30 seconds after 5 minutes of continuous operation

3. Marketable

3.1. Must be operable by children 6 years of age and older

3.2. Vehicle circuitry must not be visible on outside of vehicle

ASSUMPTIONS AND LIMITATIONS:

As was described in the previous section, the main goal of this vehicle design is to implement

a small RC sized vehicle that can parallel park itself, while maneuvering around objects located

in its path. The design entailed assumptions and limitations that had to be compiled by our

design group. Below you will find a list of the assumptions and limitations that were made by

our group.
10

Assumptions:

The following is the list of assumptions for the Autonomous Vehicle design:

• Vehicle must have a nice body with an attractive design

• Sensors should not be too obvious on exterior of the car (blend in with design)

• Vehicle must have four wheels

Limitations

The following is the list of limitations for the Autonomous Vehicle design:

• Vehicle must be able to operate with a single battery

• Wheels must function properly on wet and dry floors, as well as carpets

OPERATING ENVIRONMENT:

The autonomous vehicle is designed to operate in an indoor and outdoor environment;


however, it will not be operable when it is raining due to the susceptibility of the vehicles
electronics equipment to water damage. Also, due to the sensitive nature of the vehicles sensors
located on the exterior of the car, the vehicle will allow it to tolerate minor hits to the body of the
car and falls from short distances as long as the sensors are not directly impacted. This means
that the car cannot be operated in a rocky or bumpy terrain where the sensors would be exposed
to damage by direct or indirect impact that would cause them to become loose.
The operating temperature range of the autonomous vehicle is ideally between 40 degrees
Fahrenheit and 120 degrees Fahrenheit. This is due to the temperature requirements of the
various electric components of the car, including the infrared sensors, the microcontroller, and
the motor driver circuits. Although the vehicle will work when operated slightly outside this
range, the components function best when operated at the specified range.
11

INTENDED USER AND USES:

In this section we will discuss the intended uses of our project, along with the intended users
of our design. This will provide information regarding who and how our project should be used,
as well as providing a foundation for possible future uses of our design, which will be discussed
in section XXI of this report titled “Projection of the Project into the Future”.
A. Intended Users
The intended users of our autonomous vehicle design project are people interested in adding
autonomous functionality to electronics, including, but not limited to, toy car manufacturers
and automobile manufacturers. Our design could also be used by instructors and students to
enhance their knowledge of electronics, in particular the interaction of microcontrollers with
peripheral devices such as sensors and motor driver circuits.
B. Intended Uses
The principal intended use of our design is a method for RC toy vehicles to Parallel Park
between two objects and avoiding collisions into walls and objects. Furthermore, our design
has the potential for other various different uses, not only on vehicles for autonomous
behavior, but also as a collision detection system for moving objects. This collision detection
system could be used for machines to detect safe boundaries for operation, or for vehicles
operating within confined spaces where signaling the distance available for maneuvering or
when an object is approaching would prevent a collision.

STANDARDS CONSIDERATIONS:

Standards are a set of guidelines to assure product interoperability and safety to the users of
certain products. In this section we will analyze standards that most closely relates to our
autonomous car design. Below you will find a list of standards that relate to our design along
with explanations of the standards and how we plan on complying with the standards.
A. RoHS, Restriction of Hazardous Substance Directive

This standard is related to the use of certain hazardous substances in electrical and electronic
equipment. The directive restricts the use of the following toxic substances: lead, mercury,
cadmium, hexavalent chromium, polybrominated biphenyls, and polybrominated diphenyl
12

ether. The maximum concentrations allowed are 0.1% or 1000ppm for all except cadmium,
which is limited further to 0.01% or 100ppm. This directive applies to equipment in the
following categories: IT equipment, telecommunications equipment, consumer equipment,
lighting equipment, electronic and electrical tools, toys, leisure, and sports equipment, and
monitoring and control instruments. The main benefit of complying with RoHS standards is
the immediate health benefits of using lead-free solders and components.
In order to make our product safe to use by all consumers, easy to trade, and not cause any major
interference when operated in an environment with other electrical and electronic devices, we
will try and comply with as many recognized standards as possible. The standards that we will
comply with are listed below, along with how we plan on complying with the standard.
• RoHS, Restriction of Hazardous Substance Directive, by using RoHS certified
products and equipment and lead-free solder in our implementation.

HEALTH AND SAFETY CONSIDERATIONS:

Our design for an “autonomous vehicle” poses some minor health and safety
considerations since our design might potentially be used in consumer vehicles. The parallel
parking feature implemented in our vehicle design would not cause any health and safety
problems. However, the object avoidance on the vehicle could potentially cause safety problems
if the collision avoidance system is flawed when installed on a consumer vehicle. It is therefore
imperative that the design be thoroughly tested before installed on systems that could cause
safety or health problems.
The second health and safety consideration was discussed in the previous section while
describing the RoHS directive. This directive prohibits the use of toxic substances in electronic
devices. This would be beneficial to the health and safety of the operators by not exposing them
to substances that could potentially harm their health. Finally, the last consideration is regarding
the safety of people and objects around the vehicle, which is why we implemented the object
avoidance system, not only to protect the operators of the vehicle, but also of the people around
the vehicle.
13

ENVIRONMENTAL CONSIDERATION:

While designing the parallel parking vehicle, there were several choices that were
decided upon that directly impacted the environment. We tried to make sure that the choices we
made were the most beneficial to the environment. The first choice that we made regarding
environmental concerns was regarding the battery that would be used to power the vehicle. We
tried to use a power system for the vehicle that would be the most energy efficient, which
included implementing an energy efficient design, while deciding on the most efficient battery
technology. There were also other minor environmental considerations implemented throughout
the design of our project, including the reduction of paper waste during the design process. We
decided that we would use electronic copies rather than paper copies throughout our design
process, only printing designs when it was absolutely necessary. We further enveloped this
concern while we printed the report by labeling each page number with a section number at the
beginning, reducing paper waste by avoiding the reprinting of the entire report if changes need to
be made.

ETHICAL CONSIDERATIONS:

Our design for an “autonomous vehicle” poses no major ethical considerations; since the
topic of our design will not cause any moral dilemmas. Our design could be used as a stepping
stone into the field of autonomous vehicle design, paving the path for more advanced research on
the subject. There is, however, a minor ethical question that did arise throughout the process.
This minor ethical dilemma includes the use of computers to control devices once operated by
humans.

A. Intelligent Devices replacing Human Operation

The minor issue that was noticed during our consideration of possible dilemmas
was the gradual transition from human operated devices to computer operated devices. It
has become common practice to include microcontrollers in devices that were once fully
operated by humans to include a level of intelligence that does not require human
intervention. For example, toy vehicles used to be fully radio controlled by humans, and
our design plans to eliminate collisions by providing the vehicle the ability error by
14

programming the vehicle to avoid objects located in its path. While some may claim that
this is a good first step to increasing public safety and reducing the destruction of
property, there are people that may claim that this is a first step to eliminating human
intervention in mechanical devices. While intelligent mechanical devices have replaced
human intervention in certain industries, it is not of great concern whether a vehicle that
has the ability to drive itself poses a threat to humans losing the ability to operate the
vehicle. Actually, the system we design could be later used in a human operated vehicle
with safety precautions to avoid possible collisions.

CONCEPT DEVELOPMENT:

After discussing various project ideas, we eventually stumbled onto the subject of cars. So we
started brainstorming possible projects related driving. When brainstorming, we saw something
in the EIE lounge that reminded us of a garage. This led us to parking. Parallel parking is
something that many drivers struggle with, yet there are very few tools available to help with
parallel parking. Though a few auto manufacturers have developed systems that can parallel park
cars autonomously, these solutions are very expensive. We thought this would be both a fun and
interesting problem to tackle using an RC Car as a proxy for a real car.

LOGICAL STRUCTURE:

Our project is broken down into two major components: the control system and the move car
algorithm. The move car algorithm directs the car and the control system implements the
directions of the move car algorithm.

Control System

The control system contains all the hardware and its associated software. It allows the parking
and parking detection algorithms to interface with the car. The software in this module is broken
up into three major sections: the Left-Right/Front-Back (LR/FB) state machines, master state
machine, and distance calculations. The LR/FB state machines determines which direction to
15

move the car based on flags set by the detect parking space and park car algorithms. Once the
LR/FB state machines decides which direction to move the car, the master state machine
implements this movement by sending the correct input and enable signals to the H-Bridge. The
distance calculations implemented independently every millisecond.

Move Car

Move car contains the detect parking space and parallel parking algorithms. All functions in
move car interface with the control module by setting movement flags. The parking space
detection and parking algorithms use information from the distance sensors to set these
movement flags and guide the car.

Move car works by initializing the movement flags of the car. It sets the car on a default
trajectory and then calls detect parking space. Once a parking space has been detected, the
parking algorithm is called. After the car has successfully parked, it idles until it is reset.

Hardware/Software Tradeoffs:

Distance Sensors

1. When selecting infrared distance sensors there was always a tradeoff between the sensors
ability to measure close range and long range. We tried to minimize this problem by
using sensors designed for varying ranges.
2. Using accurate sensors cost significant time. Every measurement from our distance
sensors is approximately 40ms delayed. This affected our ability to start and stop the
motors of the car at the correct times.
3. We used integer calculations rather than floating point to calculate distances. We decided
the increased accuracy would not significantly improve our ability to park the car because
we cannot control the movement of the car with that degree of accuracy.
4. Each sensor draws a maximum of 50mA. To accommodate for this, we needed to use a
5v regulator that could source up to 1A.
16

Software

1. 1. Our code requires the motor control software, parking algorithm software, and distance
sensor software to run in parallel. However, this is not possible in the Atmega644. We
got around this issue by making every important task a state machine. By breaking up
each function into small pieces, we can execute one piece of function one, then one piece
of function two, followed by one piece of function3, and then another piece of function
one, etc. This enables us to emulate a multi-tasking architecture.

Figure 1: Logical Structure of High Level Design


17

RC CAR:

The first step of our hardware design involved fully understanding the mechanics our RC car.
We took apart the car and rebuilt it multiple times to fully understand how it was built, what
every part in the car is used for, and how those parts contribute to the control of the car.

After understanding the mechanics of the car, we decided the easiest way to control our car
would be to directly control the inputs to the DC brush motors controlling the front and rear
wheels, bypassing all of the car’s internal circuitry. To do this, we scoped the control signals of
the car. We found that the control signals were very simple. There is one motor for the reverse
and forward movement of the rear wheels and one motor to turn the front wheels left and right.
These motors are controlled by a simple 5V DC input. A +5V turns the rear wheels forward and
the front wheel to the left. A -5V input turns the rear wheels backwards and turns the front
wheels to the right. To more easily control the motors we soldered wires to their plus and minus
terminals. This allows us to easily apply a +/-5V without opening up the car again.

H-BRIDGE:

An H bridge is an electronic circuit which enables a voltage to be applied across a load in either
direction. These circuits are often used in robotics and other applications to allow DC motors to
run forwards and backwards. H bridges are available as integrated circuits, or can be built
from discrete components.[1] 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.
18

Operation

The two basic states of an H bridge

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 motor's 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 summarises operation, with S1-S4 corresponding to the diagram
above.

S1 S2 S3 S4 Result

1 0 0 1 Motor moves right

0 1 1 0 Motor moves left

0 0 0 0 Motor free runs

0 1 0 1 Motor brakes

1 0 1 0 Motor brakes

CONSTRUCTION

A solid-state H bridge is typically constructed using opposite polarity devices, such


as PNP BJTsor P-channel MOSFETs connected to the high voltage bus and NPN BJTs or N-
channel MOSFETs connected to the low voltage bus.
19

The most efficient MOSFET designs use N-channel MOSFETs on both the high side and low
side because they typically have a third of the ON resistance of P-channel MOSFETs. This
requires a more complex design since the gates of the high side MOSFETs must be driven
positive with respect to the DC supply rail. However, many integrated circuit MOSFET drivers
include a charge pump within the device to achieve this.

Alternatively, a switch-mode DC–DC converter can be used to provide isolated ('floating')


supplies to the gate drive circuitry. A multiple-output flyback converter is well-suited to this
application.

Another method for driving MOSFET-bridges is the use of a specialised transformer known as a
GDT (Gate Drive Transformer), which gives the isolated outputs for driving the upper FETs
gates. The transformer core is usually a ferrite toroid, with 1:1 or 4:9 winding ratio. However,
this method can only be used with high frequency signals. The design of the transformer is also
very important, as the leakage inductance should be minimized, or cross conduction may occur.
The outputs of the transformer also need to be usually clamped by zener diodes, because high
voltage spikes could destroy the MOSFET gates.

A common variation of this circuit uses just the two transistors on one side of the load, similar to
a class AB amplifier. Such a configuration is called a "half bridge". The half bridge is used in
some switched-mode power supplies that use synchronous rectifiers and in switching amplifiers.
The half-H bridge type is commonly abbreviated to "Half-H" to distinguish it from full ("Full-
H") H bridges. Another common variation, adding a third 'leg' to the bridge, creates a 3-phase
inverter. The 3-phase inverter is the core of any AC motor drive.

A further variation is the half-controlled bridge, where one of the high- and low-side switching
devices (on opposite sides of the bridge) are replaced with diodes. This eliminates the shoot-
through failure mode, and is commonly used to drive variable/switched reluctance machines and
actuators where bi-directional current flow is not required.

A "double pole double throw" relay can generally achieve the same electrical functionality as an
H bridge (considering the usual function of the device). An H bridge would be preferable to the
relay where a smaller physical size, high speed switching, or low driving voltage is needed, or
where the wearing out of mechanical parts is undesirable.
20

INFRARED SENSOR:

Based on a simple basic Idea, this proximity sensor, is


easy to build, easy to calibrate and still, it provides a
detection range of 35 cm (range can change depending
on the ambient light intensity).

This sensor can be used for most indoor applications


where no important ambient light is present. For
simplicity, this sensor doesn't provide ambient light
immunity, but a more complicated, ambient light
ignoring sensor should be discussed in a coming article.
However, this sensor can be used to measure the speed
of object moving at a very high speed, like in industry or
in tachometers. In such applications, ambient light
ignoring sensor, which rely on sending 40 Khz pulsed
signals cannot be used because there are time gaps
between the pulses where the sensor is 'blind'...
• The solution proposed doesn't contain any special components, like photo-diodes, photo-
transistors, or IR receiver ICs, only a couple if IR leds, an Op amp, a transistor and a
couple of resistors. In need, as the title says, a standard IR led is used for the purpose of
detection. Due to that fact, the circuit is extremely simple, and any novice electronics
hobbyist can easily understand and build it.
21

Object Detection using IR light


It is the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra red
light through IR-LEDs, which is then reflected by any object in front of the sensor.
Then all you have to do is to pick-up the
reflected IR light. For detecting the reflected
IR light, we are going to use a very original
technique: we are going to use another IR-
LED, to detect the IR light that was emitted from
another led of the exact same type!
This is an electrical property of Light Emitting
Diodes (LEDs) which is the fact that a led
Produce a voltage difference across its leads
when it is subjected to light. As if it was a photo-
cell, but with much lower output current. In other
words, the voltage generated by the leds can't be
- in any way - used to generate electrical power
from light.

THE ELECTRONIC CIRCUIT:

Two different designs are proposed, each one of them is more suitable for different applications.
The main difference between the 2 designs is the way infra-red (IR) light is sent on the object.
The receiver part of the circuit is exactly the same in both designs.
Note: Both the sender and the receiver are constructed on the same board. They are separated in
the schematics for simplification.

Design 1: Low range, Always ON


As the name implies, the sensor is always ON, meaning that the IR led is constantly emitting
light. this design of the circuit is suitable for counting objects, or counting revolutions of a
22

rotating object, that may be of the order of 15,000 rpm or much more. However this design is
more power consuming and is not optimized for high ranges. in this design, range can be from 1
to 10 cm, depending on the ambient light conditions.
As you can see the schematic is
divided into 2 parts the sender and
the receiver.

The sender is composed of an


IR LED (D2) in series with a 470
Ohm resistor, yielding a forward
current of 7.5 mA.

The receiver part is more


complicated, the 2 resistors R5 and
R6 form a voltage divider which
provides 2.5V at the anode of the
IR LED (here, this led will be used
as a sensor). When IR light falls on
the LED (D1), the voltage drop
increases, the cathode's voltage of
D1 may go as low as 1.4V or
more, depending on the light
intensity. This voltage drop can be
detected using an Op-Amp (operational Amplifier LM358). You will have to adjust the variable
resistor (POT.) R8 so the the voltage at the positive input of the Op-Amp (pin No. 5) would be
somewhere near 1.6 Volt. if you understand the functioning of Op-Amps, you will notice that the
output will go High when the volt at the cathode of D1 drops under 1.6. So the output will be
High when IR light is detected, which is the purpose of the receiver.

Design 2: High range, Pulsed IR


In this design, which is oriented to obstacle detection in robots, our primary target is to reach
high ranges, from 25 to 35 cm, depending on ambient light conditions. The range of the sensor is
23

extended by increasing the current flowing in the led. This is a delicate task, as we need to send
pulses of IR instead of constant IR emission.The duty cycle of the pulses turning the LED ON
and OFF have to be calculated with precision, so that the average current flowing into the LED
never exceeds the LED's maximum DC current (or 10mA as a standard safe value).
The duty cycle is the ratio
between the ON duration of the
pulse and the total period. A low
duty cycle will enable us to inject
in the LED high instantaneous
currents while shutting it OFF for
enough time to cool down from
the previous cycle.

Those 2 graphs shows the


meaning of the duty cycle, and the
mathematical relations between
the ON time, the Total period, and
the average current.

In the second graph, the average


current in blue is exaggerated to
be visible, but real calculations
would yield a much smaller
average current.

Now, hands on the circuit that will put all this theory into practice. The CTRL input in the figure,
stands for Control, and this pin should be connected to the source of the low duty cycle pulses
discussed above, whether it is a microcontroller or an LM555 timer that generates the pulses.
24

The calculations yielded that a 10 ohm resistor is series with the LED D2, would cause a current
of approximately 250 mA to flow through the LED. A current this high, would destroy the LED
if applied for a long period of time (some dozens of seconds), this is why we have to send low
duty cycle pulses.

The first Op-amp will provide voltage buffer, to enable any kind of device to control the
sensor, also, it will provide the 30mA base current required to drive the
base of the transistor. The calculation of the the base resistor R3 depends
on the type of transistor you use, thus on how much current you need on
the base to drive the required collector current.The reciever of the
schematic function exactly the same as in the first design,refer to the first
design ALWAYS ON.

Figure:
25

MICRO CONTROLLER (AT89C51):

What are microcontrollers and what are they used for?


Like all good things, this powerful component is basically very simple. It is made by mixing
tested and high- quality "ingredients" (components) as per following receipt:

1. The simplest computer processor is used as the "brain" of the future system.
2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters,
timers, input/output lines etc. are added
3. All that is placed in some of the standard packages.
4. A simple software able to control it all and which everyone can easily learn about has
been developed.
On the basis of these rules, numerous types of microcontrollers were designed and they quickly
became man's invisible companion. Their incredible simplicity and flexibility conquered us a
long time ago and if you try to invent something about them, you should know that you are
probably late, someone before you has either done it or at least has tried to do it.

The following things have had a crucial influence on development and success of the
microcontrollers:

• Powerful and carefully chosen electronics embedded in the microcontrollers can


independetly or via input/output devices (switches, push buttons, sensors, LCD displays,
relays etc.), control various processes and devices such as industrial automation, electric
current, temperature, engine performance etc.
• Very low prices enable them to be embedded in such devices in which, until recent time
it was not worthwhile to embed anything. Thanks to that, the world is overwhelmed today
with cheap automatic devices and various “smart” appliences.
• Prior knowledge is hardly needed for programming. It is sufficient to have a PC (software
in use is not demanding at all and is easy to learn) and a simple device (called the
programmer) used for “loading” raedy-to-use programs into the microcontroller.
26

So, if you are infected with a virus called electronics, there is nothing left for you to do but to
learn how to use and control its power.

How does the microcontroller operate?


Even though there is a large number of different types of microcontrollers and even more
programs created for their use only, all of them have many things in common. Thus, if you learn
to handle one of them you will be able to handle them all. A typical scenario on the basis of
which it all functions is as follows:

1. Power supply is turned off and everything is still…the program is loaded into the
microcontroller, nothing indicates what is about to come…
2. Power supply is turned on and everything starts to happen at high speed! The control
logic unit keeps everything under control. It disables all other circuits except quartz crystal
to operate. While the preparations are in progress, the first milliseconds go by.
3. Power supply voltage reaches its maximum and oscillator frequency becomes stable.
SFRs are being filled with bits reflecting the state of all circuits within the microcontroller.
All pins are configured as inputs. The overall electronis starts operation in rhythm with
pulse sequence. From now on the time is measured in micro and nanoseconds.
4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder
which recognizes it, after which it is executed with immediate effect.

5. The value of the Program Counter is incremented by 1 and the whole process is
repeated...several million times per second.
27

Why AVR?
As microprocessors evolved, devices increased in complexity with new hardware and new
instructions to accomplish new tasks. These microprocessors became known as CISC or
Complex Instruction Set Computers. Complex is often an understatement; some of the CISCs
that I’ve worked with have mind-numbingly complex instruction sets. Some of the devices have
so many instructions that it becomes difficult to figure out the most efficient way to do anything
that isn’t built into the hardware. Then somebody figured that if they designed a very simple core
processor that only did a few things but did them very fast and efficiently, they could make a
much cheaper and easier to program computer. Thus was born the RISC, Reduced Instruction Set
28

Computers. The downside was that you had to write additional assembly language software to do
all the things that the CISC computer had built in. For instance, instead of calling a divide
instruction in a CISC device, you would have to do a series of subtractions to accomplish a
division using a RISC device. This ‘disadvantage’ was offset by price and speed, and is
completely irrelevant when you program with C since the complier generates the assembly code
for you.

Although I’ll admit that ‘CISC versus RISC’ and ‘C versus assembly language’ arguments often
seem more like religious warfare than logical discourse, I have come to believe that the AVR, a
RISC device, programmed in C is the best way to microcontroller salvation The folks that
designed the AVR as a RISC architecture and instruction set while keeping C programming
language in mind. In fact they worked with C compiler designers from IAR to help them with the
hardware design to help optimize it for C programming.

Since this is an introductory text I won’t go into all the detailed reasons I’ve chosen the AVR,
I’ll just state that I have a lot of experience with other microcontrollers such as Intel’s 8051,
Motorola’s 68xxxes, Zilog’s Z’s, and Microchip’s PIC’s and I’m done with them (unless
adequately paid – hey, I’m no zealot). These devices are all good, but they require expensive
development boards, expensive programming boards, and expensive software development tools
(don’t believe them about the ‘free’ software, in most cases the ‘free’ is for code size or time
limited versions).
The AVR is fast, cheap, in-circuit programmable, and development software can be had for
FREE (really free, not crippled or limited in any way). I’ve paid thousands of dollars for
development boards, programming boards, and C compilers for the other devices, but never
again -- I like free. The hardware used in this text, the ATMEL Butterfly Evaluation Board can
be modified with a few components to turn it into a decent development system and the Butterfly
and needed components can be had for less than $40.00.

ALGORITHM MODULE:

moveCar()

Function:
29

This is the master state machine of the algorithm module. It decides which mode the car is in,
i.e., whether the car is moving forward to detect a parking spot, aligning itself once a parking
spot has been detected, or actually going through the motion of parking.

Diagram:

Figure 8: Move Car Motor State Machine

Working:

This is a 5 state linear state machine, as can be seen in the diagram above.

It starts off in State 0. In this state, the car is at rest. It gives enough time for all transients in the
car to stabilize. Once everything is stable, it moves to State 1.

In State 1, car moves forward till it detects a parking spot. While in this state, the car invokes the
detect Parking state machine each time the move Car state machine is called in the Control
Module. Details of how the detect Parking state machine works are explained in the next section.

Once a parking lot has been detected, the state machine moves into State 2. It remains in State 2
until the car has parked itself. The park Car state machine is invoked for each cycle that the
30

move Car state machine is in State 2. Once the car has been parked by park Car state machine,
the is Parked flag is asserted, and move Car moves onto state 3.

When we reach State 3, the car parked itself. The car will eternally remain in this state hereafter,
since the car has parked itself and is at rest.

In addition to serving as a state machine as described above, move Car also makes available 2
values – rsDist and rrsDist – to its sub-state machines, detect Parking and park Car. rsDist stores
the values of the side distance in the previous clock tick of the move Car state machine, while
rrsDist stores the value 2 clock cycles earlier.

Timing:

The move Car state machine is invoked every 100ms. The move Car state machine also serves as
a clock for the detect Parking and park Car state machines. When in State 1, each clock tick of
the move Car state machine serves as a clock tick for the detect Parking machine. When in State
3, each clock tick of the move Car state machine serves as a clock tick for the park Car machine.

detect Parking

Function:

The function of detect Parking state machine is, as its name suggests, to detect a parking space to
park in. It accomplishes this by continuously polling the distance values from the side distance
sensor.

Figure : Detect Parking Space State Machine


31

Park car ()

The function of the park Car state machine is to park the car once a parking spot has been
identified. The algorithm to park the car continuously interacts with its surroundings through the
32

forward, side and rear sensors.

Accuracy:

Distance Sensors

The sensors were very accurate within their specified range. Even with integer calculations, we
were able to calculate distances with a +/- 1cm accuracy. Because we could not control the
movement of the car with this degree of accuracy, the accuracy of our distance sensors are
sufficient.

Parking Space Detection

The sequence to detect a parking space works very accurately. In the many trials that we
performed, it always detected the parking space and stopped on detection.
33

Parking Algorithm

The parking algorithm we have written works very well when the car is close to a set distance
from the side of the parking lot. It, however, becomes less accurate when the car is placed at
larger distances from the parking space.

Safety and Interference

There were not many safety concerns with our project. In order to minimize disturbance to other
project groups, and avoid the car colliding into students, we made a separate test area in the
hallway. We used this test area for all testing purposes.

Also, since the car is completely autonomous, there was no human contact required (except for
turning on the car). Therefore, there wasn’t an issue of interference with the systems in the car.

USABILITY:

In our opinion, this project has tremendous potential. With some more work on the parking
algorithm, we feel that we can develop a system for the RC car to park irrespective of its
orientation and distance from the parking lot. With enough research, this can be developed for
real cars!
34

It can also be used as a learning tool for people who want to learn driving. By observing the
motion of this car, students can learn how to parallel park better.

Lastly, this project could serve as a useful reference point for future projects dealing with R/C
cars. The Control Module we have implemented to control the R/C car can be used universally
for any 2-wheel drive R/C car.

CONCLUSION:

Overall, we feel the project met most of our expectations, as we were able to build an
autonomous car which could detect a parking space, and park in it. When we started out, we
intended the car to be able to locate a parking spot, and park irrespective of its distance from the
parking space and its orientation. We were, however, unable to make it robust enough to
accommodate parking from different orientations and distances. However, we feel the basic
algorithm would remain the same, and this algorithm can be built upon to accommodate these
features.
35

This was also a tremendous learning experience for us, especially with the hardware. We learn a
tremendous amount about motor control systems, efficient circuit design, and hardware
debugging. We also learned a lot about software. Through this project, we got valuable
experience in developing efficient software using memory and run-time optimizations,
something that cannot be gained through routine assignments.

If we had an opportunity to start this project over, there are a few things we would do differently.

1. Use a regulator to ensure a steady current is being supplied to the batteries despite the
fluctuation in voltage across the batteries, particularly as they lose power
2. Consider implementing an optical sensor to track the velocity of the car
3. Build a feedback PWM loop to control the velocity of the car
4. Consider adding a fourth sensor on the side to calculate the orientation of the car
5. Consider building the car ourselves

ETHICAL CONSIDERATIONS:

We adhered to the IEEE Code of Ethics throughout this project. We were very careful to
consider the effects of our decisions on us, those around us, and the outcome of our project. We
took significant time to plan our project before implementing it. We wanted to ensure our car
was designed in the best way possible, in terms of performance, reliability, and safety. We
worked cooperatively with other people, seeking and providing feedback and constructive
criticism from the professor, TA's, and other groups to build the best possible design.
36

We also set up a safe testing environment. In an area with high traffic, people could have easily
stepped on the car and been hurt. We tested our car in a highly controlled environment to ensure
everyone’s safety. We did not make any decisions that would cause harm to others or the
environment.

In no circumstances did we give or accept bribes. All of our parts were either bought or sampled
in the appropriate manner. We have been honest regarding the results and limitations of our
design. We have worked hard to create the best design possible in the given time frame, and it is
safe to operate. All people involved with this project were treated fairly.

REFERENCES:

Data Sheets

• http://document.sharpsma.com/files/gp2y0a21yk_e.pdf
• http://document.sharpsma.com/files/GP2D120XJ00F_SS.pdf
• http://www.st.com/stonline/products/literature/ds/1773/l298.pdf
37

• http://courses.cit.cornell.edu/courses/ee476/AtmelStuff/mega644full.pdf
• http://www.digchip.com/datasheets/download_datasheet.php?id=513599&part-
number=LM340T5

Vendor Sites

• www.sharpmsa.com
• www.atmel.com
• www.st.com

Das könnte Ihnen auch gefallen