Professional Documents
Culture Documents
Safety-Automation of Cars Using Embedded Microcontrollers: Abhinav Ray Varun Kumar
Safety-Automation of Cars Using Embedded Microcontrollers: Abhinav Ray Varun Kumar
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE
side of the car as shown in the circuit diagram are fired systems of the car namely, the braking, steering and
with a voltage pulse simultaneously. Internal timers of acceleration systems.
the microcontrollers (MCf, MCre, MCl, MCr) are used
and enabled at this point of time. Appropriate clock
frequency is chosen for the timer. The receiver
transducer closest to the obstacle will be the first to
generate a voltage pulse. This voltage pulse passes
through the AND gate and disables the timer and the
time span is stored in a register. The AND gates are
then disabled by their respective peripheral
microcontrollers as soon as the voltage pulse is
received by them. Depending upon the transmitter
voltage the velocity of the ultrasound is calculated.
Using the time span calculated by the timers the
instantaneous relative distance is found out using
simple kinematics equations. The AND gates were
disabled because further interruptions by the other
receiver signals while microcontroller calculation
would result in interrupt signals generated by far off
obstacles which are not of concern. As soon as the four
microcontrollers finishes off the relative distance
calculation the AND gates and the timers are enabled
again. Using the same procedure instantaneous relative
distance is calculated again. The difference of the two
relative distances is calculated and is then divided by
time span between their changes. A separate timer of
the microcontroller can be used to calculate this time
span. This gives the relative velocity of the designed
car with respect to the obstacles. The instantaneous
Figure 1. The basic circuit
relative distance at that point is divided by the
instantaneous relative velocity. This gives the collision
TT: Ultrasound transmitter
time. Identical operations are performed by the four
microcontrollers (MCf, MCre, MCl, MCr) and &: AND gate
collision times of the front (Tfront), rear (Trear), left MCf: Microcontroller for front collision time
(Tleft) and the right (Tright) are calculated and sent to (Tfront) calculation
an 8:1 multiplexer with three select lines. The MCre: Microcontroller for rear collision time
multiplexer is connected to the central microcontroller (Trear) calculation
which selects the appropriate time of collision MCl: Microcontroller for left collision time (Tleft)
according to the need of the algorithm. The calculation
microcontrollers MCbr, MClt, MCrt are fed with MCr: Microcontroller for right collision time
appropriate steps for which the stepper motors (Tright) calculation
interfaced to the braking, acceleration and the steering MCbr: Microcontroller for braking stability and
system have to rotate to ensure stability conditions at critical braking time (Ts1) calculation
various velocities of the car. The microcontroller MCa MClt: Microcontroller for left turn stability and
is fed with the time required for the car to accelerate to critical left turn time (Ts2) calculation
maximum velocity at maximum acceleration MCrt: Microcontroller for right turn stability and
maintaining the stability conditions of the car. The critical right turn time (Ts3) calculation
tachometer of the car feeds the instantaneous velocity MCa: Microcontroller to find the critical time
to the microcontrollers (MCbr, MClt, MCrt) so that (Ts4) required to accelerate to maximum velocity
appropriate steps of the stepper motor are chosen for at maximum acceleration maintaining stability
braking, accelerating and steering. The central conditions
microcontroller is then interfaced to stepper motors MUX: Multiplexer (8:1)
which control the mechanical Sl: Select lines for the multiplexer
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE
2.2. Calculations performed by the compared with. First Trear is compared with 2Ts4. If
microcontrollers for braking, steering and Trear is less than 2Ts4 the driver is alerted by a beep
acceleration sound. If the driver does not take suitable action and
Trear becomes less than Ts4 control is taken by the
MBr Feeds the magnitude of stepper motor central microcontroller and suitable action is taken as
rotation for the braking system to the main described in the algorithm.
microcontroller depending upon the velocity ranges of
the car to maintain stability conditions. It also 3. Inferences
calculates the amount of time (Ts1) taken by the car to
avoid collision depending upon the instantaneous The collision times are updated after finite instances
velocity and the braking power of the car at that of time. This time depends upon the obstacle relative
particular velocity. Ts1 is the reference time by which distance. Lower the obstacle distance higher the
the collision time of front side (Tfront) is compared frequency of collision time calculation which in turn
with. First Tfront is compared with 2Ts1. If Tfront is makes the system more accurate. The frequency of
less than 2Ts1 the driver is alerted by a beep sound. If collision time calculation is in order of kilohertz for
the driver does not take suitable action and Tfront close proximity distances. It can be thus inferred that
becomes less than Ts1 control is taken by the central the simple kinematics equations used for the collision
microcontroller and suitable action is taken as time calculation behave like differential equations.
described in the algorithm. The calculation of relative distance, velocity and
MClt Feeds the magnitude of stepper motor acceleration needs one, two and four pulses
rotation for the steering system to rotate left according respectively to the transmitter ultrasound crystal. It is
to the instantaneous velocity of the car to maintain the thus inferred that if the error in the calculation of
stability of the car. It also calculates the amount of time relative distance is E, then the corresponding errors in
(Ts2) taken by the car to avoid collision depending the calculation of relative velocity and acceleration
upon the instantaneous velocity of the car and the will be 2E and 4E respectively. Therefore errors
length to be traveled on the left. Ts2 is the reference increase in geometric progression with every increase
time by which the collision time of left side (Tleft) is in the derivative of distance calculation. Therefore in
compared with. First Tleft is compared with 2Ts2. If this system the calculation has been carried out till the
Tleft is less than 2Ts2 the driver is alerted by a beep first derivative i.e. the relative velocity to obtain the
sound. If the driver does not take suitable action and collision time.
Tleft becomes less than Ts2 control is taken by the
central microcontroller and suitable action is taken as 4. Error Sources and their compensation
described in the algorithm.
MCrt Feeds the magnitude of the stepper motor The speed of the ultrasound in air varies with
for the steering system to rotate right according to the temperature and humidity. Therefore at varying
instantaneous velocity of the car to maintain the temperatures and humidity the collision times of
stability of the car. It calculates the amount of time different magnitudes will be obtained for a particular
(Ts3) taken by the car to avoid collision depending condition. To eliminate this error a suitable standard
upon the instantaneous velocity of the car and the reference temperature and humidity can be chosen for
length to be traveled on the right. Ts3 is the reference which the ultrasound velocity is known. A
time by which the collision time of right side (Tright) compensation table for the ultrasound velocity can then
is compared with. First Tright is compared with 2Ts3. be prepared for various temperatures and humidity.
If Tright is less than 2Ts3 the driver is alerted by a
beep sound. If the driver does not take suitable action The inherent voltage-sound conversion times for the
and Tright becomes less than Ts3 control is taken by ultrasound crystals might cause negligible errors. This
the central microcontroller and suitable action is taken is usually in order of microseconds. This error can be
as described in the algorithm. removed by feeding the conversion time to the
MCa -- Microcontroller to find the critical time microcontroller and subtracting it from the obtained
(Ts4) required for accelerating to the maximum collision time.
velocity at maximum acceleration maintaining the Propagation times of AND gates and the
stability conditions of the car. Ts4 is the reference time multiplexers are generally in order of nanoseconds
by which the collision time of rear side (Trear) is which cause infinitesimally small errors. Removal of
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE
this error is not required for practical conditions. Step 3:
Calculation time of the microcontrollers will be in a) Take in the time of collision Tleft from the
order of microseconds. Use of fast microcontrollers microcontroller MCl
and subtraction of the calculation time from the b) Take in the variable maximum stable angle theta
collision time will eliminate this error. Use of for right turn from MCrt
microcontrollers with more than 10 MHz clock c) Take in the time (Ts3) required to travel (at most)
frequency will result in error in order of 10^-4 sec. For the length of the car at that velocity and at the
practical situations this error would be insignificant. maximum angle theta from MCrt
d) Compare the time of collision (Tleft) with 2*Ts3
5. Algorithm fed to the e) If collision time (Tleft) is greater than or equal to
central microcontroller 2*Ts3, go to step 1
f) Else compare the time of collision (Tleft) with Ts3
Step 1: Call check front subroutine g) If time of collision (Tleft) is greater than Ts3, beep
a) Take in the time of collision (Trear) of the rear side and go to Step 3(a)
from MCre h) Else call turn right routine to take a right turn so
b) Take in the minimum time (Ts4) taken to that the time of collision (Tleft) increases to at least
accelerate at the front from MCa, minimum time (Ts3) 2*Ts3 or till the angle of rotation of the car becomes
to take a stable left turn from MClt and minimum time equal to theta, which ever comes first
(Ts2) to take a stable right turn from MCrt i) Go to step 1
c) Compare the three time quantities and choose the 5.1. Algorithms for the subroutines
smallest (Ts)
d) Compare collision time (Trear) with 2*Ts 1. CHECK FRONT:
e) If collision time (Trear) is more than or equal to a) Take the time of collision Tfront for the front side
2*Ts, go to Step 2 from the microcontroller Mf
f) Else compare collision time (Trear) with Ts b) Take in the time for stable braking Ts1 at that
g) If collision time (Trear) is Greater than or equal to velocity of the car from the microcontroller Mbr
Ts, beep and go to step 1(a) c) Compare Tfront with 2Ts1, If Tfront >2Ts1,
h) Else call turn left routine or turn right routine or Return
accelerate routine, which ever fits according to step d) Else beep once and compare Tfront with Ts1, if
1(b). Tfront>Ts1, Go to Step b
i) Go to step 2 e) Else call brake subroutine
f) Return
Step 2:
a) Take in the time of collision Tright from the 2. BRAKE:
microcontroller MCr a) Take in the amount of rotation of the stepper motor
b) Take in the variable maximum stable angle theta from MCbr so that the car is stable at that speed while
for left turn from MClt braking
c) Take in the time (Ts2) required to travel (at most) b) Take in the minimum time (Ts1) required to brake
the length of the car at that velocity and at the the car at that velocity from MCbr
maximum angle theta obtained from MClt c) Take in the time of collision of the front (Tfront)
d) Compare the time of collision (Tright) with 2*Ts2 from MCf
e) If collision time (Tright) is greater than or equal to d) Rotate stepper motor till the collision time Tfront
2*Ts2, go to step 3 becomes equal to 2*Ts1 or till the motor is rotated to
f) Else compare the time of collision (Tright) with Ts2 that angle, which ever comes first
g) If time of collision (Tright) is greater than Ts2, e) Return
beep and go to Step 2(a)
h) Else call turn left routine to take a left turn so that 3. TURN LEFT:
the time of collision (Tright) increases to at least 2*Ts2 a) Take in the maximum angle theta at which the car
or till the angle of rotation of the car becomes equal to can take a stable left turn from MClt
theta, which ever comes first b) Take in the time of collision (Tright) of the right
i) Go to step 3 side from MCr
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE
c) Take in the minimum time (Ts2) required for the car 6. The outline of the program fed to the
to travel the at most the length of the car to the left at
that angle from MClt
central microcontroller
d) Rotate the motor to the right one step, call check
front routine (we cant continue to turn left if there are
cars at the front during the left turn)
e) Rotate stepper motor till right collision time Tright STEP 1
becomes equal to 2*Ts2 or till the motor is rotated to CHECK
that angle, which ever comes first CHECK FRONT
f) Return REAR
4. TURN RIGHT:
a) Take in the maximum angle theta at which the car BRAKE
can take a stable right turn from MCrt
b) Take in the time of collision (Tleft) of the left side
from MCl. STEP 2
c) Take in the minimum time (Ts3) required for the car ACCELE-
to travel the at most the length of the car to the right at CHECK RATE
that angle from MCrt RIGHT
d) Rotate the motor to the left one step, call check FRONT
front routine (we cant continue to turn right if there
are cars at the front during the right turn)
e) Rotate stepper motor till left collision time Tleft TURN
becomes equal to 2*Ts3 or till the motor is rotated to LEFT
that angle, which ever comes first
f) Return STEP 3
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE
turn left or turn right subroutines, depending on the
required action to be taken.
5. Step 2 basically checks the right side of the car and
might call the turn left routine (responsible for rotation
of the motor in turn controlling the braking,
acceleration and steering systems) and/or the check
front routine, if a need arises
6. Step 3 checks the left side of the car and calls the
check front and/or turn right routine if required.
In normal hydraulic braking systems, the brake In the modified steering system, a stepper motor
pedal is pushed by the driver, in turn pulling the (within a gear system) is rotated by the central
pistons (inside the master cylinder) to the right, away microcontroller to turn the steering shaft left or right
from the openings, thereby releasing hydraulic fluid artificially as per the algorithm. The rotation of the
into the brake shoes causing the brakes to be applied. stepper motor depends upon the velocity of the car,
taking stability conditions under consideration.
8. Conclusion
Proceedings of the 2005 International Conference on Computational Intelligence for Modelling, Control and Automation, and International Conference on
Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC05)
0-7695-2504-0/05 $20.00 2005 IEEE