SlideShare a Scribd company logo
1 of 146
Download to read offline
Alexandria University
Faculty of Engineering
Communication and Electronics Department
B. Eng. Final Year Project
Sensor based Autonomous car
By:
Mennatallah Hany Hosny
Nancy Mohamed Abdou
Nagwan fawzyHassan
Nada Ashraf Megahed
Nermeen Mohamed Rmdan
Nehal Salah El-kony
Nourhan Abdelnaser Farrag
Supervised by:
Dr. Mohammed Morsy Farag
I
ACKNOWLEDGMENT
First and foremost, we thank Allah Almighty who paved path for us, in
achieving the desired goal.
We would like to express our sincere gratitude to our mentor
Dr. Mohammed Morsy Farag for the continuous support of our studies
and research, for his patience, motivation, enthusiasm, and immense
knowledge.
His guidance helped us in all the time for achieving the goals of our
graduation project.
We could not have imagined having a better advisor and mentor for our
graduation project.
Our thanks and appreciations also go to our colleagues in developing the
project and people who have willingly helped us out with their abilities.
Finally, an honorable mention goes to our parents, brothers, sisters and
families. Words cannot express how grateful we are. Your prayer for us
was what sustained us thus far. Without helps of the particular that
mentioned above, we would face many difficulties while doing this.
II
ABSTRACT
Whether you call them self-driving, driverless, automated, or autonomous, these
vehicles are on the move. Recent announcements by Google (which drove over
500,000 miles on its original prototype vehicles) and other major automakers indicate
the potential for development in this area. Driverless cars are often discussed as
“disruptive technology” with the ability to transform transportation infrastructure,
expand access, and deliver benefits to a variety of users. Some observers estimate
limited availability of driverless cars by 2020 with wide availability to the public by
2040.
The following sections describe the development and implementation of an
autonomous car model with some features. It provides a history of autonomous cars
and describes the entire development process of such cars.
The development of our prototype was completed through the use of two controllers;
Raspberry pi and Arduino.
The main parts of our model include the Raspberry pi, Arduino controller board,
motors, Ultrasonic sensors, Infrared sensors, optical encoder, X-bee module, and
lithium-ion batteries.
It also describes speed control of the car motion by the means of a process known as
PID tuning to make correct adjustments to the behavior of the vehicle.
III
Table of content
1. Introduction………………………………………………........ 1
1.1 History…………………………………………………….... 2
1.2 Why autonomous car is important…………………………. 4
1.2.1 Benefits of self-driving cars………………………….. 4
1.3 What are autonomous and automated vehicles…………….. 5
1.4 Advanced driver assistance system………………………… 7
1.5 Project description …………………………………………. 7
1.5.1 Auto parking………………………………………..… 7
1.5.2 Adaptive cruise control……………………………….. 7
1.5.3 Lane keeping………………………………………….. 8
1.5.4 Lane departure……………………………………….... 8
1.5.5 Indoor positioning system…………………………….. 8
1.5.6 Connected car…………………………………………… 8
1.6 Related work…………………………………………………. 9
2.Car Design……………………………………………… 12
2.1 First car design……………………………………………….. 13
2.1.1 Four WD robot ………………………………………… 13
2.1.1.1 specifications ………………………………….. 13
2.1.1.2 Real shots ……………………………………… 14
2.1.1.3 Drawbacks ……………………………………... 14
2.1.1.4 Overcoming Drawbacks ………………………. 14
2.1.2 Second trial …………………………………………….. 14
2.1.2.1 specifications ………………………………….... 15
2.1.2.2 Real shots ……………………………………….. 16
2.1.2.3 Drawbacks ……………………………………… 17
2.1.2.4 Overcoming Drawbacks …………………………17
2.1.3 Final design ……………………………………………...17
2.1.3.1 Body ……………………………………………...17
2.1.3.2 Side covers ……………………………………….18
2.1.3.3 Front and back covers …………………………….19
2.1.3.4 Cover ………………………………………………20
2.1.3.5 Real shots ………………………………………….20
2.1.3.6 Drawbacks ……………………………………… 20
2.2 Car wheel drive ………………………………………………………21
2.2.1 Types of wheel drive …………………………………………...21
2.2.2 Advantages of this configurations ……………………………...21
IV
2.3 Car steering …………………………………………………………….22
2.3.1 Basic geometry …………………………………………………...22
2.3.2 Our mechanism …………………………………………………...22
2.3.3 Servo motor modifications ………………………………………...23
2.4 Second car design ……………………………………………………….24
2.4.1 Final design ……………………………………………………….24
2.4.2 Real shots ………………………………………………………….24
2.5 Motors ……………………………………………………………………24
2.5.1 DC motor ………………………………………………………….25
2.5.1.1 DC motor fundamentals …………………………………..25
2.5.1.2 DC motor principle ……………………………………….25
2.5.1.3 Controlling DC motor …………………………………….26
2.5.2 Servo motor……………………………………………………….. 28
2.5.2.1 Servo motor features ……………………………………….28
2.5.2.2 Servo motor mechanism ……………………………………29
2.5.2.3 Inside Servo motor ………………………………………….30
2.5.2.4 Servo motor with Arduino …………………………………..31
3 Microcontrollers and Hardware ………………………………... 33
3.1 Microcontrollers ………………………………………………………… 34
3.1.1 Arduino ……………………………………………………………. 34
3.1.1.1 Introduction ………………………………………………... 34
3.1.1.2 Arduino Mega ……………………………………………... 36
3.1.2 Raspberry pi ……………………………………………………….. 39
3.1.2.1 Design ……………………………………………………… 39
3.1.2.2 ARM 1176 processor ……………………………………… 39
3.1.2.3 Features …………………………………………………….. 40
3.1.2.4 Performance ………………………………………………… 40
3.1.2.5 Function supported in Hardware ……………………………. 40
3.1.2.6 Comparison ………………………………………………….. 41
3.2 Hardware …………………………………………………………………… 42
3.2.1 Ultrasonic sensor ……………………………………………………. 42
3.2.1.1 Introduction ……………………………………………………42
3.2.1.2 Features ………………………………………………………...42
3.2.1.3 Connection with Arduino ………………………………………43
3.2.1.4 Connection with raspberry pi …………………………………43
3.2.2 Infrared tracking sensor ………………………………………………..44
3.2.2.1 Introduction …………………………………………………….44
3.2.2.2 Theory of operation ……………………………………………44
3.2.2.3 Features and pins ……………………………………………….45
V
3.2.2.4 Arduino connection …………………………………………..46
3.2.3 Optical encoder ……………………………………………………….46
3.2.3.1 Introduction …………………………………………………..46
3.2.3.2 Specifications ………………………………………………….47
4 Adaptive cruise control 48
4.1 Definitions………………………………………………………………….. 49
4.2 Introduction ………………………………………………………………….49
4.3 Applications ………………………………………………………………….50
4.3.1 Theory of operations ……………………………………………………50
4.3.2 Sensor options …………………………………………………………..50
4.3.2.1 LIDAR …………………………………………………………..51
4.3.2.2 RADAR ………………………………………………………….51
4.3.2.3 Fusion sensor …………………………………………………….51
4.3.2.4 Ultrasonic sensor ………………………………………………..52
4.4 Algorithm ……………………………………………………………………..53
4.5 Implementation and testing …………………………………………………..54
4.5.1 Steps ……………………………………………………………………..54
4.6 Designing a control system …………………………………………………...55
4.6.1 Design in real systems …………………………………………………..55
4.6.2 Design in our system …………………………………………………….55
4.6.3 Controllers ……………………………………………………………….55
4.6.3.1 P controller ……………………………………………………...55
4.6.3.2 PI Controller ……………………………………………………..56
4.6.3.3 PD Controller …………………………………………………....57
4.6.3.4 PID controller ……………………………………………………57
4.6.4 Definitions of terminologies …………………………………………….60
4.6.5 Distance-speed PID ……………………………………………….61
4.6.6 Speed PID ………………………………………………………….62
4.7 Application in real car …………………………………………………………67
5 Lane keeping …………………………………………………………..68
5.1 Introduction ……………………………………………………………………69
5.2 History …………………………………………………………………………69
5.3 Timeline of available systems …………………………………………………69
5.4 Application in real Car …………………………………………………….......71
5.5 Limitations of Lane keeping system …………………………………………..72
5.6 Prototyping of lane keeping …………………………………………………..72
5.6.1 Basic components ………………………………………………………..72
VI
5.6.2 Algorithm ……………………………………………………………….72
5.6.3 Implementation and testing ……………………………………………..73
5.6.4 Limitations of implemented model …………………………………….77
5.7 Conclusion …………………………………………………………………….77
6 Lane departure ………………………………………………………..78
6.1 Definition ………………………………………………………………….......79
6.2 Introduction …………………………………………………………………...80
6.3 Basic components ……………………………………………………………...80
6.4 Implementation ………………………………………………………………..80
6.5 Algorithm ……………………………………………………………………...81
6.5.1 Concept ………………………………………………………………….81
6.5.2 Algorithm ……………………………………………………………….82
6.6 Application in real car …………………………………………………………82
7 Integrating function …………………………………………………...83
7.1 Algorithm ……………………………………………………………………...84
7.2 Implementation ………………………………………………………………..86
8 Auto parking …………………………………………………………87
8.1 Definitions …………………………………………………………………..88
8.2 Introduction ………………………………………………………………….88
8.3 Application …………………………………………………………………..88
8.4 Hardware …………………………………………………………………….89
8.5 Parking types ………………………………………………………………..103
8.6 Parallel parking ………………………………………………………………104
8.6.1 Parallel parking steps …………………………………………………..104
8.6.2 Algorithm ………………………………………………………………107
8.7 Perpendicular parking ………………………………………………………..108
8.7.1 Steps ……………………………………………………………………108
8.7.2 Perpendicular parking Algorithm ………………………………………108
8.8 Tuning methods ………………………………………………………………109
9 Indoor positioning system ………………………………………....110
9.1 Introduction ………………………………………………………………..111
9.2 Indoor positioning Algorithm ……………………………………………..113
9.2.1 Angle of arrival ………………………………………………………113
9.2.2 Time of arrival ……………………………………………………….114
9.2.3 Time difference of arrival ……………………………………………114
VII
9.2.4 Received signal strength …………………………………………….115
9.2.4.1 Log distance path loss model ………………………………..116
9.3 Available positioning systems …………………………………………….116
9.3.1 Infrared base system …………………………………………………116
9.3.2 Ultrasound base system ……………………………………………...118
9.3.2.1 Ultrasound system application ………………………………118
9.3.3 Ultra-wide band ……………………………………………………...119
9.3.4 Appling radio frequency based system ………………………………119
9.3.4.1 Indoor positioning system using RFID ……………………… 120
9.3.4.2 Indoor positioning system using ZigBee ……………………. 122
10 Connected Car ……………………………………………………. 124
10.1 Definition ……………………………………………………………….. 125
10.2 Function Description ……………………………………………………. 125
10.3 Implementation tools ……………………………………………………. 126
10.3.1 Arduino Yun ……………………………………………………... 126
10.3.2 Web-cam …………………………………………………………. 126
10.4 Steps of implementation………………………………………………….. 127
10.5 Results ……………………………………………………………………. 128
11 Conclusion …………………………………………………………. 129
12 References ………………………………………………………….. 131
VIII
List of Figures
Figure 1-1 Google car (Page 9)
Figure 1-2 Progression of automated vehicle technologies (Page 10)
Figure 2-1 Four WD robot (Page 14)
Figure 2-2 Four WD real shot (Page 14)
Figure 2-3 Second design trial AutoCad design. (Page 15)
Figure 2-4 Second car trial real shots. (Page 16)
Figure 2-5 Second car trial connection. (Page 17)
Figure 2-6 Final car design. (Page 17)
Figure 2-7 Final car side covers. (Page 18)
Figure 2-8 Final car front and back covers. (Page 19)
Figure 2-9 Final car cover. (Page 20)
Figure 2-10 Final car real shots. (Page 20)
Figure 2-11 Types of wheel drive. (Page 21)
Figure 2-12 Final car inside view. (Page 21)
Figure 2-13 Final car center of turning circle. (Page 22)
Figure 2-14 Old car design servomotor mechanism. (Page 23)
Figure 2-15 Last car design servomotor. (Page 23)
Figure 2-16 Second car real shots. (Page 24)
Figure 2-17 DC motor theory. (Page 25)
Figure 2-18 Dual H-bridge. (Page 26)
Figure 2-19 Second car motors connection. (Page 27)
Figure 2-20 First car motor connection. (Page 28)
Figure 2-21 Servo motor mechanism. (Page 29)
Figure 2-22 Inside servo motor diagram. (Page 30)
Figure 2-23 Inside servo motor real shot. (Page 31)
Figure 2-24 Connection of servo motor with Arduino. (Page 32)
Figure 3-1 Arduino types. (Page 36)
Figure 3-2 Arduino mega. (Page 36)
IX
Figure 3-3 Rpi memory management. (Page 39)
Figure 3-4 Ultrasonic sensor. (Page 42)
Figure 3-5 Ultrasonic sensor connection with Arduino. (Page 43)
Figure 3-6 Ultrasonic sensor connection with Rpi. (Page 43)
Figure 3-7 Infrared sensor. (Page 44)
Figure 3-8 Infrared sensor pins. (Page 45)
Figure 3-9 IR sensor connection with Arduino. (Page 46)
Figure 3-10 Optical Encoder. (Page 46)
Figure 4-1 Adaptive cruise control in real cars. (Page 50)
Figure 4-2 Operation of LIDAR. (Page 51)
Figure 4-3 Operation of fusion sensor. (Page 52)
Figure 4-4 Operation of ultrasonic sensor. (Page 52)
Figure 4-5 Feedback control system. (Page 53)
Figure 4-6 PID theory. (Page 59)
Figure 4-7 Graph showing PID definition of terminologies. (Page 60)
Figure 4-8 Graph showing dead time. (Page 61)
Figure 4-9 On and off switching method of motor. (Page 63)
Figure 4-10 Unit-step response of a plant. (Page 63)
Figure 4-11 S-shaped response curve. (Page 64)
Figure 4-12 Closed-loop system with a proportional controller. (Page 65)
Figure 4-13 Sustained oscillation with period Pcr. (Page 65)
Figure 4-14 step response of motor. (Page 66)
Figure 4-15 step response with tangent. (Page 66)
Figure 4-16 system performance. (Page 67)
Figure 5-1 Lane-keeping system structure. (Page 71)
Figure 5-2 Lane-keeping flowchart. (Page 73)
Figure 5-3 Showing first car design length. (Page 74)
Figure 5-4 First track material. (Page 74)
Figure 5-5 Final track path and material. (Page 75)
X
Figure 5-6 Final car design length. (Page 76)
Figure 5-7 New connection of Dual H-bridge. (Page 76)
Figure 6-1 Lane departure flow chart. (Page 82)
Figure 7-1 Lane keeping and Lane departure flag. (Page 84)
Figure 7-2 Merging flow chart. (Page 85)
Figure 8-1 H-bridge used with auto parking. (Page 89)
Figure 8-2 Male to male jumpers. (Page 89)
Figure 8-3 Raspberry pi. (Page 89)
Figure 8-4 Second car DC motor. (Page 89)
Figure 8-5 Ultrasonic sensor of second car. (Page 90)
Figure 8-6 Battery holder and batteries. (Page 90)
Figure 8-7 Resistance in second car connection (Page 90)
Figure 8-8 Mini breadboard. (Page 90)
Figure 8-9 Second car DC motor connection. (Page 91)
Figure 8-10 Raspberry pi GPIO. (Page 93 )
Figure 8-11 PWM. (Page 94)
Figure 8-12 Voltage divider circuit. (Page 96)
Figure 8-13 Ultrasonic sensor connection with Rpi. (Page 97)
Figure 8-14 Ultrasonic sensor pins. (Page 98)
Figure 8-15 Ultrasonic real shot connection with Rpi. (Page 98)
Figure 8-16 Second car final shot. (Page 101)
Figure 8-17 Testing ultrasonic code. (Page 102)
Figure 8-18 Parallel parking. (Page 103)
Figure 8-19 Perpendicular parking. (Page 103)
Figure 8-20 Angle parking. (Page 104)
Figure 8-21 Finding parking area. (Page 104)
Figure 8-22 Step 1 for parallel parking. (Page 105)
Figure 8-23 Step 2 for parallel parking. (Page 105)
Figure 8-24 Rest of step 2 for parallel parking. (Page 105)
XI
Figure 8-25 Step 3 for parallel parking. (Page 106)
Figure 8-26 Step 4 for parallel parking. (Page 106)
Figure 8-27 Parallel parking detect space state diagram. (Page 107)
Figure 8-28 Parallel parking state diagram. (Page 107)
Figure 8-29 Perpendicular parking state diagram. (Page 108)
Figure 8-30 Car moving forward for enough space. (Page 109)
Figure 8-31 Sensing perpendicular parking area dimensions. (Page 109)
Figure 9-1 Positioning Satellite in the orbit. (Page 111)
Figure 9-2 Localization systems. (Page 112)
Figure 9-3 Triangulation. (Page 113)
Figure 9-4 An antenna array. (Page 113)
Figure 9-5 The length of the arrows corresponds to the arrival time at receiver P. (Page 114)
Figure 9-6 Positioning based on TDOA measurements. (Page 114)
Figure 9-7 Position measuring. (Page 116)
Figure 9-8 Positioning systems. (Page 116)
Figure 9-9 Infrared base system positioning (Page 117)
Figure 9-10 Ultrasound system application. (Page 118)
Figure 9-11 RFID. (Page 120)
Figure 9-12 RFID reader. (Page 121 )
Figure 9-13 Arduino yun. (Page 121)
Figure 9-14 Layout of the 3 by 3 Grid RFID Positioning System. (Page 122)
Figure 9-15 Zigbee modules. (Page 123)
Figure 10-1 Arduino Yun WiFi connection. (Page 126)
Figure 10-2 uploaded image on drop+box. (Page 128)
1
Introduction
Chapter 1
2
1.1 History
1930s
An early representation of the autonomous car was Norman Bell Geddes's Futurama exhibit
sponsored by General Motors at the 1939 World's Fair, which depicted electric cars powered
by circuits embedded in the roadway and
controlled by radio.
1950s
In 1953, RCA Labs successfully built a miniature
car that was guided and controlled by wires that
were laid in a pattern on a laboratory floor. The
system sparked the imagination of Leland M.
Hancock, traffic engineer in the Nebraska
Department of Roads, and of his director, L. N.
Ress, state engineer. The decision was made to
experiment with the system in actual highway
installations. In 1958, a full size system was successfully demonstrated by RCA Labs and the
State of Nebraska on a 400-foot strip of public highway just outside Lincoln, Neb.
1980s
In the 1980s, a vision-guided Mercedes-Benz robotic van, designed by Ernst Dickmanns and
his team at the Bundeswehr University Munich in Munich, Germany, achieved a speed of 39
miles per hour (63 km/h) on streets without traffic. Subsequently, EUREKA conducted the
€749 million Prometheus Project on autonomous vehicles from 1987 to 1995.
1990s
In 1991, the United States Congress passed the ISTEA Transportation Authorization bill,
which instructed USDOT to "demonstrate an automated vehicle and highway system by
1997." The Federal Highway Administration took on this task, first with a series of Precursor
Systems Analyses and then by establishing the National Automated Highway System
Consortium (NAHSC). This cost-shared project was led by FHWA and General Motors, with
Caltrans, Delco, Parsons Brinkerhoff, Bechtel, UC-Berkeley, Carnegie Mellon University,
and Lockheed Martin as additional partners. Extensive systems engineering work and
research culminated in Demo '97 on I-15 in San Diego, California, in which about 20
automated vehicles, including cars, buses, and trucks, were demonstrated to thousands of
onlookers, attracting extensive media coverage. The demonstrations involved close-headway
platooning intended to operate in segregated traffic, as well as "free agent" vehicles intended
to operate in mixed traffic.
3
2000s
The US Government funded three military efforts known as Demo I (US Army), Demo II
(DARPA), and Demo III (US Army). Demo III (2001) demonstrated the ability of unmanned
ground vehicles to navigate miles of difficult off-road terrain, avoiding obstacles such as
rocks and trees. James Albus at the National Institute for Standards and Technology provided
the Real-Time Control System which is a hierarchical control system. Not only were
individual vehicles controlled (e.g. Throttle, steering, and brake), but groups of vehicles
had their movements automatically coordinated in response to high level goals. The Park
Shuttle, a driverless public road transport system, became operational in the Netherlands in
the early 2000s.In January 2006, the United Kingdom's 'Foresight' think-tank revealed a
report which predicts RFID-tagged driverless cars on UK's roads by 2056 and the Royal
Academy of Engineering claimed that driverless trucks could be on Britain's motorways by
2019.
Autonomous vehicles have also been used in mining. Since December 2008, Rio Tinto Alcan
has been testing the Komatsu Autonomous Haulage System – the world's first commercial
autonomous mining haulage system – in the Pilbara iron ore mine in Western Australia. Rio
Tinto has reported benefits in health, safety, and productivity. In November 2011, Rio Tinto
signed a deal to greatly expand its fleet of driverless trucks. Other autonomous mining
systems include Sandvik Automine’s underground loaders and Caterpillar Inc.'s autonomous
hauling.
In 2013, on July 12, VisLab conducted another pioneering test of autonomous vehicles,
during which a robotic vehicle drove in downtown Parma with no human control,
successfully navigating roundabouts, traffic lights, pedestrian crossings and other common
hazards.
In 2011, the Freie Universität Berlin developed two autonomous cars to drive in the inner
city traffic of Berlin in Germany. Led by the AUTONOMOS group, the two vehicles Spirit
of Berlin and made in Germany handled intercity traffic, traffic lights and roundabouts
between International Congress Centrum and Brandenburg Gate. It was the first car licensed
for autonomous driving on the streets and highways in Germany and financed by the German
Federal Ministry of Education and Research.
The 2014 Mercedes S-Class has options for autonomous steering, lane keeping,
acceleration/braking, parking, accident avoidance, and driver fatigue detection, in both city
traffic and highway speeds of up to 124 miles (200 km) per hour.
Released in 2013, the 2014 Infiniti Q50 uses cameras, radar and other technology to deliver
various lane-keeping, collision avoidance and cruise control features. One reviewer
remarked, "With the Q50 managing its own speed and adjusting course, I could sit back and
simply watch, even on mildly curving highways, for three or more miles at a stretch adding
that he wasn't touching the steering wheel or pedals.
4
Although as of 2013, fully autonomous vehicles are not yet available to the public, many
contemporary car models have features offering limited autonomous functionality. These
include adaptive cruise control, a system that monitors distances to adjacent vehicles in the
same lane, adjusting the speed with the flow of traffic lane which monitors the vehicle's
position in the lane, and either warns the driver when the vehicle is leaving its lane, or, less
commonly, takes corrective actions, and parking assist, which assists the driver in the task of
parallel parking
1.2 Why autonomous car is important
1.2.1 Benefits of Self-Driving Cars
1. Fewer accidents
The leading cause of most automobile accidents today is driver error. Alcohol, drugs,
speeding, aggressive driving, over-compensation, inexperience, slow reaction time,
inattentiveness, and ignoring road conditions are all contributing factors. Given some
40 percent of accidents can be traced to the abuse of drugs and or alcohol, self-driving
cars would practically eliminate those accidents altogether.
2. Decreased (or Eliminated) Traffic Congestion
One of the leading causes of traffic jams is selfish behavior among drivers. It has been
shown when drivers space out and allow each other to move freely between lanes on
the highway, traffic continues to flow smoothly, regardless of the number of cars on
the road.
3. Increased Highway Capacity
There is another benefit to cars traveling down the highway and communicating with
one another at regularly spaced intervals. More cars could be on the highway
simultaneously because they would need to occupy less space on the highway
4. Enhanced Human Productivity
Currently, the time spent in our cars is largely given over to simply getting the car and
us from place to place. Interestingly though, even doing nothing at all would serve to
increase human productivity. Studies have shown taking short breaks increase overall
productivity.
You can also finish up a project, type a letter, monitor the progress of your kid’s
schoolwork, return phone calls, take phone calls safely, text until your heart’s content,
read a book, or simply relax and enjoy the ride .
5. Hunting For Parking Eliminated
Self-driving cars can be programmed to let you off at the front door of your
destination, park themselves, and come back to pick you up when you summon them.
You’re freed from the task of looking for a parking space, because the car can do it all
5
6. Improved Mobility For Children, The Elderly, And The Disabled
Programming the car to pick up people, drive them to their destination and Then Park
by themselves, will change the lives of the elderly and disabled by providing them
with critical mobility.
7. Elimination of Traffic Enforcement Personnel
If every car is “plugged” into the grid and driving itself, then speeding,—along with
stop sign and red light running will be eliminated. The cop on the side of the road
measuring the speed of traffic for enforcement purposes? Yeah, they’re gone. Cars
won’t speed anymore. So no need to Traffic Enforcement Personnel.
8. Higher Speed Limits
Since all cars are in communication with one another, and they’re all programmed to
maintain a specific interval between one another, and they all know when to expect
each other to stop and start, the need to accommodate human reflexes on the highway
will be eliminated. Thus, cars can maintain higher average speeds.
9. Lighter, More Versatile Cars
The vast majority of the weight in today’s cars is there because of the need to
incorporate safety equipment. Steel door beams, crumple zones and the need to build
cars from steel in general relate to preparedness for accidents. Self-driving cars will
crash less often, accidents will be all but eliminated, and so the need to build cars to
withstand horrific crashes will be reduced. This means cars can be lighter, which will
make them more fuel-efficient
1.3 What Are Autonomous and Automated Vehicles
Technological advancements are creating a continuum between conventional, fully human-
driven vehicles and automated vehicles, which partially or fully drive themselves and which
may ultimately require no driver at all. Within this continuum are technologies that enable a
vehicle to assist and make decisions for a human driver. Such technologies include crash
warning systems, adaptive cruise control (ACC), lane keeping systems, and self-parking
technology.
• Level 0 (no automation):
The driver is in complete and sole control of the primary vehicle functions (brake, steering,
throttle, and motive power) at all times, and is solely responsible for monitoring the roadway
and for safe vehicle operation.
• Level 1 (function-specific automation):
Automation at this level involves one or more specific control functions; if multiple functions
are automated, they operate independently of each other. The driver has overall control, and
is solely responsible for safe operation, but can choose to cede limited authority over a
6
primary control (as in ACC); the vehicle can automatically assume limited authority over a
primary control (as in electronic stability control); or the automated system can provide
added control to aid the driver in certain normal driving or crash-imminent situations (e.g.,
dynamic brake support in emergencies).
• Level 2 (combined-function automation):
This level involves automation of at least two primary control functions designed to work in
unison to relieve the driver of controlling those functions. Vehicles at this level of
automation can utilize shared authority when the driver cedes active primary control in
certain limited driving situations. The driver is still responsible for monitoring the roadway
and safe operation, and is expected to be available for control at all times and on short notice.
The system can relinquish control with no advance warning and the driver must be ready to
control the vehicle safely.
• Level 3 (limited self-driving automation):
Vehicles at this level of automation enable the driver to cede full control of all safety-critical
functions under certain traffic or environmental conditions, and in those conditions to rely
heavily on the vehicle to monitor for changes in those conditions requiring transition back to
driver control. The driver is expected to be available for occasional control, but with
sufficiently comfortable transition time
• Level 4 (full self-driving automation):
The vehicle is designed to perform all safety-critical driving functions and monitor roadway
conditions for an entire trip. Such a design anticipates that the driver will provide destination
or navigation input, but is not expected to be available for control at any time during the trip.
This includes both occupied and unoccupied vehicles.
Our project can be considered as level 1 or level 2 type.
7
1.4 Advanced Driver Assistance System (ADAS)
A rapid growth has been seen worldwide in the development of Advanced Driver Assistance
Systems (ADAS) because of improvements in sensing, communicating and computing
technologies.
ADAS aim to support drivers by either providing warning to reduce risk exposure, or
automating some of the control tasks to relieve a driver from manual control of a vehicle.
From an operational point of view, such systems are a clear departure from a century of
automobile development where drivers have had control of all driving tasks at all times.
ADAS could replace some of the human driver decisions and actions with precise machine
tasks, making it possible to eliminate many of the driver errors which could lead to accidents,
and achieve more regulated and smooth vehicle control with increased capacity and
associated energy and environmental benefits.
Autonomous ADAS systems use on-board equipment, such as ranging sensors and
machine/computer vision, to detect surrounding environment.
The main advantages of such an approach are that the system operation does not rely on
other parties and that the system can be implemented on the current road infrastructure.
Now many systems have become available on the market including Adaptive Cruise Control
(ACC), Forward Collision Warning (FCW) and Lane Departure Warning systems, and many
more are under development. Currently, radar sensors are widely used in the ADAS
applications for obstacle detection. Compared with optical or infrared sensors, the main
advantage of radar sensors is that they perform equally well during day time and night time,
and in most weather conditions. Radar can be used for target identification by making use of
scattering signature information.
It is widely used in ADAS for supporting lateral control such as lane departure warning
systems and lane keeping systems.
Currently computer vision has not yet gained a large enough acceptance in automotive
applications. Applications of computer vision depend much on the capability of image
process and pattern recognition (e.g. artificial intelligence). The fact that computer vision is
based on a passive sensory principle creates detection difficulties in conditions with adverse
lighting or in bad weather situations.
1.5 Project description
1.5.1 Auto-parking
The aim of this function is to design and implement self-parking car system that moves a
car from a traffic lane into a parking spot through accurate and realistic steps which can be
applied on a real car.
1.5.2 Adaptive cruise control (ACC)
Also radar cruise control, or traffic-aware cruise control is an optional cruise control system
for road vehicles that automatically adjusts the vehicle speed to maintain a safe distance from
vehicles ahead. It makes no use of satellite or roadside infrastructures nor of any cooperative
8
support from other vehicles. Hence control is imposed based on sensor information from on-
board sensors only.
1.5.3 Lane Keeping Assist
It is a feature that in addition to Lane Departure Warning System automatically takes steps
to ensure the vehicle stays in its lane. Some vehicles combine adaptive cruise control with
lane keeping systems to provide additional safety. A lane keeping assist mechanism can
either reactively turn a vehicle back into the lane if it starts to leave or proactively keep the
vehicle in the center of the lane. Vehicle companies often use the term "Lane Keep(ing)
Assist" to refer to both reactive Lane Keep Assist (LKA) and proactive Lane Centering
Assist (LCA) but the terms are beginning to be differentiated
1.5.4 Lane departure
Our car moves using adaptive cruise control according to distance of front vehicle .If front
vehicle is very slow and will cause our car to slow down the car will start to check the lane
next to it and then depart to the next lane in order to speed up again.
1.5.5 Indoor Positioning system
An indoor positioning system (IPS) is a system to locate objects or people inside a building
using radio waves, magnetic fields, acoustic signals, or other sensory information collected
by mobile devices. There are several commercial systems on the market, but there is no
standard for an IPS system.
IPS systems use different technologies, including distance measurement to nearby anchor
nodes (nodes with known positions, e.g., Wi-Fi access points), magnetic positioning, dead
reckoning. They either actively locate mobile devices and tags or provide ambient location or
environmental context for devices to get sensed. The localized nature of an IPS has resulted
in design fragmentation, with systems making use of various optical, radio, or even acoustic
technologies.
1.5.6 Connected car
The aim of this function is:
 Take a picture with a webcam plugged into the Arduino Yun
 Upload the image to drop box using Python
