Every technology can be understood and recreated by anyone once they are clear with its
fundamental operation. One such technology I am going to deal with is the Autonomous
vehicle/Robot. Most of the beginners think (as I did when I was a beginner) that only master
minded Engineers and Scientists can develop a Robot or Vehicle that can move
autonomously( like this). Well, that is true if one is expecting 99% accuracy in operation of that
vehicle. But with lesser accuracy and with better knowledge in vehicle control mechanism, one
can build their own Autonomous vehicle. So, here, I will be explaining how to make your own
simple Autonomous vehicle.
Let us first consider an ordinary vehicle. The vehicle control mechanism involves
increasing/decreasing the vehicle`s speed, braking and steering. The steering and motion of the
vehicle is normally controlled by the user who makes decision based on the vehicle`s
environment, whereas in case of an Autonomous vehicle there will be no user interaction, except
for the marking of the destination point that the vehicle must reach. Therefore, suitable sensors
must replace the human user.
The following pictures depict the functioning of an ordinary vehicle with a human user on it and
an Autonomous vehicle with sensors and processor.
To keep it simple, I
am considering an
autonomous
vehicle
with
following
specifications,
Obstacle
detection
using
proximity sensor
Navigation using GPS
Battery powered vehicle(control using PWM and Relay drives)
Differential drive(skid steer)
Of course, if you are familiar with image/signal processing you can use camera, LIDAR/RADAR
for obstacle sensing. Since this explanation is for beginners, I am not considering the on road rules
detection and path determination as it makes things more complicated.
For clear understanding, the vehicle construction is explained in 4 steps as follows,
1.Vehicle control
mechanism:
Before designing
the vehicle control
mechanism
one
must be aware of
the
maximum
payload of that
vehicle based on
which the components can be picked up.
There are two ways by which the vehicle can be controlled
1.
Fixed speed control
2.
Variable speed control
In fixed speed control, the vehicle can be either moved(with a constant speed) or stopped. A
simple relay logic controller is enough to perform this type of control. You can either build your
own relay based controller for your vehicle or else you can buy a relay shield to control the
vehicle motors from the micro controller. Below shown is the relay based motor shield and
Arduino MCU.
Check for the motor driver`s data sheet whether the current rating of the motors used falls within
the range of the driver being used or else you will end up frying the driver on continuous usage.
The following picture shows the sample connection between the relay driver and the
microcontroller,
However, this configuration works fine only for few trials and causes permanent damage to the
transistor on prolonged usage. The reason is that, the transistor stays in linear region for a long
time before it reaches the saturation region. Thus the performance of the MOSFET never reaches
its optimum point which leads to over heating of the MOSFET and you will end up frying the
MOSFET(as I did) on further usage.
For
better
understanding, the
linear
and
saturation region of
a transistor can be
compared
to
a
human sprinting and jogging respectively. One cannot sprint for a long time since he deprives of
energy while he can jog for a long time. And thats why the MOSFET gets damaged with direct
TTL output. In order to avoid this problem, a buffer can be added between the TTL output and the
gate to improve the MOSFET`s switching performance by decreasing the rise and fall
timings(which provided faster current sourcing and sinking). TTL output with buffer is shown
below,
Here,
the
optocoupler and the
diode is used for
protection purpose.
R3 resistor(resistor
connected
to
ground) is to assist
transistor turn OFF.
R4 resistor( resistor connected to 3rd terminal of optocoupler) must be low in order to avoid
positive feedback(which creates oscillations) and to obtain better transistor switching speed. Its
value can be calculated using the formula,
R= rise or fall time/ 2.2Ciss
Ciss is the sum of capacitors from gate to drain and gate to source(this value can be obtained from
the MOSFET data sheet). Also keep in mind that, in CMOS configuration, the Vgate must be plus
5V higher than the Vcc to prevent damage against the MOSFET used.
Multiple motors can be controlled with the same circuit as shown below,
2.Obstacle
detection:
As I mentioned
already, there are
several ways of
detecting obstacles
in robotics. To keep
it as simple as
possible
for
beginners, I consider the ultrasonic proximity sensor(for eg: HC SR04). You can google for
Arduino interface code for the sensor module and the connection is shown below,
The
obstacle
sensing range can
be set as you wish
and the sensor can
be mounted over a
servo motor to get
180 degree field of
view. Dont forget
to use a pull up
resistor to avoid garbage values in the sensor readings. Also provide enough delay time in the
servo sweep so that the echo pulse can reach the receiver completely.
Now, we have a developed an obstacle sensing mechanism and we already know how to control
the vehicle manually. Now all we have to do is to combine both the methods.
3.
Manipulating
the vehicle based
on
obstacle
detected:
Lets consider the
maximum range of
the sensor is 4
meters
and
anything
within
2meters
is
considered as obstacle. The following algorithm can be used to control the vehicle based on the
sensor reading,
Function name()
{
Read sensor value;
If (value>2meter)
Move forward
Else
Activate servo and scan for obstacles in left and right side of vehicle
If (more space in left than in right)
Move left
Else
Move right
} // continue loop
This algorithm detects the obstacle and manipulates the vehicle based on the sensor values. And
the resultant vehicle will be an obstacle avoiding vehicle(with no motive, i.e, it moves randomly
avoiding obstacles)
Go to this link to see the control of DC motors based on the obstacles sensed by an IR proximity
sensor and also check this link in which the sensor is mounted on a servo motor and the above
algorithm is implemented in it.
4.
GPS
based
navigation:
The
components
required for this
purpose are the
GPS receiver/shield
and a compass.
Using
the
Haversine formula, the distance from the source to destination point can be calculated. Since the
distance is calculated in straight lines, way points must be declared in case of destination points
other than straight lines.
Below shown is the schematic of the Arduino GPS shield, tiny GPS function can be uploaded to
the Arduino MCU to obtain the NMEA strings and make sure the jumpers are placed in the right
position.
click here to learn
more
about
Arduino and GPS