Upload
slmnsvn
View
89
Download
4
Embed Size (px)
Citation preview
[Smart car to reduce risks of accident]December 3, 2015
LIST OF CONTENTSLIST OF CONTENTS.................................................................................................................I
LIST OF TABLES......................................................................................................................I
LIST OF FIGURES..........................................................................................................IIIIIIIII
Acknowledgement................................................................................................................IIIIV
Disclaimer statement……………………………………………………………………….IIIIV
Abstract...............................................................................................................................IV
Introduction.........................................................................................................................1
Purpose.................................................................................................................................1
Specification...............................................................................................................................1
Modules................................................................................................................................2
Standards /Codes..................................................................................................................3
Elements and components .........................................................................................................4
Aorduino Uno.......................................................................................................................4
Ultrasonic Ranging Module..................................................................................................6
H-Bridge..................................................................................Error! Bookmark not defined.
Motor......................................................................................Error! Bookmark not defined.
Literature Review............................................................................................................12
Methodology..................................................................................................................14
Results and analysis..................................................................................................................15
Conclusion and future work................................................................................................22
Reference..................................................................................................................................23
Page I
[Smart car to reduce risks of accident]December 3, 2015
LIST OF TABLES
Table 1: properties of the arduino Uno 4Table 2: Ultrasonic Ranging Module HC - SR04 6Table 3:PWM, truth table 9Table 4: Prototype Main Elements Error! Bookmark not defined.Table 5: Estimated Prices 15
Page II
[Smart car to reduce risks of accident]December 3, 2015
LIST OF FIGURESFIGURE 1: FUNCTIONAL FLOW CHART 2FIGURE 2: ARDUINO UNO DESIGN 5FIGURE 3: ALTRASONIC MODULE 6FIGURE 4:TIMING DIAGRAM 7FIGURE 5: DATA SHEET OF L293D 9FIGURE 6 : SCHEMATICS OF INPUTS AND OUTPUTS (L293D) 9FIGURE 7: APPLICATION INFORMATION 9FIGURE 8: MOTOR RESPONS TO OBSTACLES 11FIGURE 9: MOTOR CONTROL FLOW CHART 11FIGURE 10: PICTURE1 13FIGURE 10: PICTURE2 13FIGURE 10: PREPARATION OF TRAFFIC ACCIDENTE 14FIGURE 11: DESIGN A PROJECT USING THE PROTEUS PROGRAM 16
Page III
[Smart car to reduce risks of accident]December 3, 2015
Acknowledgement
We extend our sincere thanks and gratitude to all who contributed and gave us a helping hand to complete the project from lecturers, colleagues and singled out Dr. Jamal Kharousheh who has been following the project step by step and give us tips and guide us to the right path to complete the project as fully as possible.
Disclaimer statementThis report was written by students at the Electrical Engineering Department, Faculty of Engineering, An-Najah National University. It has not been altered or corrected, other than editorial corrections, as a result of assessment and it may contain language as well as content errors. The views expressed in it together with any outcomes and recommendations are solely those of the students. An-Najah National University accepts no responsibility or liability for the consequences of this report being used for a purpose other than the purpose for which it was commissioned.
Page IV
[Smart car to reduce risks of accident]December 3, 2015
Abstract
We have designed this system to avoid the occurrence of side events and maintains a constant distance between the front of vehicles.This system utilizes ultrasonic sensors, and a LED indication panel.This system is will take the output of the ultrasonic sensor and then translated by microcontroller Arduino Uno feature ADC. The microcontroller takes the data, and selects the closest distance between the car and the obstacle that should be avoided.If the car needs to move, a signal with the obstacle location is then transmitted to the other systems. Once the location signals send out to the motor, it determines which lateral thrust needs to be applied. At the same time, LED panel tells the driver where the car is approaching the next obstacle. At this time, the operator has the option to either allow the Smart Car System to continue to control the bow thruster. Or to abort the use of the system and avoid the obstacle themselves.
Page V www.mot.gov.ps
[Smart car to reduce risks of accident]December 3, 2015
CHAPTER 1Introduction
1.1 Purpose
The main aims of an accident avoidance system are to avoid a loss of life and provide a safety mechanism for the driver. Avoidance accident is intended to be an installable safety system for existing cars that can aid the operator in avoiding hidden obstacles. It will take advantage of three ultrasonic sensors attached to the front corners of the car and attached at the middle that will scan the surface of the roads for obstacles such as street and bridge support and surpassing car. The three sensors will be able to cover a 180 degree area in front of the car. These sensors will transmit data to a motor controlling system that will operate a bow thruster in the front of the car. This thruster motor will be able to steer the front of the car in both the left and right directions and reducing the speed limit to avoid the obstacles seen by the sensor. Smart car will also implement an LED display that will warn the operator of the location of upcoming obstacles and give them the option to avoid it with his own control.
1.2 Specifications
The Smart car system has a few specifications that make it a valuable safety system for cars. The sensors have a detecting distance from 20cm to 25ft. This allows a detecting window that will give the system plenty of time to avoid any obstacles. The sensor to motor reaction time will be well under a second so that the system can be ready to avoid obstacles that the car may be approaching at realistic speeds.. Detection to the sides of the car is not necessary considering this area should be easily observed by the operator. Since the operator has control of the forward and backward movement of the car, the only obstacle avoiding movement that the Smart car system needs is lateral. This is achieved through the single bow thrusting motor under the front of the car. The operator will be alerted through their panel of all obstacles that the system sees as a threat and will then have the opportunity to stop the system’s response in order to have control without the system’s help.
Page 1 www.traffictechnologytoday.com/features.php?BlogID=300
[Smart car to reduce risks of accident]December 3, 2015
But this system is useful when the driver's loss control of the car and when the weather is fog.
1.3 Modules
Smart car consists of four separate modules that communicate with each other wirelessly. There are three ultrasonic sensor modules will connection with microcontroller. There are also two motor module that are made up of the thruster motor that gives the car lateral movement to avoid obstacles and an h-bridge motor control circuit that allows the motor to thrust both directions and control the speed. The last module is the operator’s panel. The panel has an array of LEDs in a semicircle arrangement that will illuminate the direction from which an obstacle is approaching the car. There is also a abort button that the operator can use if the Smart car system should be reset because the obstacle can be avoided without the system’s help. Our system’s flow can be shown in figure 1.3.1 below.
Figure 1.3.1: Functional Flow Chart
Page 2
Car move right
H- Bridge
Car move left
Car move (Closed distance)
Motor move left
Motor move right
Motor control Microcontroller
www.traffictechnologytoday.com/features.php?BlogID=300
[Smart car to reduce risks of accident]December 3, 2015
CHAPTER 2
Constraints
Throughout the semester, many obstacles would arise. The first was simulation did not work so we changed the code. Second the electronic component Combustion for any simple reason. Another uncertainty that the difficulty in finding a small car mimic the realism car
Standards
Some legal materials*Article (45) the preparation to skip:
May not be the commander of the vehicle over another vehicle or animal or an attempt to overcome only if the nuclear-weapon-free road just enough to enable him to override the continuation of travel safely without hampering the traffic
*Article (49) travel quickly to suit road conditions:
The commander of the vehicle driving the vehicle consistent road conditions, regulation defines the cases in which the driver of the vehicle speed relief where.
*Article (55) to give the reference:
The commander of the vehicle to give the necessary reference before the time is sufficient to alert the pedestrians and secure their vision of this reference, in the case of the necessary reference gives his hand.
Page 3
[Smart car to reduce risks of accident]December 3, 2015
*Article (186) dangerous driving on pavement:
1. No one may lead the vehicle; animals on the pavement, the conduct or for have been allocated to the education of a particular type of road users only for crossing to enter a patio, a garage or exit.
2. From Driving a vehicle-except mechanism bike regular or driving a tractor or slow vehicle to adhere to the right side of the road and proceed on their part if necessary to pave the way for vehicles from behind to cross.
Page 4
www.mot.gov.ps
[Smart car to reduce risks of accident]December 3, 2015
Chapter 3
Elements and component of project Choosing Components:Performing this task started by analyzing the system technical requirements. The following major components need to be purchased: • Microcontroller (Arduino Uno)• Ultrasonic Sensor• H-Bridge• Motors• LEDs
3.1 Arduino Uno
Arduino is an open-source prototyping platform based on easy-to-use hardware and software.
Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software .The properties of the Arduino Uno can show in the following table 3.1.a
ATmega328Microcontroller5VOperating Voltage7-12VInput Voltage (recommended)6-20VInput Voltage (limits)14 (of which 6 provide PWM output)Digital I/O Pins6Analog Input Pins40 mADC Current per I/O Pin50 mADC Current for 3.3V Pin32 KB of which 0.5 KB used byboot loader
Flash Memory
2 KBSRAM1 KBEEPROM
Page 5
www.mot.gov.ps
[Smart car to reduce risks of accident]December 3, 2015
16 MHzClock Speed
Table 3.1a
Page 6
www.arduino.cc
[Smart car to reduce risks of accident]December 3, 2015
Figure3.1a
3.2 Ultrasonic Ranging Module HC - SR04
Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit.
3.2.1 The basic principle of work:
(1) Using IO trigger for at least 10us high level signal.
(2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.
Page 7
www.arduino.cc
[Smart car to reduce risks of accident]December 3, 2015
(3) IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning. Test distance = (high level time*velocity of sound (340M/S)/2).
Wire connecting direct as following:
5V Supply Trigger Pulse Input Echo Pulse Output 0V Ground
3.2.2 Electric Parameter:Table 3.2a
Working Voltage DC 5 VWorking Current 15mAWorking Frequency 40HzMax Range 4mMin Range 2cmMeasuring Angle 15 degreeTrigger Input Signal 10uS TTL pulseEcho Output Signal Input TTL lever signal and the range in
proportionDimension 45*20*15mm
Figure 3.2a
3.2.3 Timing
diagram:
The Timing diagram is shown below in figure 3.2.3a. You only need to supply a short 10uS pulse to the trigger input to start the ranging, and then the module will send out an 8 cycle burst of ultrasound at 40 kHz and raise its echo. The Echo is a distance object that is pulse width and the range in proportion .You can calculate the range through the time interval between sending trigger signal and receiving echo signal. Formula: uS / 58 = centimeters or uS / 148 =inch; or:
The range = high level time * velocity (340M/S) / 2
Page 8
www.micropik.com/PDF/HCSR04.pdf
[Smart car to reduce risks of accident]December 3, 2015
We suggest to use over 60ms measurement cycle, in order to prevent trigger signal to the echo signal.
Figure 3.2.3a
Attention:
The module is not suggested to connect directly to electric, if connected electric, the GND terminal should be connected the module first, otherwise, it will affect the normal work of the module.
When tested objects, the range of area is not less than 0.5 square meters and the plane requests as smooth as possible, otherwise ,it will affect the results of measuring.
Page 9
www.micropik.com/PDF/HCSR04.pdf
[Smart car to reduce risks of accident]December 3, 2015
The HC-SR04 Ultrasonic Sensor is a very affordable proximity/distance sensor that has been used mainly for object avoidance in various smart car projects.
It essentially gives your Arduino eyes / special awareness and can prevent your car from crashing or falling off a table.
3.2.1 Description/ordering information
The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled, and their outputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled, and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full H (or bridge) reversible drive suitable for solenoid or motor applications.The L293D are characterized for operation from 0C to 70C.Figure 3.2.1
3.2.2 Schematics of inputs and outputs (L293D)
Page 10
www.ti.com/lit/ds/symlink/l293.pdf
www.datasheets360.com/l293d
[Smart car to reduce risks of accident]December 3, 2015
Figure 3.2.2a
3.2.3 Application information
Figure 3.2.3a Figure 3.2.3b
3.3 Motor Microcontroller and Logic
As stated above, the motor microcontroller is used to generate the PWM and direction signals for the h-bridge. We determined for simplicities sake that we would not change the PWM duty and therefore the motor speed. This still works well for our application because we really only need the motor to turn on in the right direction. Our circuit board for the motor control can be seen in Figure 3.2.3a .The logic that passes the PWM to the different drivers based on the desired direction is shown in truth table form
Page 11
www.datasheets360.com/l293d
[Smart car to reduce risks of accident]December 3, 2015
in Figure 3.2.3b. The microcontroller code works through the flow chart in Figure 3.3.2.4. This shows that depending on the position that a sensor is in when it is detecting a threatening obstacle and which sensor is detecting the obstacle, the motor can work in different directions to move the car away from the approaching obstacle. Figure 3.3.2.5 shows a simple graphical diagram of the motor’s response to different obstacles seen by the sensors to help clarify the motor control flow chart
Page 12
www.adafruit.com/product/1500
[Smart car to reduce risks of accident]December 3, 2015
CHAPTER 4
Literature Review
Fifty years after inventing the seatbelt, Volvo cars is still dedicating millions of research dollars with the aim to save lives and reduce injury. While the seatbelt still remains a massive life-saving device, its driver assistance technologies are a lot more intelligent.
The aim is that tomorrow’s cars should quite simply be able to avoid accidents. Many of today’s cars are already so intelligent that they alert the driver or even step in and brake the car to avoid an accident.
Drowsy drivers cause many accidents on roads the world over. Sometimes it may be difficult to ascertain if it is a tired driver who has caused an accident, so the true extent of the problem is largely hidden. What is clear, however, is that drowsy drivers are a large – and global – traffic safety problem.
Cars that predict accidents BEFORE they happen: Volvo system plots ‘escape routes’ to avoid crashes
Volvo claims its next-generation cars will be equipped with computers that have a 360-degree view of surroundings
If an accident is likely, the car can find an alternative route, brake or steer
The technology also plans movements up to five seconds in advance Volvo said it hopes to eliminate all road fatalities in its cars by 2020 Tesla today announced its lastest sedan will have a safety feature that
will move car over a lane when the driver uses turn signalAir bags, mirrors and sensors can only do so much to prevent deaths as a result of a dangerous driving.Now Volvo has developed a technology that, it claims, could eliminate road fatalities in its cars by 2020.
Page 13
www.adafruit.com/product/1500
[Smart car to reduce risks of accident]December 3, 2015
he Swedish group claims that by the end of the decade, its next-generation cars will be equipped with computers that have a 360-degree view of their surroundings.
Volvo claims that in a few years, its new cars will be equipped with computers that have a 360-degree view of their surroundings. If an accident is likely, the system will allow the car to find an ‘escape route’, brake automatically or steer the car to avoid a crash. The firm aims to end driving fatalities from Volvo cars by 2020
The technology pictured was developed by Volvo’s four-year Non-Hit Car and Truck Project
Page 14
http://www.dailymail.co.uk/sciencetech/article-2787992/cars-predict-accidents-happen-volvo-
plots-escape-routes-avoid-crashes.html
[Smart car to reduce risks of accident]December 3, 2015
Chapter 5:
Methodology
Incidents have become traffic represents a worrying and concern for all members of society, and became one of the most important problems that drain material resources and human potential and target communities in the most important elements of life and which is the human element, in addition to the loss of social problems and psychological and huge material losses, which has become necessary to work on finding solutions and suggestions and implemented to reduce these incidents or at least their causes and mitigate its negative effects. We at the outset a search for the most important causes of accidents and the most dangerous to discover that lost control of the vehicle driver leads to more incidents, the following chart illustrates the preparation of traffic accidents on the roads as the governorate during 2014
It is in this section we decided to address the problem through the creation of the design helps us to control the vehicle in the case of the driver lost control of the vehicle, we have found the design simulates this command and then we started research and analysis of the parts needed to its styles of work and proportionality of the performance of its functions, to sure that we can obtain them, and then we started the work of the design of the
Page 15
http://www.dailymail.co.uk/sciencetech/article-2787992/cars-predict-accidents-happen-volvo-
plots-escape-routes-avoid-crashes.html
www.mot.gov.ps
[Smart car to reduce risks of accident]December 3, 2015
Chamber order through the Brutus program we also write code using arduio program and not remain only apply in practice.
After that we have the application of practical design so we bought the necessary parts and after that we install the vehicle and processed. We have experienced many of the problems we have been able to overcome them.
Chapter 6:
Results and analysis
After hard studying, the following main elements for smart car will be used in the hardware prototype:
Ropot Car -Motors DC MotorMicrocontroller Arduino aunoBatteres 12VAltra sonic sensor HCS04H-Bridge L293Table 6.a: Prototype Main Elements
The important part should be studied is the economic part, to have a vision about the market.
Estimated prices:Description Estimated priceRopot Car 30 $Two Motors 10 $Batteres 5 $Altra sonic sensor 20 $H-Bridge 20 $Microcontroller 15 $Other equipment 10 $Total expected price 110 $Table 6.b: Estimated Prices
Page 16
[Smart car to reduce risks of accident]December 3, 2015
We also got to work designing a project using the proteus program, figure 6.1 shown our design:
Figure 6.1
Writing the code by using Arduino program, as show in below:
#include <NewPing.h>
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400cm-500cm.
// motor one
int enA =4;
int MC1 =6;
int MC2 =7;
Page 17
www.matni.com
[Smart car to reduce risks of accident]December 3, 2015
// motor two
int enB = 5;
int in3 = 2;
int in4 =3;
double lift;
double right;
double center;
#define SONAR_NUM 3 // Number of sensors.
#define MAX_DISTANCE 400 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).
unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM]; // Where the ping distances are stored.
uint8_t currentSensor = 0; // Keeps track of which sensor is active.
NewPing sonar[SONAR_NUM] = { // Sensor object array.
NewPing(8, 9, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
NewPing(11, 10, MAX_DISTANCE),
NewPing(12, 13, MAX_DISTANCE)
};
Page 18
Book: Get started with Arduino
brutus.en.softonic.com
[Smart car to reduce risks of accident]December 3, 2015
int val=0;
int velocity=5;
void forward(int rate)
{
digitalWrite(enA,LOW);
digitalWrite(MC1,HIGH);
digitalWrite(MC2,LOW);
analogWrite(enA,rate);
}
void reverse(int rate)
{
digitalWrite(enA,LOW);
digitalWrite(MC1,LOW);
digitalWrite(MC2,HIGH);
analogWrite(enA,rate);
}
void brake()
{
digitalWrite(enA,LOW);
digitalWrite(MC1,LOW);
digitalWrite(MC2,LOW);
digitalWrite(enA,HIGH);
}
Page 19
Book: Get started with Arduino
[Smart car to reduce risks of accident]December 3, 2015
void setup() {
// put your setup code here, to run once:
pinMode(MC1,OUTPUT);
pinMode(MC2,OUTPUT);
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
Serial.begin(115200);
pingTimer[0] = millis() + 75; // First ping starts at 75ms, gives time for the Arduino to chill before starting.
for (uint8_t i = 1; i < SONAR_NUM; i++) // Set the starting time for each sensor.
pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;
}
void loop() {
for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.
if (millis() >= pingTimer[i]) { // Is it this sensor's time to ping?
pingTimer[i] += PING_INTERVAL * SONAR_NUM; // Set next time this sensor will be pinged.
if (i==0 && currentSensor==SONAR_NUM- 1) oneSensorCycle(); // Sensor ping cycle complete, do something with the results.
Page 20
www.arduino.cc
[Smart car to reduce risks of accident]December 3, 2015
sonar[currentSensor].timer_stop(); // Make sure previous timer is canceled before starting a new ping (insurance).
currentSensor = i; // Sensor being accessed.
cm[currentSensor] = 0; // Make distance zero in case there's no ping echo for this sensor.
sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
}
}
}
void echoCheck() { // If ping received, set the sensor distance to array.
if (sonar[currentSensor].check_timer())
cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
}
void oneSensorCycle() {
lift=cm[0];
right=cm[1];
center=cm[2];
if(lift<200 && right<200 &¢er<200 )
brake();
else if (lift>right){
Page 21
Book: Get started with Arduino
[Smart car to reduce risks of accident]December 3, 2015
if(right<200){
reverse(velocity);
}
}
else if (right>lift){
if(lift<200){
forward(velocity);
}
}
else if(center<200){
for(int velocity = 255 ; velocity >= 0; velocity -=5){
analogWrite(enB,velocity );
delay(5);
}
}
Serial.println();
}
Page 22
Book: Get started with Arduino
[Smart car to reduce risks of accident]December 3, 2015
In the latter part of the project, the stage of the work of the model simulates the reality of the project as shown in the attached image:
This model has achieved the desired objectives of the project so that the vehicle had been able to avoid the obstacles side and reduce speed front Obstacle.
Page 23
Book: Get started with Arduino
[Smart car to reduce risks of accident]December 3, 2015
Chapter 7:
CONCLUSION AND FUTURE WORKReduce accidents is a global goal that every country seeks to achieve. So we design smart car, we sought through design to reduce the most dangerous and the most frequent accidents! So we tried to underestimate the impact of two types of accidents, first when vehicle deviation from the road and the other case when lack of vision on the road. The probability of success of the system in the return of the vehicle back on track, depend on the vehicle speed and the speed of system response ,therefore, the system will help reduce accidents or reduce the impact of the incident , finally the system got a high efficiency.
Page 24
[Smart car to reduce risks of accident]December 3, 2015
References
Ministry of Transport and Communications - the Supreme Council for passage. Traffic accidents on roads in the West Bank in 2014
- Palestine Ramallah.
All correspondence should be addressed to:
Ministry of transportation
PO Box 399, Ramallah Palestine
Telefax: (970/972) 2241 3844
Website: www.mot.gov.ps
E-mail: [email protected]
https://www.arduino.cc/ Tech Support: [email protected] www.Elecfreaks.com International Journal of Scientific and Research Publications, Volume 3,
Issue 7, July 2013 ISSN 2250-3153
American Journal of Engineering Research (AJER) e-ISSN : 2320-0847 p-ISSN : 2320-0936 Volume-02, Issue-10, pp-92-99
http://www.traffictechnologytoday.com/features.php?BlogID=300 http://www.dailymail.co.uk/sciencetech/article-2787992/cars-predict-
accidents-happen-volvo-plots-escape-routes-avoid-crashes.html
Page 25