9
1.6 Related work
The appearance of driverless and automated vehicle technologies offers enormous
opportunities to remove human error from driving. It will make driving easier, improve road
safety, and ease congestion. It will also enable drivers to choose to do other things than
driving during the journey.
It is the first driverless electric car prototype built by Google to test self-driving car project. It
looks like a Smart car, with two seats and room enough for a small amount of luggage
Figure 1-1 Google car
It operates in and around California, primarily around the Mountain View area where Google
has its headquarters.
It move two people from one place to another without any user interaction. The car is called
by a smartphone for pick up at the users location with the destination set. There is no steering
wheel or manual control, simply a start button and a big red emergency stop button. In front
of the passengers there is a small screen showing the weather and the current speed. Once
the journey is done, the small screen displays a message to remind you to take your personal
belongings. Seat belts are also provided in car to protect the passengers from the primary
systems fails; plus that emergency stop button that passengers can hit at any time.
Powered by an electric motor with around a 100 mile range, the car uses a combination of
sensors and software to locate itself in the real world combined with highly accurate digital
maps. A GPS is used, just like the satellite navigation systems in most cars, lasers and
cameras take over to monitor the world around the car, 360-degrees.
The software can recognize objects, people, cars, road marking, signs and traffic lights,
obeying the rules of the road. It can even detect road works and safely navigate around them
10
The new prototype has more sensors fitted to it that can see further (up to 600 feet in all
directions)
The simultaneous development of a combination of technologies has brought about this
opportunity. For example, some current production vehicles now feature adaptive cruise
control and lane keeping technologies which allow the automated control of acceleration,
braking and steering for periods of time on motorways, major A-roads and in congested
traffic. Advanced emergency braking
Systems automatically apply the brakes to help drivers avoid a collision. Self-parking
systems allow a vehicle to parallel or Reverse Park completely hands free. Developments in
vehicle automation technology in the short and medium term will move us closer to the
ultimate scenario of a vehicle which is completely “driverless”.
Figure 1-2 progression of automated vehicle technologies
11
VOLVO autonomous CAR
semi-autonomous driving features:
sensors can detect lanes and a car in front of it.
Button in the steering wheel to let the system know I want it to use
Adaptive Cruise Control with Pilot Assist.
If the XC90 lost track of the lanes, it would ask the driver to handle steering duties with a
ping and a message in the dashboard. This is called the Human-machine interface
BMW autonomous CAR
A new i-Series car will include forms of automated driving and
digital connectivity most likely Wi-Fi, high-definition digital maps,
sensor technology, cloud technology and artificial intelligence.
Nissan autonomous CAR
Nissan vehicles in the form of Nissan’s Safety Shield-inspired
technologies. These technologies can monitor a nearly 360-degree view
around a vehicle for risks, offering warnings to the driver and taking
action to help avoid crashes if necessary.
12
Car Design
Chapter 2
13
2.1 First car design
In this section, we will talk about the trials that we passed by till reaching our last prototype
concerning the first car in our project. This car performs some functions of our project such
as the adaptive cruise control (ACC), lane keeping and lane departure.
2.1.1 Four WD Robot (Acrylic with 4 Motors and 4 Wheels)
The 4WD robot consists of four gear-motors with 65mm diameter wheels. The chassis plates
contain numerous cuts and holes for mounting sensors, microcontrollers and other hardware.
The space between the plates is ideal for batteries or more components.
2.1.1.1 Specifications
1) Motors
 Suggested Voltage:4.5V DC (work
well from 3-6V)
 No load Speed:90±10rpm
 No Load
Current:190mA(max.250mA)
 Torque:800gf.cm (Minimum)
 Stall current approximately 1A
2) Wheels
 65mm diameter, 30mm width
 Plastic rims with solid rubber tires
3) Chassis
 Laser cut acrylic
 Metal standoffs
 Top and bottom plates are both
110mm long x 174mm wide
Figure 2-1 four WD robot
14
2.1.1.2 Real Shots
Figure 2-2 four WD real shot
2.1.1.3 Drawbacks
1) The 4WD robot uses four wheels with four Dc motors which is not similar to a real car.
2) The steering mechanism is not accurate, which causes many problems while working.
3) The robot size is very small which is not stable and can be easily broken.
2.1.1.4 Overcoming the drawbacks
1) Implementing a mechanical design to serve our needs
2) Using servo motor with steering mechanism to give stable steering while turning left or
right.
2.1.2 Second Trial
The mechanical design is considered as one of the most important parts in our project
because:
1- Without a good design the car may fail in accomplishing its tasks.
15
2- The body carries all the electrical components, if the body might fail to withstand the
stresses.
2.1.2.1 Specifications
1) Main body: length= 360 mm, width=140 mm, aspect ratio between length and width is
similar to Honda Jazz – 2011.
Figure 2-3 second design trial AutoCad design
2) Motors
*Servo motor.
*DC motor with dual H-bridge.
3) Wheels
* 4 rubber wheels.
* Plastic rims with solid rubber tires.
Front wheel place
Front fixing slots
Servo position
Back fixing slots
Driving motor
position
Side fixing slots
16
4) Chassis
* Laser cut acrylic.
* 3D holders for the IR sensor.
2.1.2.2 Real Shots
First shot shows the servomotor with the front wheel, Arduino card, and back wheel with the
driving DC motor.
Figure 2-4 second car trial real shots
It’s obvious that the length to width ratio could cause problem during the turns.
17
The car with all components on and connected.
Figure 2-5 second car trial connection
2.1.2.3 Drawbacks
1- The car bulk loaded with all other parts makes it hard to take turn.
2- The sharp edge in the front wheel position, causes friction with the wheels and, makes
it hard to take turns.
3- The position of servomotor and the main front wheel link connection was weak.
2.1.2.4 Overcoming these problems
Modifying the original design by changing the length to 260 mm and keep the width 140
mm, that led to better performance in taking turns
2.1.3 Final Design
2.1.3.1 Body
Figure 2-6 final car design
Fillet to overcome
wheel friction with the
body
18
2.1.3.2 Side Covers
The height of the side cover is 114 mm and length was 360 mm then reduced to 260 mm to
fit the modified, as following there are two figures, on the right hand side is the right cover,
on the left hand side is the left cover.
Figure 2-7 final car side covers
The side covers are used to overcome the modification draw back, the
sides provide the area required to fix the rest of components without any problems.
Ultrasound
sensors slots
The cover
fixing slots
Front wheels
slots
Arduino cable slot
The Base
fixing slots
Back wheels
slots
19
2.1.3.3 The Front and Back Covers
The dimensions are 140 mm width and 114 mm height, provided with slots to fix the
ultrasound sensors.
Figure 2-8 final car front and back covers
The ultrasound sensor
slots
Side slots
Cover slots
Base slots
20
2.1.3.4 Cover
The cover
dimensions
are 260 mm
length and
140 mm
width. The
cover
function is to
keep all the
small and
other
components
inside.
We notice that the design is not aerodynamically considered, that’s because the project target
is the control and apply the function, not to study the aerodynamic effects of cars.
2.1.3.5 Real shots
Figure 2-10 final car real shots
2.1.3.6 Drawback
The compact size causes another expected problem, there are many components require more
space, and the total area is reduced.
Figure 2-9 final car cover
21
2.2 Car Wheel Drive
2.2.1 Types of wheel drive
Figure 2-11 types of wheel drive
Our car is using rear-wheel-drive.
2.2.2 Advantages of this configuration:
1- Even weight distribution.
2- Better control at the turns.
3- Better steering radius.
Wheel
drive
two-wheel
drive
front drive
rear drive
four-wheel
drive
Figure 2-12 final car inside view
22
2.3 Car Steering
2.3.1 Basic geometry
The basic aim of steering is to ensure that the wheels are pointing in the desired directions.
This is typically achieved by a series of linkages, rods, pivots and gears. One of the
fundamental concepts is that of caster angle – each wheel is steered with a pivot point ahead
of the wheel; this makes the steering tend to be self-centering towards the direction of travel.
Figure 2-13 final car center of turning circle
23
2.3.2 Our mechanism
It is controlled automatically by a servomotor
connected directly to the main link.
Shown in the picture the old mechanism, it’s
obvious that the orientation of the
servomotor is not correct.
The servomotor at this position doesn’t give
all the desired angles.
So modifications are made.
2.3.3 Servomotor
modifications
Modifications are made to ensure
better performance in turns, the new
mechanism is less heavy, more
flexible with turns. As shown in
following image.
The servomotor in the new position
gives all the angles and transfer more
torque.
Servomotor in the
new position
Servomotor in the
old position
Figure 2-14 old car design servomotor mechanism
Figure 2-15 last car design servomotor
24
2.4 Second car design
We are going to talk about the design of the second car used in our project and the trials till
reaching the last prototype. The second car performs the auto-parking function in our project.
It passed by nearly the same trials as the first car but concerning the final design, it was not
the same. So we will discuss the final design in the following lines.
2.4.1 Final design
The final design of the second car is an RC car. The RC car is the best choice for
implementing the auto-parking function because all the above designs did not help in
fulfilling the function correctly.
2.4.2 Real shots
Figure 2-16 second car real shots
2.5 Motors
The motor is the primary tool for creating motion. At its simplest use, you can use it to make
something spin. With a little more mechanical work, using gears and other mechanical
devices, you can use a motor to make something move, vibrate, rise, fall, roll, creep, or
perform almost any other type of motion that does not require precise positioning. There are
several different kinds of motors: servos, stepper motors, or unidirectional DC motors. In this
section, we will talk about DC and servo motors and how they can be. Simple motors are
good for designs that need motion forward or backward, like a remote control car or a fan,
but not for things that need to move to a precise position, like a robotic arm or anything that
points or moves something to a controlled position.
25
2.5.1 DC Motor
D. C motors are seldom used in ordinary applications because all electric supply companies
furnish alternating current. However, for special applications such as in steel mills, mines
and electric trains, it is advantageous to convert alternating current into direct current in order
to use DC motors. The reason is that speed/torque characteristics of DC motors are much
more superior to that of AC motors. Therefore, it is not surprising to note that for industrial
drives, DC motors are as popular as 3-phase induction motors. Like DC generators, dc
motors are also of three types. (series-wound , shunt-wound and compound wound). The use
of a particular motor depends upon the mechanical load it has to drive. Motors are all around
us; just look inside moving toys, and you’ll find a number of excellent motors and gears. Any
electronics supplier will have a wide range of motors that will suit many purposes from
spinning small objects to driving large loads
2.5.1.1 D.C Motor Fundamentals
DC motors consist of rotor (or armature), commentator, brushes, rotating shaft and bearings,
stator with permanent magnet. The principle of operation with a simple two-pole dc motor:
The torque is produced by the fact that like field poles attracts and unlike poles repel.
2.5.1.2 DC Motor Principle
It is a machine that converts DC power into mechanical power. Its operation is based on the
principle that when a current carrying conductor is placed in a magnetic field, the conductor
experiences a mechanical force. Basically, there is no constructional difference between a
DC motor and a DC generator. The same DC machine can be run as generator motor.
Figure 2-17 DC motor theory
26
2.5.1.3 Controlling DC Motor
First we have to mention that the Dc motor used in our project was taken from RC toy car
and we repurpose it to match our needs and design for both cars. Here we will talk briefly
about controlling the motor and its connection with the Arduino.
1) H-Bridge
An H bridge is an electronic circuit that enables voltage to be supplied to the DC motor and
control its direction. This circuit is often used in robotics and other applications.
1.1 L298 Dual Motor Driver Module This driver module is based on L298N H-bridge, a
high current, high voltage dual full bridge driver manufactured by ST Company. It
can drive up to 2 DC motors 2A each. The driver can control both motor RPM and
direction of rotation.
The RPM is controlled using PWM input to
ENA or ENB pins, while rotation direction
is controlled by supplying high and low
signal to EN1-EN2 for the first motor or
EN3-EN4 for second motor. This Dual H-
Bridge driver is capable of driving voltages
up to 46V.
1.2 Features
 Dual H bridge drive (can drive 2 DC
motors).
 Chip L298N.
 Logical voltage 5V.
 Drive voltage 5V-35V.
 Logic current 0mA-36mA.
 Drive current 2A (For each DC motor)).
 Weight 30gm.
 Size: 43*43*27mm.
