You are on page 1of 8

AUTONOMOUS SCALE VEHICLES FOR ROAD

TRACKING AND OBSTACLE AVOIDANCE


Cristopher Barreto, Andrés Chamba, Alejandro Gálvez, Erick Rodas, Kevin Serpa, Luis Zurita
Analog and Digital Electronic – Automotive Engineer
Universidad Politécnica Salesiana
Cuenca – Ecuador
cbarretoc2@est.ups.edu.ec, cchambal@est.ups.edu.ec,
agalvezr@est.ups.edu.ec,erodas@est.ups.edu.ec,kserpa@est.ups.edu.ec, lzuritam2@est.ups.edu.ec

ABSTRACT 1. OBJECTIVES
In this article, we present the development of a scale vehicle that General Objective
follows a track and is able to avoid obstacles that may arise
during the course of the track. This project is carryout in order Develop an autonomous vehicle at scale capable of following a
to demonstrate the operation of a normal vehicle, but this path and at the same time avoid obstacles that can be presented
vehicle is made in scale with the help of analog and digital on the track.
electronics. Specific Objectives
For the development of this vehicle several programming  Design and build the body of a vehicle to scale with
software’s are used that allow the generation of algorithms that
their respective measures to be later implemented in
are in charge of the correct operation of the vehicle, in regard to
the chassis that covers all electronic components.
programming, several software are used among them: Arduino,
LabView and Proteus.  Analyze and identify the operation of each of the
components that can be used for vehicle programming.
With respect to the Arduino software, it is the program in which  Perform the programming of each of the vehicle
the programming and the generation of algorithms are carried components through the Arduino software.
out in order to achieve that the vehicle at scale complies with  Implement a PCB board developed with the Proteus
the objectives proposed in the beginning.
Software throughout the vehicle circuit.
In the LabView software, the programming is in a graphical way  Develop the respective programming in LabView with
that allows to see the information that the vehicle receives and the help of Arduino to be able to observe all the
sends through the Arduino software. To carry out the information received and issued by the vehicle.
communication between the LabView and Arduino software, a  Verify that the vehicle at scale works in the same way
Bluetooth is used and this is done so that the lights of the vehicle as a daily vehicle when dodging obstacles or following
can be turned on or off at scale from the computer or computer. an established route.
Regarding the Proteus software, it is essential to design and
simulate the circuit, in the same way for the PCB board 2. INTRODUCTION
development.
The use of electronic today has become a fundamental pillar for
The vehicle is made to scale and for that reason, it must be vehicle manufacturers worldwide, as electronics facilitate and
designed and built with the measures that have been proposed automate movements that were made manually several years
and for its construction has been chosen to use automotive putty. ago. Vehicle manufacturers are committed to electronics and
provide a better product to their customers and what better than
providing the greatest possible comfort to have in the vehicle
that all its operation is automatic.
Keywords:
The use of electronic components in the automotive sector has
Autonomous, Electronic, Scale, Programming, Vehicle. contributed much to both the design and the development of
vehicles.
The electronics have been evolving a lot with the passing of
time and especially in the automotive sector since it has gone
from small sensors to autonomous vehicles, this has been
evolving due to the need of each of the vehicle manufacturers to
become the market leader. These vehicles may cost a large
amount of money; however, everything is due to the functions
and elements of the vehicle ranging from security systems to
intelligent systems.

Electronics has changed everything and this is because it is


capable of automating any type of process or product; the
automotive factories use electronics a lot both in their factory
and in the vehicles they manufacture, since electronics make
work easier and can produce products in less time.

A vehicle capable of following a route or path and at the same


time able to avoid obstacles can be of great help at the moment
of wanting to implement in a factory so that all the transport that Figure 2. Body design. [Authors]
needs to be done by the autonomous vehicle and thus avoid
losses of time or unnecessary movements in the production ELECTRONIC COMPONENTS
lines. In the same way you can establish a road or route and
while the vehicle goes through the route this is able to do some For the elaboration of the scale vehicle, it must be taken into
function in your journey, for this reason today this technology account that it is necessary to use several sensors and electronic
can be very useful for people. elements, such as:

 Arduino Mega
3. DEVELOPMENT  Shield Motor
BODY DESIGN  Sharp sensor
 QTR – 8a sensor
For the development of the body has been choose to take as a
 Integrated 555
reference a truck DAKAR competition. (Figure 1)
 Bluetooth HC – 05
 Lights, Protboard cables, etc.

Each of these elements that are part of the scale vehicle come to
fulfill a specific function within the programming of the vehicle
and for this reason it is necessary to use each of these in an ideal
position on the chassis of the vehicle.

Figure 1. Model for the design.

Once selected the model proceeds to the construction of the


proposed design, for the construction of the body has been
decided to use:

 Automotive putty
 Fiberglass
 Tape
 Painting

The result of the body can be seen in the following figure.


(Figure 2) Figure 3. Electronic components. [Authors]
PROGRAMMING IN ARDUINO

The use of the Arduino software is fundamental for the