Figure 2-18 Dual H-bridge
27
1.3 Driver connection with Arduino
It has 8 pins:
1- GND.
2- + 5 V (power for driver (not motor)).
3- ENA: Motor enable for Motor A (high/low).
4, 5- IN1, IN2: pins control Motor A direction of rotation (one is high and the other is low).
6-ENB: Motor enable for Motor B (high/low).
7, 8- IN3, IN4: These pins define Motor B direction of rotation (one is high and the other is
low).
The following figures show the exact connection with Arduino.
It is obvious that the first connection is when connecting two motors with the driver and this
happened in the second car (RC car).
Figure 2-19 second car motors connection
While the first car connection is using only one motor and connecting it with the driver as
shown in the following connection.
28
Figure 2-20 first car motor connection
2.5.2 Servo motor
Unlike dc motors, with servo motors you can position the motor shaft at a specific position
(angle) using control signal. The motor shaft will hold at this position as long as the control
signal not changed. This is very useful for controlling robot arms, unmanned airplanes
control surface or any object that you want it to move at certain angle and stay at its new
position. Servo motors may be classified according to size or torque that it can withstand into
mini, standard and giant servos. Usually mini and standard size servo motors can be powered
by Arduino directly with no need to external power supply or driver. Usually servo motors
come with arms (metals or plastic) that are connected to the object required to move. In our
project we used a TowerPro MG995 servo motor and in the following lines we will show its
features in brief.
2.5.2.1 Servo motor features
 Model: TowerPro MG995 Metal Servo.
 Dimensions: :4.07*1.97*4.29cm.
 Speed: 0.2sec/60° (4.8V).
 Torque: 10kg-cm.
 Rated Voltage: 4.8-7.2V.
29
2.5.2.2 Servo Motor mechanism
Servo motor has 3 wires:
 Black wire: GND (ground).
 RED wire: +5v.
 Colored wire: control signal.
The third pin (colored wire) accepts the control signal which is a pulse-width modulation
(PWM) signal which can be easily produced by all micro- controllers and Arduino board. It
accepts the signal from your controller that tells it the turn angle. The control signal is fairly
simple compared to that of a stepper motor. It is just a pulse of varying lengths. The length of
the pulse corresponds to the angle by which the motor turns to.
Figure 2-21 servo motor mechanism
30
2.5.2.3 Inside Servo Motor
Did you ever wonder how the servo motors looks from inside? Have a look at figure 2-22
and figure 2-23. A servo motor was taken apart to show the internal parts. You can see a
regular dc motor connected to a gear box and a potentiometer that gives the feedback for
angle position. This is represented by the diagram below.
Figure 2-22 inside servo motor diagram
31
Figure 2-23 inside servo motor real shot
2.5.2.4 Servo Motor with Arduino
Standard servo motor control using Arduino is extremely easy. This is because the Arduino
software comes with a sample servo sketch and servo Library that will get you up and
running quickly.
 Connect the black wire from the servo to the GND pin on Arduino.
 Connect the red wire from servo to the +5V pin on Arduino.
 Connect the third wire (usually orange or yellow) from the servo to a digital
pin on Arduino.
32
Figure 2-24 Connection of servo motor with Arduino
33
Microcontroller and Hardware
Chapter 3
34
3.1 Micro Controllers
A Microcontroller (sometimes abbreviated µC, or MCU) is a small computer on a single
integrated circuit containing a processor core, memory, and programmable input/output
peripherals. Program memory in the form of NOR flash or OTP ROM is also often included
on chip, as well as a typically small amount of RAM. Microcontrollers are designed for
embedded applications, in contrast to the microprocessors used in personal computers or
other general purpose applications.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded systems. By reducing the size
and cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components
needed to control non-digital electronic systems.
Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as
4 kHz, for low power consumption (single-digit mille watts or microwatts). They will
generally have the ability to retain functionality while waiting for an event such as a button
press or other interrupt, power consumption while sleeping (CPU clock and most peripherals
off) may be just Nano watts, making many of them well suited for long lasting battery
applications. Other microcontrollers may serve performance-critical roles, where they may
need to act more like a digital signal processor (DSP), with higher clock speeds and power
consumption.
3.1.1 Arduino
3.1.1.1 Introduction
1. What is Arduino?
Arduino is a tool for making computers that can sense and control more of the
physical world than your desktop computer. It’s an open-source physical computing
platform based on a simple microcontroller board, and a development environment
for writing software for the board. Arduino can be used to develop interactive objects,
taking inputs from a variety of switches or sensors, and controlling a variety of lights,
motors, and other physical outputs. Arduino projects can be stand-alone, or they can
be communicate with software running on your computer (e.g. Flash, Processing,
MaxMSP.) The Arduino programming language is an implementation of Wiring, a
similar physical computing platform, which is based on the Processing multimedia
programming environment.
2. Why Arduino?
There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's
35
Handy board, and many others offer similar functionality. All of these tools take the
messy details of microcontroller programming and +wrap it up in an easy-to-use
package.
Arduino also simplifies the process of working with microcontrollers, but it offers
some advantage for teachers, students, and interested amateurs over other systems:
• Inexpensive
Arduino boards are relatively inexpensive compared to other microcontroller
platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled Arduino modules cost less
than $50
• Cross-platform
The Arduino software runs on Windows, Macintosh OSX, and Linux operating
systems. Most microcontroller systems are limited to Windows.
• Simple, clear programming environment
The Arduino programming environment is easy-to-use for beginners, yet
flexible enough for advanced users to take advantage of as well. For teachers,
it's conveniently based on the Processing programming environment, so
students learning to program in that environment will be familiar with the look
and feel of Arduino
• Open source and extensible software
The Arduino software is published as open source tools, available for
extension by experienced programmers. The language can be expanded
through C++ libraries, and people wanting to understand the technical details
can make the leap from Arduino to the AVR C programming language on
which it's based. Similarly, you can add AVR-C code directly into your
Arduino programs if you want to.
• Open source and extensible hardware
The Arduino is based on Atmel's ATMEGA8 and ATMEGA168
microcontrollers. The plans for the modules are published under a Creative
Commons license, so experienced circuit designers can make their own
version of the module, extending it and improving it. Even relatively
inexperienced users can build the breadboard version of the module in order to
understand how it works and save money.
36
3. Types of Arduino
There are different types of Arduino to choose from.
3.1.1.2 Arduino mega
Figure 3-2 Arduino mega
1. Overview
The Arduino Mega 2560 is a microcontroller board based on the ATmega2560 It has
54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog
inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with a AC-to-DC adapter or battery to get started. The Mega is
compatible with most shields designed for the Arduino Duemilanove or Diecimila.
2. Power
The Arduino Mega can be powered via the USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wallwart) or battery. The adapter can be
connected by plugging a 2.1mm centerpositive plug into the board’s power jack.
Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER
connector. The board can operate on an external supply of 6 to 20 volts. If supplied
Figure 3-1 Arduino types
37
with less than 7V, however, the 5V pin may supply less than five volts and the board
may be unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts. The power pins are as
follows:
1. VIN.
The input voltage to the Arduino board when it’s using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source).
You can supply voltage through this pin, or, if supplying voltage via the power
jack, access it through this pin.
2. 5V.
This pin outputs a regulated 5V from the regulator on the board. The board can
be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the
5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t
advise it.
3. 3V3.
A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA.
4. GND. Ground pins.
3. Memory
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is
used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read
and written with the EEPROM library).
4. Input and Output
Each of the 54 digital pins on the Mega can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions:
1. Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX)
and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX)
TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the
ATmega16U2 USB-to-TTL Serial chip.
2. External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19
(interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to
trigger an interrupt on a low value, a rising or falling edge, or a change in value. See
the attachInterrupt() function for details.
38
3. PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analog-
Write() function.
4. SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI
communication using the SPI library. The SPI pins are also broken out on the ICSP
header, which is physically compatible with the Uno, Duemilanove and Diecimila.
5. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it’s off.
6. TWI: 20 (SDA) and 21 (SCL). Support TWI communication using theWire
library. Note that these pins are not in the same location as the TWI pins on the
Duemilanove or Diecimila. The Mega2560 has 16 analog inputs, each of which
provide 10 bits of resolution (i.e. 1024 different values). By default they measure
from ground to 5 volts, though is it possible to change the upper end of their range
using the AREF pin and analogReference() function. There are a couple of other pins
on the board:
1. AREF. Reference voltage for the analog inputs. Used with analogReference().
2. Reset. Bring this line LOW to reset the microcontroller. Typically used to add
a reset button to shields which block the one on the board.
5. Communication
The Arduino Mega2560 has a number of facilities for communicating with a
computer, another Arduino, or other microcontrollers. The AT mega 2560 provides
four hardware UARTs for TTL (5V) serial communication. An ATmega16U2 (AT
mega 8U2 on the revision 1 and revision 2 boards) on the board channels one of these
over USB and provides a virtual com port to software on the computer (Windows
machines will need a .inf file, but OSX and Linux machines will recognize the board
as a COM port automatically. The Arduino software includes a serial monitor which
allows simple textual data to be sent to and from the board. The RX and TX LEDs on
the board will flash when data is being transmitted via the
ATmega8U2/ATmega16U2 chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A Software Serial library allows for serial
communication on any of the Mega2560’s digital pins. The ATmega2560 also
supports TWI and SPI communication. The Arduino software includes a Wire library
to simplify use of the TWI bus; see the documentation for details. For SPI
communication, use the SPI library
6. Programming
The Arduino Mega can be programmed with the Arduino software (download). The
ATmega2560 on the Arduino Mega comes preburned with a bootloader that allows
39
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files).
7. Automatic (Software) Reset
Rather then requiring a physical press of the reset button before an upload, the
Arduino Mega2560 is designed in a way that allows it to be reset by software running
on a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2 is connected to the reset line of the ATmega2560 via a 100 nano-farad
capacitor. When this line is asserted (taken low), the reset line drops long enough to
reset the chip. The Arduino software uses this capability to allow you to upload code
by simply pressing the upload button in the Arduino environment. This means that the
bootloader can have a shorter timeout, as the lowering of DTR can be well-
coordinated with the start of the upload.
3.1.2 Raspberry Pi
3.1.2.1 Design
The Raspberry Pi is a single-board computer developed in the UK by the Raspberry
Pi. The Raspberry Pi is a credit-card sized computer that plugs into your TV and a
keyboard. It’s a capable little PC which can be used for many of the things that your
desktop PC does, like spreadsheets, word-processing and games.
The design is based around a Broadcom BCM2835 SoC, which includes an
ARM1176JZF-S 700 MHz processor and 512 Megabytes of RAM.
The design does not include a built-in hard disk or solid-state drive, instead relying on
an SD card for booting and long-term storage. This board is intended to run Linux
kernel based operating systems.
3.1.2.2 ARM1176 PROSESSOR
The ARM1176™ applications processors deployed broadly in
devices ranging
from smart phones to digital TV's delivering media and
browser performance, a secure computing environment, and
performance up to 1GHz in low cost designs.
The ARM1176 is still actively being licensed for application
processor and baseband processor designs due to its maturity,
low level of implementation risk, and low implementation cost
Figure 3-3 Rpi memory management
40
3.1.2.3 Features
• Low risk and fast time to market
• High performance in low-cost designs
• Physically addressed caches for multi-tasking performance
• Broad OS support, multiple Linux distributions, amazing ARM ecosystem
• Full Internet experience
• Low Power Leadership
• 93% of flops are clock gated
3.1.2.4 Performance
The ARM1176 processor performance reaches up to 1GHz and beyond in 40G, and
can reach 1GHz in 65nm with overdrive voltages.
3.1.2.5 Functions supported in hardware
• Multiplication, addition, and multiply-accumulate ( various variants)
• Division and square root operation (multi-cycle, not pipelined)
• Comparisons and format conversions
• Operations can be performed on short vectors (From assembler only)
• Separate pipelines allow load/store and MAC operations to occur
simultaneously with divide/square root unit operation
• Clock gated and/or power completely removed
41
3.1.2.6 Comparison
42
3.2 Hardware
3.2.1 Ultrasonic sensor
3.2.1.1 Introduction
Distance measurement sensor is a low cost full functionality solution for distance
measurement applications. The module is based on the measurement of time flight of
ultrasonic pulse, which is reflected by an object. The distance to be measured mainly
depends on the speed of ultrasonic waves in space or air –which is a constant and the
flight time of the pulse. The module performs these calculations and outputs a pulse
width depends on the measured distance, this pulse is easily interfaced to any
microcontroller.
Figure 3-4 ultrasonic sensor
3.2.1.2 Features
• Supply voltage +5Vdc
• Supply Current 10mA
• Measurement distance Range from 2cm to 400cm.
• Input trigger pulse is 5V TTL compatible (5 μs minimum). Output echo
pulse is 5V TTL compatible. Size 44.5mm W x 20mm H x 15mm D.
• Interface connector 4-pin header SIP, 0.1” spacing.
• Operating temperature range 0° - 70° C.
43
3.2.1.3 Connection with Arduino
Figure 3-5 ultrasonic sensor connection with Arduino
3.2.1.4 Connection with Raspberry pi
Figure 3-6 ultrasonic sensor connection with Rpi
44
3.2.2 Infrared line tracking sensor
3.2.2.1 Introduction
Line tracking is the most basic function of smart mobile robot. This new generation of
line tracking sensors is developed to be the robot's powerful copilot all the way. It
will guide it robot by telling white from black quickly and accurately, via TTL signal.
With a drawn path and good programming can ensure results that are far more
consistent than if the robot was simply told where to go without any reference.
Figure 3-7 infrared sensor
3.2.2.2 Theory of operation
It consists two parts
1) IR emitting LED
2) IR sensitive phototransistor.
The IR Reflectance sensors work best when they are close to the surface of the
ground. It should be about 1/8" above the ground. This is an optimal distance for the
IR transmitter to illuminate the surface below and measure the reflected light.
It works by transmitting a beam of IR light downward toward the surface. If the
detector is over a white surface, the reflected light is received by the detector and
outputs a HIGH signal. When the sensor is over a black surface where the light is
absorbed or not reflected, the IR detector outputs a LOW signal. The IR Sensor
module provides a value inversely dependent to the amount of reflected IR light.
So it can output digital signal to a microcontroller so the robot can reliably follow a
black line on a white background, or vice versa
45
3.2.2.3 Features and Pins
 Small size.
 5V DC power supply.
 Indicator LED.
 Digital output.
 Distance: up to 3 cm
 Size: 3.5 x 1cm
 Applicable to a variety of platforms including Arduino / AVR / ARM /PIC
** Pin Definition
 GND: Ground
 OUT: Output (HIGH when line is black and LOW when line is white)
 VCC: 3.3-5 VDC
Figure 3-8 infrared sensor pins
46
3.2.2.4 Arduino connection
Figure 3-9 1R sensor connection with Arduino
3.2.3 Optical encoder
Figure 3-10 optical encoder
3.2.3.1 Introduction
The encoder kit consists of two 8-pole magnets with rubber hubs and two hall-
effect sensors terminated with 150mm (6 inch) cable and 3 pin female servo
headers.
The magnets have 4 north poles and 4 south poles and are strong enough that the
sensor can detect the poles from more than 3mm (1/8inch). This means that the
sensors do not need to be precisely mounted to detect the poles. The rubber hubs will
press fit over most small motor and drive shafts used in low power gearboxes. A
small screw may also be used to attach the magnets in some cases.
47
The hall-effect sensors will work on voltages from 3V to 24V and include reverse polarity
protection. It can work with any Arduino compatible controller and use the processors internal
pullup resistors eliminating the need for any external components or wiring
3.2.3.2 Specifications
• Supply voltage: 3V-24V
• Supply current: 4mA per sensor
• Output voltage: 26V maximum
• Output current: 25mA continuous
• Output type: Open drain
48
Adaptive Cruise Control
Chapter 4
49
4.1 Definitions
Adaptive Cruise Control (ACC): An enhancement to a conventional cruise control system
which allows the ACC vehicle to follow a forward vehicle at an appropriate distance.
4.2 Introduction
A big issue on busy roads is traffic jams. There are campaigns that ask people not to travel
during peak hours and to travel together in one car, but they don’t have the desired effect.
This raises the demand for a technical solution. If the amount of cars can’t be reduced, the
vehicle throughput of the road must be increased to solve the traffic jams. This can be done
by reducing the inter-vehicle distance, but this will immediately lead to unsafe situations
caused by the slow response time of human beings. To overcome this slow response time, a
technical solution can be introduced, which controls the throttle and brake of the car. An
implementation of such a system which is used more and more these days, is ACC.
The goal of such a system is to keep a constant distance to its predecessor, or to keep a
constant speed if the constant distance could only be achieved if the maximum speed must be
exceeded. Using this technique, it is possible to create a vehicle string with all cars driving
safely in the platoon while being comfortable for the passenger in the car
An ‘Adaptive Cruise Control’ (ACC) system developed as the next generation assisted the
driver to keep a safe distance from the vehicle in front. This system is now available only in
some luxury cars like Mercedes S-class, Jaguar and Volvo trucks the U.S. Department of
transportation and Japan’s ACAHSR have started developing ‘Intelligent Vehicles’ that can
communicate with each other with the help of a system called ‘Cooperative Adaptive Cruise
Control’
50
4.3 Application
4.3.1 Theory of operation
Adaptive Cruise Control (ACC) is an advancement of cruise control system. It’s an
automotive feature allows the vehicle to adopt set vehicle's speed to the traffic environment.
A sensor system is attached to the front of the vehicle which is used to detect former slow
moving vehicles are in the ACC vehicle's path. If a foregoing slow moving vehicle detected
by the sensor system in the ACC vehicle’s path, then the ACC system will automatically
slows its speed to maintain a safe distance.
If the system detects that the ahead vehicle gets higher speed than ACC vehicle cruise speed
or no longer in the ACC vehicle's path, then automatically ACC system will stimulate back
the vehicle speed to its pre-set cruise control speed.
This action of control system allows the ACC vehicle to self-governing slow down and
speeds up with traffic without arbitration from the driver
Figure 4-1 Adaptive cruise control in real cars
4.3.2 Sensor options
currently four means of object detection are technically feasible and applicable in a vehicle
environment .They are
1. RADAR
2. LIDAR
3. Vision sensor
4. ULTRASONIC SENSOR
The first ACC system used LIDAR sensor.
51
4.3.2.1 LIDAR (Light Detection and Ranging)
The first ACC system introduced by Toyota used this method. By measuring the beat
frequency difference between a Frequency Modulated Continuous light Wave (FMCW) and
its reflection
Figure 4-2 operation of LIDAR
Most of the current ACC systems are based on 77GHz RADAR sensors.
The RADAR systems have the great advantage that the relative velocity can be measured
directly, and the performance is not affected by heavy rain and fog. LIDAR system is of low
cost and provides good angular resolution although these weather conditions restrict its use
within a 30 to 40 meters range.
4.3.2.2 RADAR (Radio Detection and Ranging)
RADAR is an electromagnetic system for the detection and location of reflecting objects like
air crafts, ships, space crafts or vehicles. It is operated by radiating energy into space and
detecting the echo signal reflected from an object (target) the reflected energy is not only
indicative of the presence but on comparison with the transmitted signal, other information of
the target can be obtained. The currently used ‘Pulse Doppler RADAR’ uses the principle of
‘Doppler effect’ in determining the velocity of the target
4.3.2.3 Fusion sensor
The new sensor system introduced by Fujitsu Ten Ltd. and Honda through their PATH
program includes millimeter wave radar linked to a 640x480 pixel stereo camera with a 40
degree viewing angle. These two parts work together to track the car from the non-moving
objects. While RADAR target is the car’s rear bumper, the stereo camera is constantly
52
captures all objects in its field of view
Figure 4-3 operation of fusion sensor
The image processor measures the distances to the objects through triangulation method.
This method includes an algorithm based on the detection of the vertical edges and distance.
Incorporating both the 16-degree field of view of radar and 40-degree field of view of camera
enhances the performance in tight curves
4.3.2.4 Ultrasonic sensor
Depend on measuring distance between our car and front car by sending and receiving
ultrasonic waves and measure time taken by wave between sending and receiving
according to distance car takes action to speed up or slow down
Figure 4-4 operation of ultrasonic sensor
53
Ultrasonic sensors are capable of detecting most objects — metal or nonmetal, clear or
opaque, liquid, solid, or granular — that have sufficient acoustic reflectivity. Another
advantage of ultrasonic sensors is that they are less affected by condensing moisture than
photoelectric sensors.
A downside to ultrasonic sensors is that sound absorbing materials, such as cloth, soft rubber,
flour and foam, make poor target objects.
In our project we used Ultrasonic sensor because it is the most suitable sensor according to
size, cost and availability
4.4 Algorithm
First a safe distance is set this is the distance our car wants to keep with the front vehicles
(the reference).
Second cruise speed is set this is the speed the car will maintain at free driving.
Figure 4-5 feedback control system
Figure 4-6 PID theory
54
Controller here is Arduino microcontroller its function is to take values of distance read by
sensor and control speed and distance according to values set
When the car start and the function is activated it starts to take readings from ultrasonic
sensor and act according to these readings
we here have two cases:
1) If distance is bigger than safe distance
This means that the car can move freely with the cruise speed as there is no car in its way
speed is controlled by speed PID in order to make car maintain this speed while cruising
2) If distance is less than safe distance
This mean that the car will slow down to maintain safe distance
how much the car will slow down is controlled by PID
3) If distance is less than critical distance then the car will stop
4.5 Implementation and testing
4.5.1 Steps
The hardware used to implement this function is the DC motor and ultrasonic sensor
the steps we made was:
1) Testing accuracy of the sensor we have and writing code to calculate the distance that it
sees
2) Connecting DC motor , we started first with a simple code to move car and test different
speeds to see how the car responds
3) Then we made our code using fuzzy control so that for every range of distance the car will
move with a certain speed
4) After that we started adding a controller to our system as shown in flow chart
5) we started reading about different controllers then decided to use PID for our system
6) Then we started tuning parameters to reach the ones suitable for us after that testing its
response
7) Since our system has no model and considered a black box tuning need to be done
experimentally
8) There is different tuning methods in our system we used two methods
Distance speed PID we used trial and error method
Speed PID we used Ziegler-Nicholas
9) Then testing response
55
4.6 Designing a control system
4.6.1 Design in real systems
To design any control system:
1) Choose design specification needed
2) Set a mathematical model for system
3) Then tune parameter and check performance of system, if the system specification reached
then the parameters are the right ones but if specifications not reached then retune parameters
4.6.2 Design in our system
1) We didn’t set any specification because what was important for us is speed of response
2) Our system doesn’t have a model so we consider it a black box
3) We will tune parameters by method that doesn’t need transfer function
4) Before tuning we need to choose the type of controller that we will use
4.6.3 Controllers
Before introducing various controllers, it is very important to know why we use controllers
and why they are important.
1. Controllers improve steady state accuracy by decreasing the steady state errors.
2. As the steady state accuracy improves, the stability also improves.
3. Help in reducing the offsets produced in the system.
4. Maximum overshoot of the system can be controlled using these controllers.
5. They also help in reducing the noise signals produced in the system.
6. Slow response of the over damped system can be made faster with the help of these
controllers.
4.6.3.1 P Controller
P controller is mostly used in first order processes with single energy storage to stabilize the
unstable process. The main usage of the P controller is to decrease the steady state error of
the system. As the proportional gain factor K increases, the steady state error of the system
decreases. However, despite the reduction, P control can never manage to eliminate the
steady state error of the system. As we increase the proportional gain, it provides smaller
amplitude and phase margin and larger sensitivity to the noise. We can use this controller
only when our system is tolerable to a constant steady state error. In addition, it can be easily
concluded that applying P controller decreases the rise time and after a certain value of
reduction on the steady state error, increasing K only leads to overshoot of the system
response.
Mathematical equation:
56
Advantages
1. Proportional controller helps in reducing the steady state error, thus makes the system
more stable.
2. Slow response of the over damped system can be made faster with the help of these
controllers.
Disadvantages
1. Due to presence of these controllers there are some offsets in the system.
2. Proportional controllers also increase the maximum overshoot of the system.
4.6.3.2 PI controller
P-I controller is mainly used to eliminate the steady state error resulting from P controller.
However, in terms of the speed of the response and overall stability of the system, it has a
negative impact. This controller is mostly used in areas where speed of the system is not an
issue.
Mathematical equation:
Removing the sign of proportionality we have,
Advantages
PI controller fuses the properties of the P and I controllers. It shows a maximum overshoot
and settling time similar to the P controller but no steady-state error.
Disadvantages
Since P-I controller has no ability to predict the future errors of the system it cannot decrease
the rise time and eliminate the oscillations.
57
4.6.3.3 P-D Controller
The aim of using P-D controller is to increase the stability of the system by improving
control since it has an ability to predict the future error of the system response. In order to
avoid effects of the sudden change in the value of the error signal, the derivative is taken
from the output response of the system variable instead of the error signal. Therefore, D
mode is designed to be proportional to the change of the output variable to prevent the
sudden changes occurring in the control output resulting from sudden changes in the error
signal. In addition D directly amplifies process noise therefore D-only control is not used.
Mathematical equation:
Removing the sign of proportionality we have,
Advantages
Smaller maximum overshoot due to the 'faster' D action compared with other controller
types.
A steady-state error is visible, which is smaller than in the case of the P controller. This is
because the PD controller generally is tuned to have a larger gain Kc due to the positive
phase shift of the D action.
4.6.3.4 P-I-D Controller
P-I-D controller has the optimum control dynamics including zero steady state error, fast
response (short rise time), no oscillations and higher stability. The necessity of using a
derivative gain component in addition to the PI controller is to eliminate the overshoot and
the oscillations occurring in the output response of the system.
Mathematical equation:
Advantages
1-One of the main advantages of the P-I-D controller is that it can be used with higher order
processes including more than single energy storage.
58
2- Zero steady state error.
The advantage of PID controller is its feasibility and easy to be implemented. The PID
gains can be designed based upon the system parameters if they can be achieved or estimated
precisely. Moreover, the PID gain can be designed just based on the system tracking error
and treats the system to be "black box" if the system parameters are unknown. However, PID
controller generally has to balance all three-gain impact to the whole system and may
compromise the transient response, such as settling time, overshoots, and oscillations. If the
system parameters cannot be precisely estimated or achieved, the designed PID gains may
not resist the uncertainties and disturbances, and thus present low robustness. Even though
the PID gains can be well-designed, the PID controller still has low robust ability compared
with the robust controller when the system encounters to multiple challenges from the
operating environment of the system, such as temperature, weather, power surge, and so on.
-PID is widely used in automotive and in general applications and has several sources.
So we decided to use PID controller.
The PID controller has three tunable parameters, whose sum constitutes the adjustable
variable (AV). The summation of proportional, integral, and derivative terms gives the output
of the PID controller. Defining u(t) as the controller output, the final form of the PID design
Where,
Kp: Proportional gain, a tuning parameter
Ki : Integral gain, a tuning parameter
Kd: Derivative gain, a tuning parameter
E : Error = SP- PV
T : Time or instantaneous time
S : set point
C.S : control signal
O : Output
The basic idea behind a PID controller is to read a sensor, then compute the desired actuator
output by calculating proportional, integral, and derivative responses and summing those
three components to compute the output. First we need to know what a closed loop system is
and some of the terminologies associated with it.
59
PID Theory
Figure 4-6 PID block diagram
Proportional Response
The proportional component depends only on the difference between the set point and the
process variable. This difference is referred to as the Error term. The proportional gain (Kc)
determines the ratio of output response to the error signal. For instance, if the error term has a
magnitude of 10,
a proportional gain of 5 would produce a proportional response of 50. In general, increasing
the proportional gain will increase the speed of the control system response. However, if the
proportional gain is too large, the process variable will begin to oscillate. If Kc is increased
further, the oscillations will become larger and the system will become unstable and may
even oscillate out of control.
Integral Response
The integral component sums the error term over time. The result is that even a small error
term will cause the integral component to increase slowly. The integral response will
continually increase over time unless the error is zero, so the effect is to drive the Steady-
State error to zero. Steady-State error is the final difference between the process variable and
set point. A phenomenon called integral windup results when integral action saturates a
controller without the controller driving the error signal toward zero.
Derivative Response
The derivative component causes the output to decrease if the process variable is increasing
rapidly. The derivative response is proportional to the rate of change of the process variable.
Increasing the derivative time (Td) parameter will cause the control system to react more
strongly to changes in the error term and will increase the speed of the overall control system
response. Most practical control systems use very small derivative time (Td), because the
Derivative Response is highly sensitive to noise in the process variable signal. If the sensor
feedback signal is noisy or if the control loop rate is too slow, the derivative response can
make the control system unstable
60
4.6.4 Definition of Terminologies
The control design process begins by defining the performance requirements. Control system
performance is often measured by applying a step function as the set point command
variable, and then measuring the response of the process variable. Commonly, the response is
quantified by measuring defined waveform characteristics such as:
-Rise Time is the amount of time the system takes to go from 10% to 90% of the steady-
state, or final, value.
-Percent Overshoot is the amount that the process variable overshoots the final value,
expressed as a percentage of the final value.
-Settling time is the time required for the process variable to settle to within a certain
percentage (commonly 5%) of the final value.
-Steady-State Error is the final difference between the process variable and set point.
Note that the exact definition of these quantities will vary in industry and academia.
Figure 4-7 graph showing PID definition of terminologies
After using one or all of these quantities to define the performance requirements for a control
system, it is useful to define the worst case conditions in which the control system will be
expected to meet these design requirements. Often times, there is a disturbance in the system
that affects the process variable or the measurement of the process variable.
In some cases, the response of the system to a given control output may change over time or
in relation to some variable. A nonlinear system is a system in which the control parameters
that produce a desired response at one operating point might not produce a satisfactory
response at another operating point. For instance, a chamber partially filled with fluid will
exhibit a much faster response to heater output when nearly empty than it will when nearly
full of fluid. The measure of how well the control system will tolerate disturbances and
61
nonlinearities is referred to as the robustness of the control system.
Some systems exhibit an undesirable behavior called dead time. Dead time is a delay
between when a process variable changes, and when that change can be observed. For
instance, if a temperature sensor is placed far away from a cold water fluid inlet valve, it will
not measure a change in temperature immediately if the valve is opened or closed. Dead time
can also be caused by a system or output actuator that is slow to respond to the control
command, for instance, a valve that is slow to open or close.
Loop cycle is also an important parameter of a closed loop system. The interval of time
between calls to a control algorithm is the loop cycle time. Systems that change quickly or
have complex behavior require faster control loop rates.
Figure 4-8 graph showing dead time
4.6.5 Distance speed PID
When distance detected by sensor is less than the desired safe distance the car will slow
down but by what value …, this is why PID is used to control speed of car according to
distance
PID has a set point which is X , an input which is reading from ultrasonic , tuning parameters
Kp Ki Kd , and an output which is the speed of car
when distance decrease the speed decrease by a certain amount if this amount is not enough
to reach the safe desired distance the speed will decrease again and will increase if distance
detected increase
there is a limit of speeds set for the PID to have as an output
for example: if the cruise speed is Y
then the limits for PID output will be from 0 to a value less than Y
62
Trial and error method Tuning method
Trial and Error Method: It is a simple method of PID controller tuning. While system or
controller is working, we can tune the controller. In this method, first we have to set Ki and
Kd values to zero and increase proportional term (Kp) until system reaches to oscillating
behavior. Once it is oscillating, adjust Ki (Integral term) so that oscillations stops and finally
adjust D to get fast response.
By following the previous steps using Arduino codes and Matlab to graph the performance of
the dc motor, we obtained the values of kp, ki and kd
kp=4, ki=0.02 and kd=0.01
4.6.6 Speed PID
Theory of DC motor speed control
The speed of a DC motor is directly proportional to the supply voltage, so if we reduce the
supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be
achieved when the battery is fixed at 12 Volts?
The speed controller works by varying the average voltage sent to the motor. It could do this
by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A better
way is to switch the motor's supply on and off very quickly. If the switching is fast enough,
the motor doesn't notice it, it only notices the average effect.
When you watch a film in the cinema, or the television, what you are actually seeing is a
series of fixed pictures, which change rapidly enough that your eyes just see the average
effect - movement. Your brain fills in the gaps to give an average effect.
Now imagine a light bulb with a switch. When you close the switch, the bulb goes on and is
at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts). Now if you
close the switch for a fraction of a second, then open it for the same amount of time, the
filament won't have time to cool down and heat up, and you will just get an average glow of
50 Watts. This is how lamp dimmers work, and the same principle is used by speed
controllers to drive a motor. When the switch is closed, the motor sees 12 Volts, and when it
is open it sees 0 Volts. If the switch is open for the same amount of time as it is closed, the
motor will see an average of 6 Volts, and will run more slowly accordingly.
As the amount of time that the voltage is on increases compared with the amount of time that
it is off, the average speed of the motor increases.
This on-off switching is performed by power MOSFETs. A MOSFET (Metal-Oxide-
Semiconductor Field Effect Transistor) is a device that can turn very large currents on and
off under the control of a low signal level voltage.
The time that it takes a motor to speed up and slow down under switching conditions is
dependent on the inertia of the rotor (basically how heavy it is), and how much friction and
63
load torque there is. The graph below shows the speed of a motor that is being turned on and
off fairly slowly.
Figure 4-9 On and off switching method of motor
You can see that the average speed is around 150, although it varies quite a bit. If the supply
voltage is switched fast enough, it won’t have time to change speed much, and the speed will
be quite steady. This is the principle of switch mode speed control. Thus the speed is set by
PWM – Pulse Width Modulation.
Ziegler Nicholas tuning method
Ziegler–Nichols Rules for Tuning PID Controllers. Ziegler and Nichols proposed rules for
determining values of the proportional gain integral time and derivative time based on the
transient response characteristics of a given plant. Such determination of the parameters of
PID controllers or tuning of PID controllers can be made by engineers on-site by experiments
on the plant. There are two methods called Ziegler–Nichols tuning rules: the first method and
the second method
First Method
In the first method, we obtain experimentally the response of the plant to a unit-step input, as
shown in Figure 4-10 .If the plant involves neither integrator(s) nor dominant complex-
conjugate poles, then such a unit-step response curve may look S-shaped, as shown in Figure
4-11 .This method applies if the response to a step input exhibits an S-shaped curve. Such
step-response curves may be generated experimentally or from a dynamic simulation of the
plant. The S-shaped curve may be characterized by two constants, delay time L and time
constant T. The delay time and time constant are determined by drawing a tangent line at the
inflection point of the S-shaped curve and determining the intersections of the tangent line
with the time axis and line c(t)=K, as shown in Figure 4-11
Figure 4-10 Unit-step response of a plant.
64
Figure 4-11 S-shaped response curve.
The transfer function C(s)/U(s) may then be approximated by a first-order system with a
transport lag as follows:
Ziegler and Nichols suggested to set the values of and according to the formula
The PID controller tuned by the first method of Ziegler–Nichols rules gives:
Thus, the PID controller has a pole at the origin and double zeros at s=–1/L.
Second Method. In the second method, we first set and Using the proportional control
action only see Figure 4-12 increase Kp from 0 to a critical value Kcr at which the output
first exhibits sustained oscillations.(If the output does not exhibit sustained oscillations
for whatever value Kp may take, then this method does not apply.)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)
Final graduadtion book( autonomous car)

More Related Content

What's hot

ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINOACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
Snehasis Mondal
 

What's hot (20)

Seminar on uav
Seminar on uavSeminar on uav
Seminar on uav
 
Autonomous car
Autonomous carAutonomous car
Autonomous car
 
Self-driving cars are here
Self-driving cars are hereSelf-driving cars are here
Self-driving cars are here
 
Cruise control & Adaptive Cruise Control
Cruise control & Adaptive Cruise ControlCruise control & Adaptive Cruise Control
Cruise control & Adaptive Cruise Control
 
Autonomous car Working (Deep learning)
Autonomous car Working (Deep learning)Autonomous car Working (Deep learning)
Autonomous car Working (Deep learning)
 
ANTI COLLISION SYSTEM IN CARS
ANTI COLLISION SYSTEM IN CARSANTI COLLISION SYSTEM IN CARS
ANTI COLLISION SYSTEM IN CARS
 
Vehicle To Vehicle Communication System
Vehicle To Vehicle Communication SystemVehicle To Vehicle Communication System
Vehicle To Vehicle Communication System
 
text book Programmable-Logic-Controllers plc.pdf
text book Programmable-Logic-Controllers plc.pdftext book Programmable-Logic-Controllers plc.pdf
text book Programmable-Logic-Controllers plc.pdf
 
Autonomous vehicle
Autonomous vehicleAutonomous vehicle
Autonomous vehicle
 
Embedded systems in automobiles
Embedded systems in automobilesEmbedded systems in automobiles
Embedded systems in automobiles
 
Hand free driving
Hand free drivingHand free driving
Hand free driving
 
ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINOACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
ACCELEROMETER BASED HAND GESTURE CONTROLLED ROBOT USING ARDUINO
 
Air traffic control
Air traffic controlAir traffic control
Air traffic control
 
Optimal control systems
Optimal control systemsOptimal control systems
Optimal control systems
 
Adaptive cruise control
Adaptive cruise controlAdaptive cruise control
Adaptive cruise control
 
Final Year Project report on quadcopter
Final Year Project report on quadcopter Final Year Project report on quadcopter
Final Year Project report on quadcopter
 
Adaptive Cruise control
Adaptive Cruise controlAdaptive Cruise control
Adaptive Cruise control
 
Autonomous vehicles
Autonomous vehiclesAutonomous vehicles
Autonomous vehicles
 
Project PPT
Project PPTProject PPT
Project PPT
 
Signalling System At railway
Signalling System At railwaySignalling System At railway
Signalling System At railway
 