development of the autonomous vehicle at scale since it allows
the programming of the sensors and various electronic elements
that are part of the vehicle. With regard to programming, several
algorithms and variables are used to perform each of the
functions that the cart must do, these functions can be:

 Advance or Rewind
 Perform movements (Turn Right - Turn Left)
 Turn on and off operating lights
 Avoid obstacles

The complete programming enhanced in the Arduino software


can be seen in Annexes (Annex 1)

In the same way, Arduino is used to communicate with


LabView, since in Arduino, the variables are declared and the
programming is performed so that LabView receives the data
generated by the vehicle at scale through the Arduino board.

Figure 5. Avoid programing made in Arduino. [Authors]

In the image you can see the programming to avoid the obstacles
that appear in the track, you have to turn both the left and the
right will only work the engines on the opposite side to the turn,
this can be done by modifying each of the speeds of the
respective motors. (Figure 5)

CIRCUIT DESIGN IN PROTEUS

The use of Proteus for the elaboration of the scale vehicle is


fundamental since in this software a circuit was designed that
later has been printed to be able to implement it in the vehicle.
The circuit made in this software allows the correct operation of
the directional lights since, the circuit has been designed to
make the function of providing intermittence to the directional
lights.

The circuit design can be seen in the following figure. (Figure


6)

Figure 4. Distance range programing in Arduino. [Authors]

In the image, you can see the programming of the distance range
that the cart will detect in order to avoid obstacles that may
appear in the path of the track. (Figure 4) This distance can be
modified according to the track that has been proposed so that
the vehicle can function in the best possible way.

Figure 6. Circuit design. [Authors]


The PCB Board can be seen in the following figure. (Figure 7) Because the vehicles have their respective lights and since the
scale vehicle has lights both in the front and rear, we see the
needed to turn these lights on and off through the Labview
software. For that reason it has been programmed to be able to
carry out this operation with the help of some pulsars that when
pressed will send information through a Bluetooth device

LabView has two diagrams, in the block diagram the respective


programming is generated while in the front panel the acquired
data can be observed.

The programming done in LabView is in the block diagram and


can be seen in the following figure. (Figure 9)

Figure 7. PCB Board. [Authors]

PROGRAMMING IN LABVIEW

Regarding the LabView software, it is necessary to first


communicate with the Arduino software, which will send the
information to LabView. For this programming, the necessary Figure 9. Block diagram of the programming. [Authors]
variables must be declared to generate the algorithm that allows
get the information. The data obtained from the vehicle can be seen on the front
panel and is shown in the following figure. (Figure 10)
First of all, LabView software works on the block diagram to
generate the appropriate programming that allows the reading
of data and then the interpretation of these to be visible in a
better way.

In the same way you have a program that allows you to see the
distance to which the next obstacle is located, therefore, for this
you must work on the data generated by the Sharp sensor. This
is done in order to be able to visualize the approach of the
vehicle with respect to the obstacles that appear in the track.

Figure 10. Front panel of the programming. [Authors]

VEHICLE OPERATION

The scale vehicle must perform the same functions as a normal


vehicle, and for this reason, the vehicle has been programmed
to work in the same way. The principle of operation is the same
as the vehicle can move forward or backward, in the same way
must make turns both for the right and left and when making
these turns must turn the respective directional lights. The
vehicle to scale has its respective lights as a normal vehicle and
work in the same way because at the time of lack of visibility
will turn on the lights or cas or otherwise turn off.
Figure 8. Distance to avoid the obstacle. [Authors]
For the scale vehicle to work properly, several steps must be 5. BIBLIOGRAPHY
followed:

 It is verified that all the cables are connected both to Symbaloo


the Arduino and to the different components of the https://www.symbaloo.com/mix/electronica18
vehicle, such as: sensors, motors, Bluetooth, etc.

 Proceed to load the Arduino software programming on


the board.

 Perform the communication of the Arduino software


with the LabView software with the help of the
Bluetooth device.

 Proceed to turn on the cart and place it in the exit


position, here the QTR-8A sensor acts, which guides
the cart through the road.

 Check the correct operation of the vehicle; this can be


done with the help of the program made in LabView.

4. CONCLUSIONS

 The development of the scale vehicle has made it


possible to put into practice all the knowledge that has
been acquired in classes and thus be able to obtain a
good result by obtaining a scale vehicle that works in
the same way as a common vehicle.

 Analogue and digital electronics are nowadays a


fundamental pillar for the development of projects and,
above all, they are of great importance for the
automotive sector since all vehicles have electronic
systems and can be improved with the passage of
weather.

 The prototype has met the expectations of the initial


objectives, and has allowed to investigate and analyze
what would be the next steps to be taken with respect
to the realization of the vehicle on an autonomous
scale, as well as the modifications in the programming
that can be made to improve the operation vehicle.

 Through this work, invaluable knowledge about the


commissioning of electric motors through an H-bridge
and the programming of a PIC16F84A was specified.
With this H-bridge assembly, we can control the
direction of rotation of the motors, in the same way,
the need to use a regulated voltage source, to have 5V
output and thus power the PIC.
ANEXO 1

Programación en Arduino long maxi=0;

char inChar = (char)' '; long mini=10000;

QTRSensorsRC qtrrc((unsigned char[]) {A7, A6,


A5,A4,A3,A2,A1,A0},
int lastError = 0;
NUM_SENSORS, TIMEOUT, EMITTER_PIN);
#include <QTRSensors.h>
unsigned int sensorValues[NUM_SENSORS];

int distance=0;
const int Motor1 = 11; //izquierda
unsigned long currentMillis = 0;
const int Motor2 = 10; //derecha
const long interval = 300;
const int DI = 25; //izquierda
void setup()
const int DD = 24; //derecha
{

Serial.begin(9600);
String inputString = ""; // a string to hold incoming data
inputString.reserve(200);
boolean stringComplete = false;
manual_calibration();
#define _UMBRAL_ 200 //Umbral de los sensores
set_motors(0,0);
#define sharp A10
pinMode(3, INPUT);

pinMode(4, INPUT);
#define KP 0.1

#define KD 4
pinMode(A0, INPUT);

pinMode(A1, INPUT);
#define M1 150
pinMode(A2, INPUT);
#define M2 150
pinMode(A3, INPUT);
#define M1_MAX_SPEED 200
pinMode(A4, INPUT);
#define M2_MAX_SPEED 200
pinMode(A5, INPUT);

pinMode(A6, INPUT);
#define NUM_SENSORS 8
pinMode(A7, INPUT);
#define TIMEOUT 2500

#define EMITTER_PIN 2
//LUCESS

//analogWrite(7, 220);
//distancia obstaculos
// analogWrite(6, 10);
int dist_max=6;
currentMillis = millis();
int dist_min=2;
}
void loop() char inChar = (char)Serial.read();

{ // add it to the inputString:

if (millis() - currentMillis >= interval) inputString += inChar;

{ // if the incoming character is a newline, set a flag

Serial.println(distance); // so the main loop can do something about it:

currentMillis = millis(); if (inChar == '*') {

} stringComplete = true;

if (stringComplete) { }

// Serial.println(inputString); }

if (inputString.indexOf("a")>-1 ) }

analogWrite(6, 220);

if (inputString.indexOf("b")>-1) void Esquivar()

analogWrite(6, 0); {

if (inputString.indexOf("c")>-1) //IZQUIERDA

analogWrite(7, 20); digitalWrite(13, HIGH);

if (inputString.indexOf("d")>-1) int ValorEsquivar = 80;

analogWrite(7, 0);

// clear the string: //VELOCIDAD MOTOR

inputString = ""; int m1Speed = 80;

stringComplete = false; int m2Speed = 0;

} digitalWrite(DD,LOW);

digitalWrite(DI,HIGH);

if (Distancia()==1) set_motors(m2Speed,m1Speed);

Esquivar(); //TIEMPO DE GIRO

else{ delay(1400);

digitalWrite(DD,LOW);

digitalWrite(DI,LOW); //RECTO

Control(); //VELOCIDAD 2 MOTOR

} m1Speed = 70;

} m2Speed = 70;

digitalWrite(DD,LOW);

void serialEvent() { digitalWrite(DI,LOW);

while (Serial.available()) { set_motors(m2Speed,m1Speed);

// get the new byte: delay(700);


//DERECHA void set_motors(int motor1speed, int motor2speed)

//VELOCIDAD MOTOR {

m1Speed = 0; if (motor1speed > M1_MAX_SPEED ) motor1speed =


M1_MAX_SPEED;
m2Speed = 80;
if (motor2speed > M2_MAX_SPEED ) motor2speed =
set_motors(m2Speed,m1Speed); M2_MAX_SPEED;
digitalWrite(DD,HIGH); if (motor1speed < 0) motor1speed = 0;
digitalWrite(DI,LOW); if (motor2speed < 0) motor2speed = 0;
delay(1000); analogWrite(Motor1, motor1speed);
digitalWrite(13, LOW); analogWrite(Motor2, motor2speed);
} }

void manual_calibration() {
int Distancia() delay(500);
{ pinMode(13, OUTPUT);
float volts = analogRead(sharp)*0.0048828125; // (5/1024) digitalWrite(13, HIGH);
distance = 13*pow(volts, -1); for (int i = 0; i < 400; i++)
//Serial.println(distance); {
if (distance >= dist_max || distance <= dist_min) qtrrc.calibrate();
return 0; }
else digitalWrite(13, LOW);
return 1; Serial.begin(9600);
} for (int i = 0; i < NUM_SENSORS; i++)
void Control() {
{ Serial.print(qtrrc.calibratedMinimumOn[i]);
int position = qtrrc.readLine(sensorValues); Serial.print(' ');
//Serial.println(position); }
int error = position - 3000; Serial.println();
int motorSpeed = KP * error + KD * (error - lastError); for (int i = 0; i < NUM_SENSORS; i++)
lastError = error; {
//Serial.println(motorSpeed); Serial.print(qtrrc.calibratedMaximumOn[i]);
motorSpeed = map(motorSpeed, -30, 40, -60, 90); Serial.print(' ');
int m1Speed = M1 + motorSpeed; }
int m2Speed = M2 - motorSpeed; Serial.println();
set_motors(m2Speed,m1Speed); delay(1000);
} }

You might also like