Viewers also liked

Autonomus cars Article
Autonomus cars ArticleAutonomus cars Article
Autonomus cars Article
Tamanna Rahman
 
Google Driverless (Autonomous) Car
Google Driverless (Autonomous) CarGoogle Driverless (Autonomous) Car
Google Driverless (Autonomous) Car
Farhan Badar
 
Smart parking system
Smart parking systemSmart parking system
Smart parking system
slmnsvn
 
automatic car parking system
automatic car parking systemautomatic car parking system
automatic car parking system
sowmya Sowmya
 

Viewers also liked (16)

Autonomus cars Article
Autonomus cars ArticleAutonomus cars Article
Autonomus cars Article
 
Lane assist
Lane assistLane assist
Lane assist
 
Multi-Function Automatic Move Smart Car for Arduino
Multi-Function Automatic Move Smart Car for ArduinoMulti-Function Automatic Move Smart Car for Arduino
Multi-Function Automatic Move Smart Car for Arduino
 
Google Driverless (Autonomous) Car
Google Driverless (Autonomous) CarGoogle Driverless (Autonomous) Car
Google Driverless (Autonomous) Car
 
automatic car parking investment
automatic car parking investmentautomatic car parking investment
automatic car parking investment
 
Automatic car parking system with and without password report
Automatic car parking system with and without password reportAutomatic car parking system with and without password report
Automatic car parking system with and without password report
 
Smart parking system
Smart parking systemSmart parking system
Smart parking system
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
automatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technologyautomatic plant irrigation using aurdino and gsm technology
automatic plant irrigation using aurdino and gsm technology
 
Ultrasonic automatic braking system in cars by Accelerator Disengagement Mech...
Ultrasonic automatic braking system in cars by Accelerator Disengagement Mech...Ultrasonic automatic braking system in cars by Accelerator Disengagement Mech...
Ultrasonic automatic braking system in cars by Accelerator Disengagement Mech...
 
GOOGLE GLASS
GOOGLE GLASSGOOGLE GLASS
GOOGLE GLASS
 
Himalaya project
Himalaya projectHimalaya project
Himalaya project
 
automatic car parking system
automatic car parking systemautomatic car parking system
automatic car parking system
 
Seminar report on robotics (line follower) ppt
Seminar report on robotics (line follower) pptSeminar report on robotics (line follower) ppt
Seminar report on robotics (line follower) ppt
 
3D PRINTER Seminar fair report (pdf)
3D PRINTER Seminar fair report (pdf)3D PRINTER Seminar fair report (pdf)
3D PRINTER Seminar fair report (pdf)
 
Google glass ppt
Google glass pptGoogle glass ppt
Google glass ppt
 

Similar to Final graduadtion book( autonomous car)

Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)
Priyanka Kapoor
 
Uni v e r si t ei t
Uni v e r si t ei tUni v e r si t ei t
Uni v e r si t ei t
Anandhu Sp
 
Design_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdfDesign_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdf
OJAlazzawi
 
Design_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdfDesign_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdf
OJAlazzawi
 
Team Omni L2 Requirements Revised
Team Omni L2 Requirements RevisedTeam Omni L2 Requirements Revised
Team Omni L2 Requirements Revised
Andrew Daws
 

Similar to Final graduadtion book( autonomous car) (20)

Alinia_MSc_S2016
Alinia_MSc_S2016Alinia_MSc_S2016
Alinia_MSc_S2016
 
Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)
 
Real-time monitoring and delay management of a transport information system
Real-time monitoring and delay management of a transport information systemReal-time monitoring and delay management of a transport information system
Real-time monitoring and delay management of a transport information system
 
Vehicle to Vehicle Communication using Bluetooth and GPS.
Vehicle to Vehicle Communication using Bluetooth and GPS.Vehicle to Vehicle Communication using Bluetooth and GPS.
Vehicle to Vehicle Communication using Bluetooth and GPS.
 
Smart Traffic Management System using Internet of Things (IoT)-btech-cse-04-0...
Smart Traffic Management System using Internet of Things (IoT)-btech-cse-04-0...Smart Traffic Management System using Internet of Things (IoT)-btech-cse-04-0...
Smart Traffic Management System using Internet of Things (IoT)-btech-cse-04-0...
 
Rapid programmering start
Rapid programmering startRapid programmering start
Rapid programmering start
 
Actron CP9690 User Manual
Actron CP9690 User ManualActron CP9690 User Manual
Actron CP9690 User Manual
 
Innovation Trends: Web 2.0
Innovation Trends: Web 2.0Innovation Trends: Web 2.0
Innovation Trends: Web 2.0
 
Uni v e r si t ei t
Uni v e r si t ei tUni v e r si t ei t
Uni v e r si t ei t
 
2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER
 
Daugiau apie so machine programinę įrangą
Daugiau apie so machine programinę įrangąDaugiau apie so machine programinę įrangą
Daugiau apie so machine programinę įrangą
 
Design_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdfDesign_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdf
 
Design_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdfDesign_and_Development_of_Fire_and_Gas_L.pdf
Design_and_Development_of_Fire_and_Gas_L.pdf
 
Team Omni L2 Requirements Revised
Team Omni L2 Requirements RevisedTeam Omni L2 Requirements Revised
Team Omni L2 Requirements Revised
 
JJ_Thesis
JJ_ThesisJJ_Thesis
JJ_Thesis
 
z_remy_spaan
z_remy_spaanz_remy_spaan
z_remy_spaan
 
LPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] ReportLPG Booking System [ bookmylpg.com ] Report
LPG Booking System [ bookmylpg.com ] Report
 
Smart Street System
Smart Street SystemSmart Street System
Smart Street System
 
VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024
 
Thesis_Report
Thesis_ReportThesis_Report
Thesis_Report
 

Recently uploaded

Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
amitlee9823
 
ELECTRICITÉ TMT 55.pdf electrick diagram manitout
ELECTRICITÉ TMT 55.pdf electrick diagram manitoutELECTRICITÉ TMT 55.pdf electrick diagram manitout
ELECTRICITÉ TMT 55.pdf electrick diagram manitout
ssjews46
 
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
amitlee9823
 
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
nirzagarg
 
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
amitlee9823
 
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
amitlee9823
 
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
amitlee9823
 
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
ezgenuh
 
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp NumberVip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
kumarajju5765
 
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
amitlee9823
 
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
ezgenuh
 
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
lizamodels9
 
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men 🔝narsinghpur🔝 ...
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men  🔝narsinghpur🔝  ...➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men  🔝narsinghpur🔝  ...
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men 🔝narsinghpur🔝 ...
nirzagarg
 

Recently uploaded (20)

Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
Top Rated Call Girls Mumbai Central : 9920725232 We offer Beautiful and sexy ...
 
ELECTRICITÉ TMT 55.pdf electrick diagram manitout
ELECTRICITÉ TMT 55.pdf electrick diagram manitoutELECTRICITÉ TMT 55.pdf electrick diagram manitout
ELECTRICITÉ TMT 55.pdf electrick diagram manitout
 
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
Top Rated Call Girls South Mumbai : 9920725232 We offer Beautiful and sexy Ca...
 
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
Rekha Agarkar Escorts Service Kollam ❣️ 7014168258 ❣️ High Cost Unlimited Har...
 
John Deere Tractors 6130M 6140M Diagnostic Manual
John Deere Tractors  6130M 6140M Diagnostic ManualJohn Deere Tractors  6130M 6140M Diagnostic Manual
John Deere Tractors 6130M 6140M Diagnostic Manual
 
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
Sanjay Nagar Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalor...
 
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
Bangalore Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore E...
 
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Mumbai Call On 9920725232 With Body to body massage wit...
 
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Rajajinagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Patel Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
What Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop WorkingWhat Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop Working
 
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
一比一原版(UdeM学位证书)蒙特利尔大学毕业证学历认证怎样办
 
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Bangalore Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
 
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp NumberVip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
 
John deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance ManualJohn deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance Manual
 
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Colaba Call On 9920725232 With Body to body massage wit...
 
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
一比一原版(PU学位证书)普渡大学毕业证学历认证加急办理
 
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
Call Girls In Kotla Mubarakpur Delhi ❤️8448577510 ⊹Best Escorts Service In 24...
 
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men 🔝narsinghpur🔝 ...
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men  🔝narsinghpur🔝  ...➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men  🔝narsinghpur🔝  ...
➥🔝 7737669865 🔝▻ narsinghpur Call-girls in Women Seeking Men 🔝narsinghpur🔝 ...
 

Final graduadtion book( autonomous car)

  • 1. Alexandria University Faculty of Engineering Communication and Electronics Department B. Eng. Final Year Project Sensor based Autonomous car By: Mennatallah Hany Hosny Nancy Mohamed Abdou Nagwan fawzyHassan Nada Ashraf Megahed Nermeen Mohamed Rmdan Nehal Salah El-kony Nourhan Abdelnaser Farrag Supervised by: Dr. Mohammed Morsy Farag
  • 2. I ACKNOWLEDGMENT First and foremost, we thank Allah Almighty who paved path for us, in achieving the desired goal. We would like to express our sincere gratitude to our mentor Dr. Mohammed Morsy Farag for the continuous support of our studies and research, for his patience, motivation, enthusiasm, and immense knowledge. His guidance helped us in all the time for achieving the goals of our graduation project. We could not have imagined having a better advisor and mentor for our graduation project. Our thanks and appreciations also go to our colleagues in developing the project and people who have willingly helped us out with their abilities. Finally, an honorable mention goes to our parents, brothers, sisters and families. Words cannot express how grateful we are. Your prayer for us was what sustained us thus far. Without helps of the particular that mentioned above, we would face many difficulties while doing this.
  • 3. II ABSTRACT Whether you call them self-driving, driverless, automated, or autonomous, these vehicles are on the move. Recent announcements by Google (which drove over 500,000 miles on its original prototype vehicles) and other major automakers indicate the potential for development in this area. Driverless cars are often discussed as “disruptive technology” with the ability to transform transportation infrastructure, expand access, and deliver benefits to a variety of users. Some observers estimate limited availability of driverless cars by 2020 with wide availability to the public by 2040. The following sections describe the development and implementation of an autonomous car model with some features. It provides a history of autonomous cars and describes the entire development process of such cars. The development of our prototype was completed through the use of two controllers; Raspberry pi and Arduino. The main parts of our model include the Raspberry pi, Arduino controller board, motors, Ultrasonic sensors, Infrared sensors, optical encoder, X-bee module, and lithium-ion batteries. It also describes speed control of the car motion by the means of a process known as PID tuning to make correct adjustments to the behavior of the vehicle.
  • 4. III Table of content 1. Introduction………………………………………………........ 1 1.1 History…………………………………………………….... 2 1.2 Why autonomous car is important…………………………. 4 1.2.1 Benefits of self-driving cars………………………….. 4 1.3 What are autonomous and automated vehicles…………….. 5 1.4 Advanced driver assistance system………………………… 7 1.5 Project description …………………………………………. 7 1.5.1 Auto parking………………………………………..… 7 1.5.2 Adaptive cruise control……………………………….. 7 1.5.3 Lane keeping………………………………………….. 8 1.5.4 Lane departure……………………………………….... 8 1.5.5 Indoor positioning system…………………………….. 8 1.5.6 Connected car…………………………………………… 8 1.6 Related work…………………………………………………. 9 2.Car Design……………………………………………… 12 2.1 First car design……………………………………………….. 13 2.1.1 Four WD robot ………………………………………… 13 2.1.1.1 specifications ………………………………….. 13 2.1.1.2 Real shots ……………………………………… 14 2.1.1.3 Drawbacks ……………………………………... 14 2.1.1.4 Overcoming Drawbacks ………………………. 14 2.1.2 Second trial …………………………………………….. 14 2.1.2.1 specifications ………………………………….... 15 2.1.2.2 Real shots ……………………………………….. 16 2.1.2.3 Drawbacks ……………………………………… 17 2.1.2.4 Overcoming Drawbacks …………………………17 2.1.3 Final design ……………………………………………...17 2.1.3.1 Body ……………………………………………...17 2.1.3.2 Side covers ……………………………………….18 2.1.3.3 Front and back covers …………………………….19 2.1.3.4 Cover ………………………………………………20 2.1.3.5 Real shots ………………………………………….20 2.1.3.6 Drawbacks ……………………………………… 20 2.2 Car wheel drive ………………………………………………………21 2.2.1 Types of wheel drive …………………………………………...21 2.2.2 Advantages of this configurations ……………………………...21
  • 5. IV 2.3 Car steering …………………………………………………………….22 2.3.1 Basic geometry …………………………………………………...22 2.3.2 Our mechanism …………………………………………………...22 2.3.3 Servo motor modifications ………………………………………...23 2.4 Second car design ……………………………………………………….24 2.4.1 Final design ……………………………………………………….24 2.4.2 Real shots ………………………………………………………….24 2.5 Motors ……………………………………………………………………24 2.5.1 DC motor ………………………………………………………….25 2.5.1.1 DC motor fundamentals …………………………………..25 2.5.1.2 DC motor principle ……………………………………….25 2.5.1.3 Controlling DC motor …………………………………….26 2.5.2 Servo motor……………………………………………………….. 28 2.5.2.1 Servo motor features ……………………………………….28 2.5.2.2 Servo motor mechanism ……………………………………29 2.5.2.3 Inside Servo motor ………………………………………….30 2.5.2.4 Servo motor with Arduino …………………………………..31 3 Microcontrollers and Hardware ………………………………... 33 3.1 Microcontrollers ………………………………………………………… 34 3.1.1 Arduino ……………………………………………………………. 34 3.1.1.1 Introduction ………………………………………………... 34 3.1.1.2 Arduino Mega ……………………………………………... 36 3.1.2 Raspberry pi ……………………………………………………….. 39 3.1.2.1 Design ……………………………………………………… 39 3.1.2.2 ARM 1176 processor ……………………………………… 39 3.1.2.3 Features …………………………………………………….. 40 3.1.2.4 Performance ………………………………………………… 40 3.1.2.5 Function supported in Hardware ……………………………. 40 3.1.2.6 Comparison ………………………………………………….. 41 3.2 Hardware …………………………………………………………………… 42 3.2.1 Ultrasonic sensor ……………………………………………………. 42 3.2.1.1 Introduction ……………………………………………………42 3.2.1.2 Features ………………………………………………………...42 3.2.1.3 Connection with Arduino ………………………………………43 3.2.1.4 Connection with raspberry pi …………………………………43 3.2.2 Infrared tracking sensor ………………………………………………..44 3.2.2.1 Introduction …………………………………………………….44 3.2.2.2 Theory of operation ……………………………………………44 3.2.2.3 Features and pins ……………………………………………….45
  • 6. V 3.2.2.4 Arduino connection …………………………………………..46 3.2.3 Optical encoder ……………………………………………………….46 3.2.3.1 Introduction …………………………………………………..46 3.2.3.2 Specifications ………………………………………………….47 4 Adaptive cruise control 48 4.1 Definitions………………………………………………………………….. 49 4.2 Introduction ………………………………………………………………….49 4.3 Applications ………………………………………………………………….50 4.3.1 Theory of operations ……………………………………………………50 4.3.2 Sensor options …………………………………………………………..50 4.3.2.1 LIDAR …………………………………………………………..51 4.3.2.2 RADAR ………………………………………………………….51 4.3.2.3 Fusion sensor …………………………………………………….51 4.3.2.4 Ultrasonic sensor ………………………………………………..52 4.4 Algorithm ……………………………………………………………………..53 4.5 Implementation and testing …………………………………………………..54 4.5.1 Steps ……………………………………………………………………..54 4.6 Designing a control system …………………………………………………...55 4.6.1 Design in real systems …………………………………………………..55 4.6.2 Design in our system …………………………………………………….55 4.6.3 Controllers ……………………………………………………………….55 4.6.3.1 P controller ……………………………………………………...55 4.6.3.2 PI Controller ……………………………………………………..56 4.6.3.3 PD Controller …………………………………………………....57 4.6.3.4 PID controller ……………………………………………………57 4.6.4 Definitions of terminologies …………………………………………….60 4.6.5 Distance-speed PID ……………………………………………….61 4.6.6 Speed PID ………………………………………………………….62 4.7 Application in real car …………………………………………………………67 5 Lane keeping …………………………………………………………..68 5.1 Introduction ……………………………………………………………………69 5.2 History …………………………………………………………………………69 5.3 Timeline of available systems …………………………………………………69 5.4 Application in real Car …………………………………………………….......71 5.5 Limitations of Lane keeping system …………………………………………..72 5.6 Prototyping of lane keeping …………………………………………………..72 5.6.1 Basic components ………………………………………………………..72
  • 7. VI 5.6.2 Algorithm ……………………………………………………………….72 5.6.3 Implementation and testing ……………………………………………..73 5.6.4 Limitations of implemented model …………………………………….77 5.7 Conclusion …………………………………………………………………….77 6 Lane departure ………………………………………………………..78 6.1 Definition ………………………………………………………………….......79 6.2 Introduction …………………………………………………………………...80 6.3 Basic components ……………………………………………………………...80 6.4 Implementation ………………………………………………………………..80 6.5 Algorithm ……………………………………………………………………...81 6.5.1 Concept ………………………………………………………………….81 6.5.2 Algorithm ……………………………………………………………….82 6.6 Application in real car …………………………………………………………82 7 Integrating function …………………………………………………...83 7.1 Algorithm ……………………………………………………………………...84 7.2 Implementation ………………………………………………………………..86 8 Auto parking …………………………………………………………87 8.1 Definitions …………………………………………………………………..88 8.2 Introduction ………………………………………………………………….88 8.3 Application …………………………………………………………………..88 8.4 Hardware …………………………………………………………………….89 8.5 Parking types ………………………………………………………………..103 8.6 Parallel parking ………………………………………………………………104 8.6.1 Parallel parking steps …………………………………………………..104 8.6.2 Algorithm ………………………………………………………………107 8.7 Perpendicular parking ………………………………………………………..108 8.7.1 Steps ……………………………………………………………………108 8.7.2 Perpendicular parking Algorithm ………………………………………108 8.8 Tuning methods ………………………………………………………………109 9 Indoor positioning system ………………………………………....110 9.1 Introduction ………………………………………………………………..111 9.2 Indoor positioning Algorithm ……………………………………………..113 9.2.1 Angle of arrival ………………………………………………………113 9.2.2 Time of arrival ……………………………………………………….114 9.2.3 Time difference of arrival ……………………………………………114
  • 8. VII 9.2.4 Received signal strength …………………………………………….115 9.2.4.1 Log distance path loss model ………………………………..116 9.3 Available positioning systems …………………………………………….116 9.3.1 Infrared base system …………………………………………………116 9.3.2 Ultrasound base system ……………………………………………...118 9.3.2.1 Ultrasound system application ………………………………118 9.3.3 Ultra-wide band ……………………………………………………...119 9.3.4 Appling radio frequency based system ………………………………119 9.3.4.1 Indoor positioning system using RFID ……………………… 120 9.3.4.2 Indoor positioning system using ZigBee ……………………. 122 10 Connected Car ……………………………………………………. 124 10.1 Definition ……………………………………………………………….. 125 10.2 Function Description ……………………………………………………. 125 10.3 Implementation tools ……………………………………………………. 126 10.3.1 Arduino Yun ……………………………………………………... 126 10.3.2 Web-cam …………………………………………………………. 126 10.4 Steps of implementation………………………………………………….. 127 10.5 Results ……………………………………………………………………. 128 11 Conclusion …………………………………………………………. 129 12 References ………………………………………………………….. 131
  • 9. VIII List of Figures Figure 1-1 Google car (Page 9) Figure 1-2 Progression of automated vehicle technologies (Page 10) Figure 2-1 Four WD robot (Page 14) Figure 2-2 Four WD real shot (Page 14) Figure 2-3 Second design trial AutoCad design. (Page 15) Figure 2-4 Second car trial real shots. (Page 16) Figure 2-5 Second car trial connection. (Page 17) Figure 2-6 Final car design. (Page 17) Figure 2-7 Final car side covers. (Page 18) Figure 2-8 Final car front and back covers. (Page 19) Figure 2-9 Final car cover. (Page 20) Figure 2-10 Final car real shots. (Page 20) Figure 2-11 Types of wheel drive. (Page 21) Figure 2-12 Final car inside view. (Page 21) Figure 2-13 Final car center of turning circle. (Page 22) Figure 2-14 Old car design servomotor mechanism. (Page 23) Figure 2-15 Last car design servomotor. (Page 23) Figure 2-16 Second car real shots. (Page 24) Figure 2-17 DC motor theory. (Page 25) Figure 2-18 Dual H-bridge. (Page 26) Figure 2-19 Second car motors connection. (Page 27) Figure 2-20 First car motor connection. (Page 28) Figure 2-21 Servo motor mechanism. (Page 29) Figure 2-22 Inside servo motor diagram. (Page 30) Figure 2-23 Inside servo motor real shot. (Page 31) Figure 2-24 Connection of servo motor with Arduino. (Page 32) Figure 3-1 Arduino types. (Page 36) Figure 3-2 Arduino mega. (Page 36)
  • 10. IX Figure 3-3 Rpi memory management. (Page 39) Figure 3-4 Ultrasonic sensor. (Page 42) Figure 3-5 Ultrasonic sensor connection with Arduino. (Page 43) Figure 3-6 Ultrasonic sensor connection with Rpi. (Page 43) Figure 3-7 Infrared sensor. (Page 44) Figure 3-8 Infrared sensor pins. (Page 45) Figure 3-9 IR sensor connection with Arduino. (Page 46) Figure 3-10 Optical Encoder. (Page 46) Figure 4-1 Adaptive cruise control in real cars. (Page 50) Figure 4-2 Operation of LIDAR. (Page 51) Figure 4-3 Operation of fusion sensor. (Page 52) Figure 4-4 Operation of ultrasonic sensor. (Page 52) Figure 4-5 Feedback control system. (Page 53) Figure 4-6 PID theory. (Page 59) Figure 4-7 Graph showing PID definition of terminologies. (Page 60) Figure 4-8 Graph showing dead time. (Page 61) Figure 4-9 On and off switching method of motor. (Page 63) Figure 4-10 Unit-step response of a plant. (Page 63) Figure 4-11 S-shaped response curve. (Page 64) Figure 4-12 Closed-loop system with a proportional controller. (Page 65) Figure 4-13 Sustained oscillation with period Pcr. (Page 65) Figure 4-14 step response of motor. (Page 66) Figure 4-15 step response with tangent. (Page 66) Figure 4-16 system performance. (Page 67) Figure 5-1 Lane-keeping system structure. (Page 71) Figure 5-2 Lane-keeping flowchart. (Page 73) Figure 5-3 Showing first car design length. (Page 74) Figure 5-4 First track material. (Page 74) Figure 5-5 Final track path and material. (Page 75)
  • 11. X Figure 5-6 Final car design length. (Page 76) Figure 5-7 New connection of Dual H-bridge. (Page 76) Figure 6-1 Lane departure flow chart. (Page 82) Figure 7-1 Lane keeping and Lane departure flag. (Page 84) Figure 7-2 Merging flow chart. (Page 85) Figure 8-1 H-bridge used with auto parking. (Page 89) Figure 8-2 Male to male jumpers. (Page 89) Figure 8-3 Raspberry pi. (Page 89) Figure 8-4 Second car DC motor. (Page 89) Figure 8-5 Ultrasonic sensor of second car. (Page 90) Figure 8-6 Battery holder and batteries. (Page 90) Figure 8-7 Resistance in second car connection (Page 90) Figure 8-8 Mini breadboard. (Page 90) Figure 8-9 Second car DC motor connection. (Page 91) Figure 8-10 Raspberry pi GPIO. (Page 93 ) Figure 8-11 PWM. (Page 94) Figure 8-12 Voltage divider circuit. (Page 96) Figure 8-13 Ultrasonic sensor connection with Rpi. (Page 97) Figure 8-14 Ultrasonic sensor pins. (Page 98) Figure 8-15 Ultrasonic real shot connection with Rpi. (Page 98) Figure 8-16 Second car final shot. (Page 101) Figure 8-17 Testing ultrasonic code. (Page 102) Figure 8-18 Parallel parking. (Page 103) Figure 8-19 Perpendicular parking. (Page 103) Figure 8-20 Angle parking. (Page 104) Figure 8-21 Finding parking area. (Page 104) Figure 8-22 Step 1 for parallel parking. (Page 105) Figure 8-23 Step 2 for parallel parking. (Page 105) Figure 8-24 Rest of step 2 for parallel parking. (Page 105)
  • 12. XI Figure 8-25 Step 3 for parallel parking. (Page 106) Figure 8-26 Step 4 for parallel parking. (Page 106) Figure 8-27 Parallel parking detect space state diagram. (Page 107) Figure 8-28 Parallel parking state diagram. (Page 107) Figure 8-29 Perpendicular parking state diagram. (Page 108) Figure 8-30 Car moving forward for enough space. (Page 109) Figure 8-31 Sensing perpendicular parking area dimensions. (Page 109) Figure 9-1 Positioning Satellite in the orbit. (Page 111) Figure 9-2 Localization systems. (Page 112) Figure 9-3 Triangulation. (Page 113) Figure 9-4 An antenna array. (Page 113) Figure 9-5 The length of the arrows corresponds to the arrival time at receiver P. (Page 114) Figure 9-6 Positioning based on TDOA measurements. (Page 114) Figure 9-7 Position measuring. (Page 116) Figure 9-8 Positioning systems. (Page 116) Figure 9-9 Infrared base system positioning (Page 117) Figure 9-10 Ultrasound system application. (Page 118) Figure 9-11 RFID. (Page 120) Figure 9-12 RFID reader. (Page 121 ) Figure 9-13 Arduino yun. (Page 121) Figure 9-14 Layout of the 3 by 3 Grid RFID Positioning System. (Page 122) Figure 9-15 Zigbee modules. (Page 123) Figure 10-1 Arduino Yun WiFi connection. (Page 126) Figure 10-2 uploaded image on drop+box. (Page 128)
  • 14. 2 1.1 History 1930s An early representation of the autonomous car was Norman Bell Geddes's Futurama exhibit sponsored by General Motors at the 1939 World's Fair, which depicted electric cars powered by circuits embedded in the roadway and controlled by radio. 1950s In 1953, RCA Labs successfully built a miniature car that was guided and controlled by wires that were laid in a pattern on a laboratory floor. The system sparked the imagination of Leland M. Hancock, traffic engineer in the Nebraska Department of Roads, and of his director, L. N. Ress, state engineer. The decision was made to experiment with the system in actual highway installations. In 1958, a full size system was successfully demonstrated by RCA Labs and the State of Nebraska on a 400-foot strip of public highway just outside Lincoln, Neb. 1980s In the 1980s, a vision-guided Mercedes-Benz robotic van, designed by Ernst Dickmanns and his team at the Bundeswehr University Munich in Munich, Germany, achieved a speed of 39 miles per hour (63 km/h) on streets without traffic. Subsequently, EUREKA conducted the €749 million Prometheus Project on autonomous vehicles from 1987 to 1995. 1990s In 1991, the United States Congress passed the ISTEA Transportation Authorization bill, which instructed USDOT to "demonstrate an automated vehicle and highway system by 1997." The Federal Highway Administration took on this task, first with a series of Precursor Systems Analyses and then by establishing the National Automated Highway System Consortium (NAHSC). This cost-shared project was led by FHWA and General Motors, with Caltrans, Delco, Parsons Brinkerhoff, Bechtel, UC-Berkeley, Carnegie Mellon University, and Lockheed Martin as additional partners. Extensive systems engineering work and research culminated in Demo '97 on I-15 in San Diego, California, in which about 20 automated vehicles, including cars, buses, and trucks, were demonstrated to thousands of onlookers, attracting extensive media coverage. The demonstrations involved close-headway platooning intended to operate in segregated traffic, as well as "free agent" vehicles intended to operate in mixed traffic.
  • 15. 3 2000s The US Government funded three military efforts known as Demo I (US Army), Demo II (DARPA), and Demo III (US Army). Demo III (2001) demonstrated the ability of unmanned ground vehicles to navigate miles of difficult off-road terrain, avoiding obstacles such as rocks and trees. James Albus at the National Institute for Standards and Technology provided the Real-Time Control System which is a hierarchical control system. Not only were individual vehicles controlled (e.g. Throttle, steering, and brake), but groups of vehicles had their movements automatically coordinated in response to high level goals. The Park Shuttle, a driverless public road transport system, became operational in the Netherlands in the early 2000s.In January 2006, the United Kingdom's 'Foresight' think-tank revealed a report which predicts RFID-tagged driverless cars on UK's roads by 2056 and the Royal Academy of Engineering claimed that driverless trucks could be on Britain's motorways by 2019. Autonomous vehicles have also been used in mining. Since December 2008, Rio Tinto Alcan has been testing the Komatsu Autonomous Haulage System – the world's first commercial autonomous mining haulage system – in the Pilbara iron ore mine in Western Australia. Rio Tinto has reported benefits in health, safety, and productivity. In November 2011, Rio Tinto signed a deal to greatly expand its fleet of driverless trucks. Other autonomous mining systems include Sandvik Automine’s underground loaders and Caterpillar Inc.'s autonomous hauling. In 2013, on July 12, VisLab conducted another pioneering test of autonomous vehicles, during which a robotic vehicle drove in downtown Parma with no human control, successfully navigating roundabouts, traffic lights, pedestrian crossings and other common hazards. In 2011, the Freie Universität Berlin developed two autonomous cars to drive in the inner city traffic of Berlin in Germany. Led by the AUTONOMOS group, the two vehicles Spirit of Berlin and made in Germany handled intercity traffic, traffic lights and roundabouts between International Congress Centrum and Brandenburg Gate. It was the first car licensed for autonomous driving on the streets and highways in Germany and financed by the German Federal Ministry of Education and Research. The 2014 Mercedes S-Class has options for autonomous steering, lane keeping, acceleration/braking, parking, accident avoidance, and driver fatigue detection, in both city traffic and highway speeds of up to 124 miles (200 km) per hour. Released in 2013, the 2014 Infiniti Q50 uses cameras, radar and other technology to deliver various lane-keeping, collision avoidance and cruise control features. One reviewer remarked, "With the Q50 managing its own speed and adjusting course, I could sit back and simply watch, even on mildly curving highways, for three or more miles at a stretch adding that he wasn't touching the steering wheel or pedals.
  • 16. 4 Although as of 2013, fully autonomous vehicles are not yet available to the public, many contemporary car models have features offering limited autonomous functionality. These include adaptive cruise control, a system that monitors distances to adjacent vehicles in the same lane, adjusting the speed with the flow of traffic lane which monitors the vehicle's position in the lane, and either warns the driver when the vehicle is leaving its lane, or, less commonly, takes corrective actions, and parking assist, which assists the driver in the task of parallel parking 1.2 Why autonomous car is important 1.2.1 Benefits of Self-Driving Cars 1. Fewer accidents The leading cause of most automobile accidents today is driver error. Alcohol, drugs, speeding, aggressive driving, over-compensation, inexperience, slow reaction time, inattentiveness, and ignoring road conditions are all contributing factors. Given some 40 percent of accidents can be traced to the abuse of drugs and or alcohol, self-driving cars would practically eliminate those accidents altogether. 2. Decreased (or Eliminated) Traffic Congestion One of the leading causes of traffic jams is selfish behavior among drivers. It has been shown when drivers space out and allow each other to move freely between lanes on the highway, traffic continues to flow smoothly, regardless of the number of cars on the road. 3. Increased Highway Capacity There is another benefit to cars traveling down the highway and communicating with one another at regularly spaced intervals. More cars could be on the highway simultaneously because they would need to occupy less space on the highway 4. Enhanced Human Productivity Currently, the time spent in our cars is largely given over to simply getting the car and us from place to place. Interestingly though, even doing nothing at all would serve to increase human productivity. Studies have shown taking short breaks increase overall productivity. You can also finish up a project, type a letter, monitor the progress of your kid’s schoolwork, return phone calls, take phone calls safely, text until your heart’s content, read a book, or simply relax and enjoy the ride . 5. Hunting For Parking Eliminated Self-driving cars can be programmed to let you off at the front door of your destination, park themselves, and come back to pick you up when you summon them. You’re freed from the task of looking for a parking space, because the car can do it all
  • 17. 5 6. Improved Mobility For Children, The Elderly, And The Disabled Programming the car to pick up people, drive them to their destination and Then Park by themselves, will change the lives of the elderly and disabled by providing them with critical mobility. 7. Elimination of Traffic Enforcement Personnel If every car is “plugged” into the grid and driving itself, then speeding,—along with stop sign and red light running will be eliminated. The cop on the side of the road measuring the speed of traffic for enforcement purposes? Yeah, they’re gone. Cars won’t speed anymore. So no need to Traffic Enforcement Personnel. 8. Higher Speed Limits Since all cars are in communication with one another, and they’re all programmed to maintain a specific interval between one another, and they all know when to expect each other to stop and start, the need to accommodate human reflexes on the highway will be eliminated. Thus, cars can maintain higher average speeds. 9. Lighter, More Versatile Cars The vast majority of the weight in today’s cars is there because of the need to incorporate safety equipment. Steel door beams, crumple zones and the need to build cars from steel in general relate to preparedness for accidents. Self-driving cars will crash less often, accidents will be all but eliminated, and so the need to build cars to withstand horrific crashes will be reduced. This means cars can be lighter, which will make them more fuel-efficient 1.3 What Are Autonomous and Automated Vehicles Technological advancements are creating a continuum between conventional, fully human- driven vehicles and automated vehicles, which partially or fully drive themselves and which may ultimately require no driver at all. Within this continuum are technologies that enable a vehicle to assist and make decisions for a human driver. Such technologies include crash warning systems, adaptive cruise control (ACC), lane keeping systems, and self-parking technology. • Level 0 (no automation): The driver is in complete and sole control of the primary vehicle functions (brake, steering, throttle, and motive power) at all times, and is solely responsible for monitoring the roadway and for safe vehicle operation. • Level 1 (function-specific automation): Automation at this level involves one or more specific control functions; if multiple functions are automated, they operate independently of each other. The driver has overall control, and is solely responsible for safe operation, but can choose to cede limited authority over a
  • 18. 6 primary control (as in ACC); the vehicle can automatically assume limited authority over a primary control (as in electronic stability control); or the automated system can provide added control to aid the driver in certain normal driving or crash-imminent situations (e.g., dynamic brake support in emergencies). • Level 2 (combined-function automation): This level involves automation of at least two primary control functions designed to work in unison to relieve the driver of controlling those functions. Vehicles at this level of automation can utilize shared authority when the driver cedes active primary control in certain limited driving situations. The driver is still responsible for monitoring the roadway and safe operation, and is expected to be available for control at all times and on short notice. The system can relinquish control with no advance warning and the driver must be ready to control the vehicle safely. • Level 3 (limited self-driving automation): Vehicles at this level of automation enable the driver to cede full control of all safety-critical functions under certain traffic or environmental conditions, and in those conditions to rely heavily on the vehicle to monitor for changes in those conditions requiring transition back to driver control. The driver is expected to be available for occasional control, but with sufficiently comfortable transition time • Level 4 (full self-driving automation): The vehicle is designed to perform all safety-critical driving functions and monitor roadway conditions for an entire trip. Such a design anticipates that the driver will provide destination or navigation input, but is not expected to be available for control at any time during the trip. This includes both occupied and unoccupied vehicles. Our project can be considered as level 1 or level 2 type.
  • 19. 7 1.4 Advanced Driver Assistance System (ADAS) A rapid growth has been seen worldwide in the development of Advanced Driver Assistance Systems (ADAS) because of improvements in sensing, communicating and computing technologies. ADAS aim to support drivers by either providing warning to reduce risk exposure, or automating some of the control tasks to relieve a driver from manual control of a vehicle. From an operational point of view, such systems are a clear departure from a century of automobile development where drivers have had control of all driving tasks at all times. ADAS could replace some of the human driver decisions and actions with precise machine tasks, making it possible to eliminate many of the driver errors which could lead to accidents, and achieve more regulated and smooth vehicle control with increased capacity and associated energy and environmental benefits. Autonomous ADAS systems use on-board equipment, such as ranging sensors and machine/computer vision, to detect surrounding environment. The main advantages of such an approach are that the system operation does not rely on other parties and that the system can be implemented on the current road infrastructure. Now many systems have become available on the market including Adaptive Cruise Control (ACC), Forward Collision Warning (FCW) and Lane Departure Warning systems, and many more are under development. Currently, radar sensors are widely used in the ADAS applications for obstacle detection. Compared with optical or infrared sensors, the main advantage of radar sensors is that they perform equally well during day time and night time, and in most weather conditions. Radar can be used for target identification by making use of scattering signature information. It is widely used in ADAS for supporting lateral control such as lane departure warning systems and lane keeping systems. Currently computer vision has not yet gained a large enough acceptance in automotive applications. Applications of computer vision depend much on the capability of image process and pattern recognition (e.g. artificial intelligence). The fact that computer vision is based on a passive sensory principle creates detection difficulties in conditions with adverse lighting or in bad weather situations. 1.5 Project description 1.5.1 Auto-parking The aim of this function is to design and implement self-parking car system that moves a car from a traffic lane into a parking spot through accurate and realistic steps which can be applied on a real car. 1.5.2 Adaptive cruise control (ACC) Also radar cruise control, or traffic-aware cruise control is an optional cruise control system for road vehicles that automatically adjusts the vehicle speed to maintain a safe distance from vehicles ahead. It makes no use of satellite or roadside infrastructures nor of any cooperative
  • 20. 8 support from other vehicles. Hence control is imposed based on sensor information from on- board sensors only. 1.5.3 Lane Keeping Assist It is a feature that in addition to Lane Departure Warning System automatically takes steps to ensure the vehicle stays in its lane. Some vehicles combine adaptive cruise control with lane keeping systems to provide additional safety. A lane keeping assist mechanism can either reactively turn a vehicle back into the lane if it starts to leave or proactively keep the vehicle in the center of the lane. Vehicle companies often use the term "Lane Keep(ing) Assist" to refer to both reactive Lane Keep Assist (LKA) and proactive Lane Centering Assist (LCA) but the terms are beginning to be differentiated 1.5.4 Lane departure Our car moves using adaptive cruise control according to distance of front vehicle .If front vehicle is very slow and will cause our car to slow down the car will start to check the lane next to it and then depart to the next lane in order to speed up again. 1.5.5 Indoor Positioning system An indoor positioning system (IPS) is a system to locate objects or people inside a building using radio waves, magnetic fields, acoustic signals, or other sensory information collected by mobile devices. There are several commercial systems on the market, but there is no standard for an IPS system. IPS systems use different technologies, including distance measurement to nearby anchor nodes (nodes with known positions, e.g., Wi-Fi access points), magnetic positioning, dead reckoning. They either actively locate mobile devices and tags or provide ambient location or environmental context for devices to get sensed. The localized nature of an IPS has resulted in design fragmentation, with systems making use of various optical, radio, or even acoustic technologies. 1.5.6 Connected car The aim of this function is:  Take a picture with a webcam plugged into the Arduino Yun  Upload the image to drop box using Python
  • 21. 9 1.6 Related work The appearance of driverless and automated vehicle technologies offers enormous opportunities to remove human error from driving. It will make driving easier, improve road safety, and ease congestion. It will also enable drivers to choose to do other things than driving during the journey. It is the first driverless electric car prototype built by Google to test self-driving car project. It looks like a Smart car, with two seats and room enough for a small amount of luggage Figure 1-1 Google car It operates in and around California, primarily around the Mountain View area where Google has its headquarters. It move two people from one place to another without any user interaction. The car is called by a smartphone for pick up at the users location with the destination set. There is no steering wheel or manual control, simply a start button and a big red emergency stop button. In front of the passengers there is a small screen showing the weather and the current speed. Once the journey is done, the small screen displays a message to remind you to take your personal belongings. Seat belts are also provided in car to protect the passengers from the primary systems fails; plus that emergency stop button that passengers can hit at any time. Powered by an electric motor with around a 100 mile range, the car uses a combination of sensors and software to locate itself in the real world combined with highly accurate digital maps. A GPS is used, just like the satellite navigation systems in most cars, lasers and cameras take over to monitor the world around the car, 360-degrees. The software can recognize objects, people, cars, road marking, signs and traffic lights, obeying the rules of the road. It can even detect road works and safely navigate around them
  • 22. 10 The new prototype has more sensors fitted to it that can see further (up to 600 feet in all directions) The simultaneous development of a combination of technologies has brought about this opportunity. For example, some current production vehicles now feature adaptive cruise control and lane keeping technologies which allow the automated control of acceleration, braking and steering for periods of time on motorways, major A-roads and in congested traffic. Advanced emergency braking Systems automatically apply the brakes to help drivers avoid a collision. Self-parking systems allow a vehicle to parallel or Reverse Park completely hands free. Developments in vehicle automation technology in the short and medium term will move us closer to the ultimate scenario of a vehicle which is completely “driverless”. Figure 1-2 progression of automated vehicle technologies
  • 23. 11 VOLVO autonomous CAR semi-autonomous driving features: sensors can detect lanes and a car in front of it. Button in the steering wheel to let the system know I want it to use Adaptive Cruise Control with Pilot Assist. If the XC90 lost track of the lanes, it would ask the driver to handle steering duties with a ping and a message in the dashboard. This is called the Human-machine interface BMW autonomous CAR A new i-Series car will include forms of automated driving and digital connectivity most likely Wi-Fi, high-definition digital maps, sensor technology, cloud technology and artificial intelligence. Nissan autonomous CAR Nissan vehicles in the form of Nissan’s Safety Shield-inspired technologies. These technologies can monitor a nearly 360-degree view around a vehicle for risks, offering warnings to the driver and taking action to help avoid crashes if necessary.
  • 25. 13 2.1 First car design In this section, we will talk about the trials that we passed by till reaching our last prototype concerning the first car in our project. This car performs some functions of our project such as the adaptive cruise control (ACC), lane keeping and lane departure. 2.1.1 Four WD Robot (Acrylic with 4 Motors and 4 Wheels) The 4WD robot consists of four gear-motors with 65mm diameter wheels. The chassis plates contain numerous cuts and holes for mounting sensors, microcontrollers and other hardware. The space between the plates is ideal for batteries or more components. 2.1.1.1 Specifications 1) Motors  Suggested Voltage:4.5V DC (work well from 3-6V)  No load Speed:90±10rpm  No Load Current:190mA(max.250mA)  Torque:800gf.cm (Minimum)  Stall current approximately 1A 2) Wheels  65mm diameter, 30mm width  Plastic rims with solid rubber tires 3) Chassis  Laser cut acrylic  Metal standoffs  Top and bottom plates are both 110mm long x 174mm wide Figure 2-1 four WD robot
  • 26. 14 2.1.1.2 Real Shots Figure 2-2 four WD real shot 2.1.1.3 Drawbacks 1) The 4WD robot uses four wheels with four Dc motors which is not similar to a real car. 2) The steering mechanism is not accurate, which causes many problems while working. 3) The robot size is very small which is not stable and can be easily broken. 2.1.1.4 Overcoming the drawbacks 1) Implementing a mechanical design to serve our needs 2) Using servo motor with steering mechanism to give stable steering while turning left or right. 2.1.2 Second Trial The mechanical design is considered as one of the most important parts in our project because: 1- Without a good design the car may fail in accomplishing its tasks.
  • 27. 15 2- The body carries all the electrical components, if the body might fail to withstand the stresses. 2.1.2.1 Specifications 1) Main body: length= 360 mm, width=140 mm, aspect ratio between length and width is similar to Honda Jazz – 2011. Figure 2-3 second design trial AutoCad design 2) Motors *Servo motor. *DC motor with dual H-bridge. 3) Wheels * 4 rubber wheels. * Plastic rims with solid rubber tires. Front wheel place Front fixing slots Servo position Back fixing slots Driving motor position Side fixing slots
  • 28. 16 4) Chassis * Laser cut acrylic. * 3D holders for the IR sensor. 2.1.2.2 Real Shots First shot shows the servomotor with the front wheel, Arduino card, and back wheel with the driving DC motor. Figure 2-4 second car trial real shots It’s obvious that the length to width ratio could cause problem during the turns.
  • 29. 17 The car with all components on and connected. Figure 2-5 second car trial connection 2.1.2.3 Drawbacks 1- The car bulk loaded with all other parts makes it hard to take turn. 2- The sharp edge in the front wheel position, causes friction with the wheels and, makes it hard to take turns. 3- The position of servomotor and the main front wheel link connection was weak. 2.1.2.4 Overcoming these problems Modifying the original design by changing the length to 260 mm and keep the width 140 mm, that led to better performance in taking turns 2.1.3 Final Design 2.1.3.1 Body Figure 2-6 final car design Fillet to overcome wheel friction with the body
  • 30. 18 2.1.3.2 Side Covers The height of the side cover is 114 mm and length was 360 mm then reduced to 260 mm to fit the modified, as following there are two figures, on the right hand side is the right cover, on the left hand side is the left cover. Figure 2-7 final car side covers The side covers are used to overcome the modification draw back, the sides provide the area required to fix the rest of components without any problems. Ultrasound sensors slots The cover fixing slots Front wheels slots Arduino cable slot The Base fixing slots Back wheels slots
  • 31. 19 2.1.3.3 The Front and Back Covers The dimensions are 140 mm width and 114 mm height, provided with slots to fix the ultrasound sensors. Figure 2-8 final car front and back covers The ultrasound sensor slots Side slots Cover slots Base slots
  • 32. 20 2.1.3.4 Cover The cover dimensions are 260 mm length and 140 mm width. The cover function is to keep all the small and other components inside. We notice that the design is not aerodynamically considered, that’s because the project target is the control and apply the function, not to study the aerodynamic effects of cars. 2.1.3.5 Real shots Figure 2-10 final car real shots 2.1.3.6 Drawback The compact size causes another expected problem, there are many components require more space, and the total area is reduced. Figure 2-9 final car cover
  • 33. 21 2.2 Car Wheel Drive 2.2.1 Types of wheel drive Figure 2-11 types of wheel drive Our car is using rear-wheel-drive. 2.2.2 Advantages of this configuration: 1- Even weight distribution. 2- Better control at the turns. 3- Better steering radius. Wheel drive two-wheel drive front drive rear drive four-wheel drive Figure 2-12 final car inside view
  • 34. 22 2.3 Car Steering 2.3.1 Basic geometry The basic aim of steering is to ensure that the wheels are pointing in the desired directions. This is typically achieved by a series of linkages, rods, pivots and gears. One of the fundamental concepts is that of caster angle – each wheel is steered with a pivot point ahead of the wheel; this makes the steering tend to be self-centering towards the direction of travel. Figure 2-13 final car center of turning circle
  • 35. 23 2.3.2 Our mechanism It is controlled automatically by a servomotor connected directly to the main link. Shown in the picture the old mechanism, it’s obvious that the orientation of the servomotor is not correct. The servomotor at this position doesn’t give all the desired angles. So modifications are made. 2.3.3 Servomotor modifications Modifications are made to ensure better performance in turns, the new mechanism is less heavy, more flexible with turns. As shown in following image. The servomotor in the new position gives all the angles and transfer more torque. Servomotor in the new position Servomotor in the old position Figure 2-14 old car design servomotor mechanism Figure 2-15 last car design servomotor
  • 36. 24 2.4 Second car design We are going to talk about the design of the second car used in our project and the trials till reaching the last prototype. The second car performs the auto-parking function in our project. It passed by nearly the same trials as the first car but concerning the final design, it was not the same. So we will discuss the final design in the following lines. 2.4.1 Final design The final design of the second car is an RC car. The RC car is the best choice for implementing the auto-parking function because all the above designs did not help in fulfilling the function correctly. 2.4.2 Real shots Figure 2-16 second car real shots 2.5 Motors The motor is the primary tool for creating motion. At its simplest use, you can use it to make something spin. With a little more mechanical work, using gears and other mechanical devices, you can use a motor to make something move, vibrate, rise, fall, roll, creep, or perform almost any other type of motion that does not require precise positioning. There are several different kinds of motors: servos, stepper motors, or unidirectional DC motors. In this section, we will talk about DC and servo motors and how they can be. Simple motors are good for designs that need motion forward or backward, like a remote control car or a fan, but not for things that need to move to a precise position, like a robotic arm or anything that points or moves something to a controlled position.
  • 37. 25 2.5.1 DC Motor D. C motors are seldom used in ordinary applications because all electric supply companies furnish alternating current. However, for special applications such as in steel mills, mines and electric trains, it is advantageous to convert alternating current into direct current in order to use DC motors. The reason is that speed/torque characteristics of DC motors are much more superior to that of AC motors. Therefore, it is not surprising to note that for industrial drives, DC motors are as popular as 3-phase induction motors. Like DC generators, dc motors are also of three types. (series-wound , shunt-wound and compound wound). The use of a particular motor depends upon the mechanical load it has to drive. Motors are all around us; just look inside moving toys, and you’ll find a number of excellent motors and gears. Any electronics supplier will have a wide range of motors that will suit many purposes from spinning small objects to driving large loads 2.5.1.1 D.C Motor Fundamentals DC motors consist of rotor (or armature), commentator, brushes, rotating shaft and bearings, stator with permanent magnet. The principle of operation with a simple two-pole dc motor: The torque is produced by the fact that like field poles attracts and unlike poles repel. 2.5.1.2 DC Motor Principle It is a machine that converts DC power into mechanical power. Its operation is based on the principle that when a current carrying conductor is placed in a magnetic field, the conductor experiences a mechanical force. Basically, there is no constructional difference between a DC motor and a DC generator. The same DC machine can be run as generator motor. Figure 2-17 DC motor theory
  • 38. 26 2.5.1.3 Controlling DC Motor First we have to mention that the Dc motor used in our project was taken from RC toy car and we repurpose it to match our needs and design for both cars. Here we will talk briefly about controlling the motor and its connection with the Arduino. 1) H-Bridge An H bridge is an electronic circuit that enables voltage to be supplied to the DC motor and control its direction. This circuit is often used in robotics and other applications. 1.1 L298 Dual Motor Driver Module This driver module is based on L298N H-bridge, a high current, high voltage dual full bridge driver manufactured by ST Company. It can drive up to 2 DC motors 2A each. The driver can control both motor RPM and direction of rotation. The RPM is controlled using PWM input to ENA or ENB pins, while rotation direction is controlled by supplying high and low signal to EN1-EN2 for the first motor or EN3-EN4 for second motor. This Dual H- Bridge driver is capable of driving voltages up to 46V. 1.2 Features  Dual H bridge drive (can drive 2 DC motors).  Chip L298N.  Logical voltage 5V.  Drive voltage 5V-35V.  Logic current 0mA-36mA.  Drive current 2A (For each DC motor)).  Weight 30gm.  Size: 43*43*27mm. Figure 2-18 Dual H-bridge
  • 39. 27 1.3 Driver connection with Arduino It has 8 pins: 1- GND. 2- + 5 V (power for driver (not motor)). 3- ENA: Motor enable for Motor A (high/low). 4, 5- IN1, IN2: pins control Motor A direction of rotation (one is high and the other is low). 6-ENB: Motor enable for Motor B (high/low). 7, 8- IN3, IN4: These pins define Motor B direction of rotation (one is high and the other is low). The following figures show the exact connection with Arduino. It is obvious that the first connection is when connecting two motors with the driver and this happened in the second car (RC car). Figure 2-19 second car motors connection While the first car connection is using only one motor and connecting it with the driver as shown in the following connection.
  • 40. 28 Figure 2-20 first car motor connection 2.5.2 Servo motor Unlike dc motors, with servo motors you can position the motor shaft at a specific position (angle) using control signal. The motor shaft will hold at this position as long as the control signal not changed. This is very useful for controlling robot arms, unmanned airplanes control surface or any object that you want it to move at certain angle and stay at its new position. Servo motors may be classified according to size or torque that it can withstand into mini, standard and giant servos. Usually mini and standard size servo motors can be powered by Arduino directly with no need to external power supply or driver. Usually servo motors come with arms (metals or plastic) that are connected to the object required to move. In our project we used a TowerPro MG995 servo motor and in the following lines we will show its features in brief. 2.5.2.1 Servo motor features  Model: TowerPro MG995 Metal Servo.  Dimensions: :4.07*1.97*4.29cm.  Speed: 0.2sec/60° (4.8V).  Torque: 10kg-cm.  Rated Voltage: 4.8-7.2V.
  • 41. 29 2.5.2.2 Servo Motor mechanism Servo motor has 3 wires:  Black wire: GND (ground).  RED wire: +5v.  Colored wire: control signal. The third pin (colored wire) accepts the control signal which is a pulse-width modulation (PWM) signal which can be easily produced by all micro- controllers and Arduino board. It accepts the signal from your controller that tells it the turn angle. The control signal is fairly simple compared to that of a stepper motor. It is just a pulse of varying lengths. The length of the pulse corresponds to the angle by which the motor turns to. Figure 2-21 servo motor mechanism
  • 42. 30 2.5.2.3 Inside Servo Motor Did you ever wonder how the servo motors looks from inside? Have a look at figure 2-22 and figure 2-23. A servo motor was taken apart to show the internal parts. You can see a regular dc motor connected to a gear box and a potentiometer that gives the feedback for angle position. This is represented by the diagram below. Figure 2-22 inside servo motor diagram
  • 43. 31 Figure 2-23 inside servo motor real shot 2.5.2.4 Servo Motor with Arduino Standard servo motor control using Arduino is extremely easy. This is because the Arduino software comes with a sample servo sketch and servo Library that will get you up and running quickly.  Connect the black wire from the servo to the GND pin on Arduino.  Connect the red wire from servo to the +5V pin on Arduino.  Connect the third wire (usually orange or yellow) from the servo to a digital pin on Arduino.
  • 44. 32 Figure 2-24 Connection of servo motor with Arduino
  • 46. 34 3.1 Micro Controllers A Microcontroller (sometimes abbreviated µC, or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems. Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (single-digit mille watts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt, power consumption while sleeping (CPU clock and most peripherals off) may be just Nano watts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption. 3.1.1 Arduino 3.1.1.1 Introduction 1. What is Arduino? Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It’s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment. 2. Why Arduino? There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's
  • 47. 35 Handy board, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and +wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems: • Inexpensive Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50 • Cross-platform The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows. • Simple, clear programming environment The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino • Open source and extensible software The Arduino software is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if you want to. • Open source and extensible hardware The Arduino is based on Atmel's ATMEGA8 and ATMEGA168 microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money.
  • 48. 36 3. Types of Arduino There are different types of Arduino to choose from. 3.1.1.2 Arduino mega Figure 3-2 Arduino mega 1. Overview The Arduino Mega 2560 is a microcontroller board based on the ATmega2560 It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila. 2. Power The Arduino Mega can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wallwart) or battery. The adapter can be connected by plugging a 2.1mm centerpositive plug into the board’s power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied Figure 3-1 Arduino types
  • 49. 37 with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. The power pins are as follows: 1. VIN. The input voltage to the Arduino board when it’s using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin. 2. 5V. This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t advise it. 3. 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA. 4. GND. Ground pins. 3. Memory The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and written with the EEPROM library). 4. Input and Output Each of the 54 digital pins on the Mega can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions: 1. Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip. 2. External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
  • 50. 38 3. PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analog- Write() function. 4. SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila. 5. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off. 6. TWI: 20 (SDA) and 21 (SCL). Support TWI communication using theWire library. Note that these pins are not in the same location as the TWI pins on the Duemilanove or Diecimila. The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function. There are a couple of other pins on the board: 1. AREF. Reference voltage for the analog inputs. Used with analogReference(). 2. Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board. 5. Communication The Arduino Mega2560 has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The AT mega 2560 provides four hardware UARTs for TTL (5V) serial communication. An ATmega16U2 (AT mega 8U2 on the revision 1 and revision 2 boards) on the board channels one of these over USB and provides a virtual com port to software on the computer (Windows machines will need a .inf file, but OSX and Linux machines will recognize the board as a COM port automatically. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the board. The RX and TX LEDs on the board will flash when data is being transmitted via the ATmega8U2/ATmega16U2 chip and USB connection to the computer (but not for serial communication on pins 0 and 1). A Software Serial library allows for serial communication on any of the Mega2560’s digital pins. The ATmega2560 also supports TWI and SPI communication. The Arduino software includes a Wire library to simplify use of the TWI bus; see the documentation for details. For SPI communication, use the SPI library 6. Programming The Arduino Mega can be programmed with the Arduino software (download). The ATmega2560 on the Arduino Mega comes preburned with a bootloader that allows
  • 51. 39 you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol (reference, C header files). 7. Automatic (Software) Reset Rather then requiring a physical press of the reset button before an upload, the Arduino Mega2560 is designed in a way that allows it to be reset by software running on a connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2 is connected to the reset line of the ATmega2560 via a 100 nano-farad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well- coordinated with the start of the upload. 3.1.2 Raspberry Pi 3.1.2.1 Design The Raspberry Pi is a single-board computer developed in the UK by the Raspberry Pi. The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. The design is based around a Broadcom BCM2835 SoC, which includes an ARM1176JZF-S 700 MHz processor and 512 Megabytes of RAM. The design does not include a built-in hard disk or solid-state drive, instead relying on an SD card for booting and long-term storage. This board is intended to run Linux kernel based operating systems. 3.1.2.2 ARM1176 PROSESSOR The ARM1176™ applications processors deployed broadly in devices ranging from smart phones to digital TV's delivering media and browser performance, a secure computing environment, and performance up to 1GHz in low cost designs. The ARM1176 is still actively being licensed for application processor and baseband processor designs due to its maturity, low level of implementation risk, and low implementation cost Figure 3-3 Rpi memory management
  • 52. 40 3.1.2.3 Features • Low risk and fast time to market • High performance in low-cost designs • Physically addressed caches for multi-tasking performance • Broad OS support, multiple Linux distributions, amazing ARM ecosystem • Full Internet experience • Low Power Leadership • 93% of flops are clock gated 3.1.2.4 Performance The ARM1176 processor performance reaches up to 1GHz and beyond in 40G, and can reach 1GHz in 65nm with overdrive voltages. 3.1.2.5 Functions supported in hardware • Multiplication, addition, and multiply-accumulate ( various variants) • Division and square root operation (multi-cycle, not pipelined) • Comparisons and format conversions • Operations can be performed on short vectors (From assembler only) • Separate pipelines allow load/store and MAC operations to occur simultaneously with divide/square root unit operation • Clock gated and/or power completely removed
  • 54. 42 3.2 Hardware 3.2.1 Ultrasonic sensor 3.2.1.1 Introduction Distance measurement sensor is a low cost full functionality solution for distance measurement applications. The module is based on the measurement of time flight of ultrasonic pulse, which is reflected by an object. The distance to be measured mainly depends on the speed of ultrasonic waves in space or air –which is a constant and the flight time of the pulse. The module performs these calculations and outputs a pulse width depends on the measured distance, this pulse is easily interfaced to any microcontroller. Figure 3-4 ultrasonic sensor 3.2.1.2 Features • Supply voltage +5Vdc • Supply Current 10mA • Measurement distance Range from 2cm to 400cm. • Input trigger pulse is 5V TTL compatible (5 μs minimum). Output echo pulse is 5V TTL compatible. Size 44.5mm W x 20mm H x 15mm D. • Interface connector 4-pin header SIP, 0.1” spacing. • Operating temperature range 0° - 70° C.
  • 55. 43 3.2.1.3 Connection with Arduino Figure 3-5 ultrasonic sensor connection with Arduino 3.2.1.4 Connection with Raspberry pi Figure 3-6 ultrasonic sensor connection with Rpi
  • 56. 44 3.2.2 Infrared line tracking sensor 3.2.2.1 Introduction Line tracking is the most basic function of smart mobile robot. This new generation of line tracking sensors is developed to be the robot's powerful copilot all the way. It will guide it robot by telling white from black quickly and accurately, via TTL signal. With a drawn path and good programming can ensure results that are far more consistent than if the robot was simply told where to go without any reference. Figure 3-7 infrared sensor 3.2.2.2 Theory of operation It consists two parts 1) IR emitting LED 2) IR sensitive phototransistor. The IR Reflectance sensors work best when they are close to the surface of the ground. It should be about 1/8" above the ground. This is an optimal distance for the IR transmitter to illuminate the surface below and measure the reflected light. It works by transmitting a beam of IR light downward toward the surface. If the detector is over a white surface, the reflected light is received by the detector and outputs a HIGH signal. When the sensor is over a black surface where the light is absorbed or not reflected, the IR detector outputs a LOW signal. The IR Sensor module provides a value inversely dependent to the amount of reflected IR light. So it can output digital signal to a microcontroller so the robot can reliably follow a black line on a white background, or vice versa
  • 57. 45 3.2.2.3 Features and Pins  Small size.  5V DC power supply.  Indicator LED.  Digital output.  Distance: up to 3 cm  Size: 3.5 x 1cm  Applicable to a variety of platforms including Arduino / AVR / ARM /PIC ** Pin Definition  GND: Ground  OUT: Output (HIGH when line is black and LOW when line is white)  VCC: 3.3-5 VDC Figure 3-8 infrared sensor pins
  • 58. 46 3.2.2.4 Arduino connection Figure 3-9 1R sensor connection with Arduino 3.2.3 Optical encoder Figure 3-10 optical encoder 3.2.3.1 Introduction The encoder kit consists of two 8-pole magnets with rubber hubs and two hall- effect sensors terminated with 150mm (6 inch) cable and 3 pin female servo headers. The magnets have 4 north poles and 4 south poles and are strong enough that the sensor can detect the poles from more than 3mm (1/8inch). This means that the sensors do not need to be precisely mounted to detect the poles. The rubber hubs will press fit over most small motor and drive shafts used in low power gearboxes. A small screw may also be used to attach the magnets in some cases.
  • 59. 47 The hall-effect sensors will work on voltages from 3V to 24V and include reverse polarity protection. It can work with any Arduino compatible controller and use the processors internal pullup resistors eliminating the need for any external components or wiring 3.2.3.2 Specifications • Supply voltage: 3V-24V • Supply current: 4mA per sensor • Output voltage: 26V maximum • Output current: 25mA continuous • Output type: Open drain
  • 61. 49 4.1 Definitions Adaptive Cruise Control (ACC): An enhancement to a conventional cruise control system which allows the ACC vehicle to follow a forward vehicle at an appropriate distance. 4.2 Introduction A big issue on busy roads is traffic jams. There are campaigns that ask people not to travel during peak hours and to travel together in one car, but they don’t have the desired effect. This raises the demand for a technical solution. If the amount of cars can’t be reduced, the vehicle throughput of the road must be increased to solve the traffic jams. This can be done by reducing the inter-vehicle distance, but this will immediately lead to unsafe situations caused by the slow response time of human beings. To overcome this slow response time, a technical solution can be introduced, which controls the throttle and brake of the car. An implementation of such a system which is used more and more these days, is ACC. The goal of such a system is to keep a constant distance to its predecessor, or to keep a constant speed if the constant distance could only be achieved if the maximum speed must be exceeded. Using this technique, it is possible to create a vehicle string with all cars driving safely in the platoon while being comfortable for the passenger in the car An ‘Adaptive Cruise Control’ (ACC) system developed as the next generation assisted the driver to keep a safe distance from the vehicle in front. This system is now available only in some luxury cars like Mercedes S-class, Jaguar and Volvo trucks the U.S. Department of transportation and Japan’s ACAHSR have started developing ‘Intelligent Vehicles’ that can communicate with each other with the help of a system called ‘Cooperative Adaptive Cruise Control’
  • 62. 50 4.3 Application 4.3.1 Theory of operation Adaptive Cruise Control (ACC) is an advancement of cruise control system. It’s an automotive feature allows the vehicle to adopt set vehicle's speed to the traffic environment. A sensor system is attached to the front of the vehicle which is used to detect former slow moving vehicles are in the ACC vehicle's path. If a foregoing slow moving vehicle detected by the sensor system in the ACC vehicle’s path, then the ACC system will automatically slows its speed to maintain a safe distance. If the system detects that the ahead vehicle gets higher speed than ACC vehicle cruise speed or no longer in the ACC vehicle's path, then automatically ACC system will stimulate back the vehicle speed to its pre-set cruise control speed. This action of control system allows the ACC vehicle to self-governing slow down and speeds up with traffic without arbitration from the driver Figure 4-1 Adaptive cruise control in real cars 4.3.2 Sensor options currently four means of object detection are technically feasible and applicable in a vehicle environment .They are 1. RADAR 2. LIDAR 3. Vision sensor 4. ULTRASONIC SENSOR The first ACC system used LIDAR sensor.
  • 63. 51 4.3.2.1 LIDAR (Light Detection and Ranging) The first ACC system introduced by Toyota used this method. By measuring the beat frequency difference between a Frequency Modulated Continuous light Wave (FMCW) and its reflection Figure 4-2 operation of LIDAR Most of the current ACC systems are based on 77GHz RADAR sensors. The RADAR systems have the great advantage that the relative velocity can be measured directly, and the performance is not affected by heavy rain and fog. LIDAR system is of low cost and provides good angular resolution although these weather conditions restrict its use within a 30 to 40 meters range. 4.3.2.2 RADAR (Radio Detection and Ranging) RADAR is an electromagnetic system for the detection and location of reflecting objects like air crafts, ships, space crafts or vehicles. It is operated by radiating energy into space and detecting the echo signal reflected from an object (target) the reflected energy is not only indicative of the presence but on comparison with the transmitted signal, other information of the target can be obtained. The currently used ‘Pulse Doppler RADAR’ uses the principle of ‘Doppler effect’ in determining the velocity of the target 4.3.2.3 Fusion sensor The new sensor system introduced by Fujitsu Ten Ltd. and Honda through their PATH program includes millimeter wave radar linked to a 640x480 pixel stereo camera with a 40 degree viewing angle. These two parts work together to track the car from the non-moving objects. While RADAR target is the car’s rear bumper, the stereo camera is constantly
  • 64. 52 captures all objects in its field of view Figure 4-3 operation of fusion sensor The image processor measures the distances to the objects through triangulation method. This method includes an algorithm based on the detection of the vertical edges and distance. Incorporating both the 16-degree field of view of radar and 40-degree field of view of camera enhances the performance in tight curves 4.3.2.4 Ultrasonic sensor Depend on measuring distance between our car and front car by sending and receiving ultrasonic waves and measure time taken by wave between sending and receiving according to distance car takes action to speed up or slow down Figure 4-4 operation of ultrasonic sensor
  • 65. 53 Ultrasonic sensors are capable of detecting most objects — metal or nonmetal, clear or opaque, liquid, solid, or granular — that have sufficient acoustic reflectivity. Another advantage of ultrasonic sensors is that they are less affected by condensing moisture than photoelectric sensors. A downside to ultrasonic sensors is that sound absorbing materials, such as cloth, soft rubber, flour and foam, make poor target objects. In our project we used Ultrasonic sensor because it is the most suitable sensor according to size, cost and availability 4.4 Algorithm First a safe distance is set this is the distance our car wants to keep with the front vehicles (the reference). Second cruise speed is set this is the speed the car will maintain at free driving. Figure 4-5 feedback control system Figure 4-6 PID theory
  • 66. 54 Controller here is Arduino microcontroller its function is to take values of distance read by sensor and control speed and distance according to values set When the car start and the function is activated it starts to take readings from ultrasonic sensor and act according to these readings we here have two cases: 1) If distance is bigger than safe distance This means that the car can move freely with the cruise speed as there is no car in its way speed is controlled by speed PID in order to make car maintain this speed while cruising 2) If distance is less than safe distance This mean that the car will slow down to maintain safe distance how much the car will slow down is controlled by PID 3) If distance is less than critical distance then the car will stop 4.5 Implementation and testing 4.5.1 Steps The hardware used to implement this function is the DC motor and ultrasonic sensor the steps we made was: 1) Testing accuracy of the sensor we have and writing code to calculate the distance that it sees 2) Connecting DC motor , we started first with a simple code to move car and test different speeds to see how the car responds 3) Then we made our code using fuzzy control so that for every range of distance the car will move with a certain speed 4) After that we started adding a controller to our system as shown in flow chart 5) we started reading about different controllers then decided to use PID for our system 6) Then we started tuning parameters to reach the ones suitable for us after that testing its response 7) Since our system has no model and considered a black box tuning need to be done experimentally 8) There is different tuning methods in our system we used two methods Distance speed PID we used trial and error method Speed PID we used Ziegler-Nicholas 9) Then testing response
  • 67. 55 4.6 Designing a control system 4.6.1 Design in real systems To design any control system: 1) Choose design specification needed 2) Set a mathematical model for system 3) Then tune parameter and check performance of system, if the system specification reached then the parameters are the right ones but if specifications not reached then retune parameters 4.6.2 Design in our system 1) We didn’t set any specification because what was important for us is speed of response 2) Our system doesn’t have a model so we consider it a black box 3) We will tune parameters by method that doesn’t need transfer function 4) Before tuning we need to choose the type of controller that we will use 4.6.3 Controllers Before introducing various controllers, it is very important to know why we use controllers and why they are important. 1. Controllers improve steady state accuracy by decreasing the steady state errors. 2. As the steady state accuracy improves, the stability also improves. 3. Help in reducing the offsets produced in the system. 4. Maximum overshoot of the system can be controlled using these controllers. 5. They also help in reducing the noise signals produced in the system. 6. Slow response of the over damped system can be made faster with the help of these controllers. 4.6.3.1 P Controller P controller is mostly used in first order processes with single energy storage to stabilize the unstable process. The main usage of the P controller is to decrease the steady state error of the system. As the proportional gain factor K increases, the steady state error of the system decreases. However, despite the reduction, P control can never manage to eliminate the steady state error of the system. As we increase the proportional gain, it provides smaller amplitude and phase margin and larger sensitivity to the noise. We can use this controller only when our system is tolerable to a constant steady state error. In addition, it can be easily concluded that applying P controller decreases the rise time and after a certain value of reduction on the steady state error, increasing K only leads to overshoot of the system response. Mathematical equation:
  • 68. 56 Advantages 1. Proportional controller helps in reducing the steady state error, thus makes the system more stable. 2. Slow response of the over damped system can be made faster with the help of these controllers. Disadvantages 1. Due to presence of these controllers there are some offsets in the system. 2. Proportional controllers also increase the maximum overshoot of the system. 4.6.3.2 PI controller P-I controller is mainly used to eliminate the steady state error resulting from P controller. However, in terms of the speed of the response and overall stability of the system, it has a negative impact. This controller is mostly used in areas where speed of the system is not an issue. Mathematical equation: Removing the sign of proportionality we have, Advantages PI controller fuses the properties of the P and I controllers. It shows a maximum overshoot and settling time similar to the P controller but no steady-state error. Disadvantages Since P-I controller has no ability to predict the future errors of the system it cannot decrease the rise time and eliminate the oscillations.
  • 69. 57 4.6.3.3 P-D Controller The aim of using P-D controller is to increase the stability of the system by improving control since it has an ability to predict the future error of the system response. In order to avoid effects of the sudden change in the value of the error signal, the derivative is taken from the output response of the system variable instead of the error signal. Therefore, D mode is designed to be proportional to the change of the output variable to prevent the sudden changes occurring in the control output resulting from sudden changes in the error signal. In addition D directly amplifies process noise therefore D-only control is not used. Mathematical equation: Removing the sign of proportionality we have, Advantages Smaller maximum overshoot due to the 'faster' D action compared with other controller types. A steady-state error is visible, which is smaller than in the case of the P controller. This is because the PD controller generally is tuned to have a larger gain Kc due to the positive phase shift of the D action. 4.6.3.4 P-I-D Controller P-I-D controller has the optimum control dynamics including zero steady state error, fast response (short rise time), no oscillations and higher stability. The necessity of using a derivative gain component in addition to the PI controller is to eliminate the overshoot and the oscillations occurring in the output response of the system. Mathematical equation: Advantages 1-One of the main advantages of the P-I-D controller is that it can be used with higher order processes including more than single energy storage.
  • 70. 58 2- Zero steady state error. The advantage of PID controller is its feasibility and easy to be implemented. The PID gains can be designed based upon the system parameters if they can be achieved or estimated precisely. Moreover, the PID gain can be designed just based on the system tracking error and treats the system to be "black box" if the system parameters are unknown. However, PID controller generally has to balance all three-gain impact to the whole system and may compromise the transient response, such as settling time, overshoots, and oscillations. If the system parameters cannot be precisely estimated or achieved, the designed PID gains may not resist the uncertainties and disturbances, and thus present low robustness. Even though the PID gains can be well-designed, the PID controller still has low robust ability compared with the robust controller when the system encounters to multiple challenges from the operating environment of the system, such as temperature, weather, power surge, and so on. -PID is widely used in automotive and in general applications and has several sources. So we decided to use PID controller. The PID controller has three tunable parameters, whose sum constitutes the adjustable variable (AV). The summation of proportional, integral, and derivative terms gives the output of the PID controller. Defining u(t) as the controller output, the final form of the PID design Where, Kp: Proportional gain, a tuning parameter Ki : Integral gain, a tuning parameter Kd: Derivative gain, a tuning parameter E : Error = SP- PV T : Time or instantaneous time S : set point C.S : control signal O : Output The basic idea behind a PID controller is to read a sensor, then compute the desired actuator output by calculating proportional, integral, and derivative responses and summing those three components to compute the output. First we need to know what a closed loop system is and some of the terminologies associated with it.
  • 71. 59 PID Theory Figure 4-6 PID block diagram Proportional Response The proportional component depends only on the difference between the set point and the process variable. This difference is referred to as the Error term. The proportional gain (Kc) determines the ratio of output response to the error signal. For instance, if the error term has a magnitude of 10, a proportional gain of 5 would produce a proportional response of 50. In general, increasing the proportional gain will increase the speed of the control system response. However, if the proportional gain is too large, the process variable will begin to oscillate. If Kc is increased further, the oscillations will become larger and the system will become unstable and may even oscillate out of control. Integral Response The integral component sums the error term over time. The result is that even a small error term will cause the integral component to increase slowly. The integral response will continually increase over time unless the error is zero, so the effect is to drive the Steady- State error to zero. Steady-State error is the final difference between the process variable and set point. A phenomenon called integral windup results when integral action saturates a controller without the controller driving the error signal toward zero. Derivative Response The derivative component causes the output to decrease if the process variable is increasing rapidly. The derivative response is proportional to the rate of change of the process variable. Increasing the derivative time (Td) parameter will cause the control system to react more strongly to changes in the error term and will increase the speed of the overall control system response. Most practical control systems use very small derivative time (Td), because the Derivative Response is highly sensitive to noise in the process variable signal. If the sensor feedback signal is noisy or if the control loop rate is too slow, the derivative response can make the control system unstable
  • 72. 60 4.6.4 Definition of Terminologies The control design process begins by defining the performance requirements. Control system performance is often measured by applying a step function as the set point command variable, and then measuring the response of the process variable. Commonly, the response is quantified by measuring defined waveform characteristics such as: -Rise Time is the amount of time the system takes to go from 10% to 90% of the steady- state, or final, value. -Percent Overshoot is the amount that the process variable overshoots the final value, expressed as a percentage of the final value. -Settling time is the time required for the process variable to settle to within a certain percentage (commonly 5%) of the final value. -Steady-State Error is the final difference between the process variable and set point. Note that the exact definition of these quantities will vary in industry and academia. Figure 4-7 graph showing PID definition of terminologies After using one or all of these quantities to define the performance requirements for a control system, it is useful to define the worst case conditions in which the control system will be expected to meet these design requirements. Often times, there is a disturbance in the system that affects the process variable or the measurement of the process variable. In some cases, the response of the system to a given control output may change over time or in relation to some variable. A nonlinear system is a system in which the control parameters that produce a desired response at one operating point might not produce a satisfactory response at another operating point. For instance, a chamber partially filled with fluid will exhibit a much faster response to heater output when nearly empty than it will when nearly full of fluid. The measure of how well the control system will tolerate disturbances and
  • 73. 61 nonlinearities is referred to as the robustness of the control system. Some systems exhibit an undesirable behavior called dead time. Dead time is a delay between when a process variable changes, and when that change can be observed. For instance, if a temperature sensor is placed far away from a cold water fluid inlet valve, it will not measure a change in temperature immediately if the valve is opened or closed. Dead time can also be caused by a system or output actuator that is slow to respond to the control command, for instance, a valve that is slow to open or close. Loop cycle is also an important parameter of a closed loop system. The interval of time between calls to a control algorithm is the loop cycle time. Systems that change quickly or have complex behavior require faster control loop rates. Figure 4-8 graph showing dead time 4.6.5 Distance speed PID When distance detected by sensor is less than the desired safe distance the car will slow down but by what value …, this is why PID is used to control speed of car according to distance PID has a set point which is X , an input which is reading from ultrasonic , tuning parameters Kp Ki Kd , and an output which is the speed of car when distance decrease the speed decrease by a certain amount if this amount is not enough to reach the safe desired distance the speed will decrease again and will increase if distance detected increase there is a limit of speeds set for the PID to have as an output for example: if the cruise speed is Y then the limits for PID output will be from 0 to a value less than Y
  • 74. 62 Trial and error method Tuning method Trial and Error Method: It is a simple method of PID controller tuning. While system or controller is working, we can tune the controller. In this method, first we have to set Ki and Kd values to zero and increase proportional term (Kp) until system reaches to oscillating behavior. Once it is oscillating, adjust Ki (Integral term) so that oscillations stops and finally adjust D to get fast response. By following the previous steps using Arduino codes and Matlab to graph the performance of the dc motor, we obtained the values of kp, ki and kd kp=4, ki=0.02 and kd=0.01 4.6.6 Speed PID Theory of DC motor speed control The speed of a DC motor is directly proportional to the supply voltage, so if we reduce the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be achieved when the battery is fixed at 12 Volts? The speed controller works by varying the average voltage sent to the motor. It could do this by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A better way is to switch the motor's supply on and off very quickly. If the switching is fast enough, the motor doesn't notice it, it only notices the average effect. When you watch a film in the cinema, or the television, what you are actually seeing is a series of fixed pictures, which change rapidly enough that your eyes just see the average effect - movement. Your brain fills in the gaps to give an average effect. Now imagine a light bulb with a switch. When you close the switch, the bulb goes on and is at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts). Now if you close the switch for a fraction of a second, then open it for the same amount of time, the filament won't have time to cool down and heat up, and you will just get an average glow of 50 Watts. This is how lamp dimmers work, and the same principle is used by speed controllers to drive a motor. When the switch is closed, the motor sees 12 Volts, and when it is open it sees 0 Volts. If the switch is open for the same amount of time as it is closed, the motor will see an average of 6 Volts, and will run more slowly accordingly. As the amount of time that the voltage is on increases compared with the amount of time that it is off, the average speed of the motor increases. This on-off switching is performed by power MOSFETs. A MOSFET (Metal-Oxide- Semiconductor Field Effect Transistor) is a device that can turn very large currents on and off under the control of a low signal level voltage. The time that it takes a motor to speed up and slow down under switching conditions is dependent on the inertia of the rotor (basically how heavy it is), and how much friction and
  • 75. 63 load torque there is. The graph below shows the speed of a motor that is being turned on and off fairly slowly. Figure 4-9 On and off switching method of motor You can see that the average speed is around 150, although it varies quite a bit. If the supply voltage is switched fast enough, it won’t have time to change speed much, and the speed will be quite steady. This is the principle of switch mode speed control. Thus the speed is set by PWM – Pulse Width Modulation. Ziegler Nicholas tuning method Ziegler–Nichols Rules for Tuning PID Controllers. Ziegler and Nichols proposed rules for determining values of the proportional gain integral time and derivative time based on the transient response characteristics of a given plant. Such determination of the parameters of PID controllers or tuning of PID controllers can be made by engineers on-site by experiments on the plant. There are two methods called Ziegler–Nichols tuning rules: the first method and the second method First Method In the first method, we obtain experimentally the response of the plant to a unit-step input, as shown in Figure 4-10 .If the plant involves neither integrator(s) nor dominant complex- conjugate poles, then such a unit-step response curve may look S-shaped, as shown in Figure 4-11 .This method applies if the response to a step input exhibits an S-shaped curve. Such step-response curves may be generated experimentally or from a dynamic simulation of the plant. The S-shaped curve may be characterized by two constants, delay time L and time constant T. The delay time and time constant are determined by drawing a tangent line at the inflection point of the S-shaped curve and determining the intersections of the tangent line with the time axis and line c(t)=K, as shown in Figure 4-11 Figure 4-10 Unit-step response of a plant.
  • 76. 64 Figure 4-11 S-shaped response curve. The transfer function C(s)/U(s) may then be approximated by a first-order system with a transport lag as follows: Ziegler and Nichols suggested to set the values of and according to the formula The PID controller tuned by the first method of Ziegler–Nichols rules gives: Thus, the PID controller has a pole at the origin and double zeros at s=–1/L. Second Method. In the second method, we first set and Using the proportional control action only see Figure 4-12 increase Kp from 0 to a critical value Kcr at which the output first exhibits sustained oscillations.(If the output does not exhibit sustained oscillations for whatever value Kp may take, then this method does not apply.)