Sei sulla pagina 1di 8

ELC141.

2 Project: Self-Parking Mobot


Post-laboratory Report; Submitted: 09 December 2015

Verannie Q. Alcantara

Aija Nette R. Cruz

Electronics, Computer, and Communications Engineering


Ateneo de Manila University
Philippines
verannie.alcantara@obf.ateneo.edu

Electronics, Computer, and Communications Engineering


Ateneo de Manila University
Philippines
aija.cruz@obf.ateneo.edu

Abstract This paper explains how to create a self-parking system


using a mobot, Ultrasonic Sonar sensors and an Arduino Uno. To
describe briefly, a mobot or a mobile robot is a robot with a mobile
base. This characteristic makes the robot move freely in the
environment. Next, an Arduino uno is a microcontroller board
based on ATmega328p which makes prototyping a lot easier. Lastly,
the Ultrasonic Sonar Sensor is a sensor used to measure the
distance from an object. The idea of creating a self-parking system
came due to be due to the inefficiency of human parking today.
Parking properly, with the car having the same distance in both
sides, is essential in order to give enough space to other cars and to
avoid having dents or scratches. With that, the goal of this project
is to create a prototype for a self-parking system which would help
the car park exactly in the middle of the parking slot without
colliding into blockages.

use ultrasonic sensors, mobots and arduino uno board. The


ultrasonic sensors will serve as the guide of the mobot as it will
provide the distance of the mobot to the blocks in front and on
the sides of it. This project attempts to explore how sensor
input and an algorithm can be used for practical applications.

I. INTRODUCTION
One of the parking etiquettes is to park straight in a parking
space. When parking, the driver must always leave enough
space on each side of the parking space to be able to open the
doors without hitting the cars beside it. Taking up a greater
space on one side will crowd the drive who will park next to it
which may inevitable lead to paint scratches. It will also be
hard for the driver parking next to it if the car is not parked in
the middle. Moreover, it must be ensured that the car is pulled
into the space far enough so the rear of the car is in line with
other cars in order to give a wide driving lane in the parking lot
and to avoid having the rear of your car bumped by another car.
It is essential to observe proper etiquettes in parking and to be
considerate to other drivers.
There are people who aren't good with driving especially
beginners. Others are just too lazy to park properly. Selfparking cars have been a trend in the automobile world. Some
self-parking have a parking assist system. Some are being
developed to have a full control system from finding a suitable
space to steering the wheel and parking the car properly. A selfparking system can park the car properly even in the narrowest
space possible.
The main goal of this project is to design a prototype which
will help the car park properly in a forward manner through the

II. THEORETICAL BACKGROUND


Arduino
Arduino was born at the Ivrea Interaction Design Institute as
an easy tool for fast prototyping, aimed at students without a
background in electronics and programming. As soon as it
reached a wider community, the Arduino board started
changing to adapt to new needs and challenges, differentiating
its offer from simple 8-bit boards to products for IoT
applications, wearable, 3D printing, and embedded
environments. All Arduino boards are completely open-source,
empowering users to build them independently and eventually
adapt them to their particular needs. The software, too, is opensource, and it is growing through the contributions of users
worldwide.
The Arduino software is easy-to-use for beginners, yet
flexible enough for advanced users. Teachers and students use
it to build low cost scientific instruments, to prove chemistry
and physics principles, or to get started with programming and
robotics. Designers and architects build interactive prototypes,
musicians and artists use it for installations and to experiment
with new musical instruments.
There are many other microcontrollers and microcontroller
platforms available for physical computing. Parallax Basic
Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, 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 preassembled Arduino modules cost less than $50
Cross-platform - The Arduino Software (IDE) runs on
Windows, Macintosh OSX, and Linux operating
systems. Most microcontroller systems are limited to
Windows.
Simple, clear programming environment - The
Arduino Software (IDE) 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 how the Arduino IDE works.
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 plans of
the Arduino boards 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. [1]
Arduino Software
The Arduino Integrated Development Environment - or
Arduino Software (IDE) - contains a text editor for writing
code, a message area, a text console, a toolbar with buttons for
common functions and a series of menus. It connects to the
Arduino and Genuino hardware to upload programs and
communicate with them.
Programs written using Arduino Software (IDE) are called
sketches. These sketches are written in the text editor and are
saved with the file extension .ino. The editor has features for
cutting/pasting and for searching/replacing text. The message
area gives feedback while saving and exporting and also
displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages

and other information. The bottom righthand corner of the


window displays the configured board and serial port. The
toolbar buttons allow you to verify and upload programs,
create, open, and save sketches, and open the serial monitor. [2]
Arduino Uno
Arduino/Genuino Uno is a microcontroller board based on
the ATmega328P . It has 14 digital input/output pins (of which
6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
quartz crystal, 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 an AC-to-DC adapter or
battery to get started. The schematic diagram of an Arduino
Uno is shown in Figure 1.
"Uno" means one in Italian and was chosen to mark the
release of Arduino Software (IDE) 1.0. The Uno board and
version 1.0 of Arduino Software (IDE) were the reference
versions of Arduino, now evolved to newer releases. The Uno
board is the first in a series of USB Arduino boards, and the
reference model for the Arduino platform; for an extensive list
of current, past or outdated boards see the Arduino index of
boards. [3]
Arduino Shields
Arduino shields are modular circuit boards that piggyback
onto your Arduino to instill it with extra functionality. Every
Arduino shield must have the same form-factor as the standard
Arduino. Power and ground pins on one eight (previously six)
pin header, and analog pins on a six-pin header next to that.
Digital pins cover the other edge on the other side, an eight-pin
header separated from a 10-pin by that weird 0.5" spacing.
Some shields also require a connection to the Arduinos ICSP
header (the 2x3 programming header on the end). [4]
Mobots
A Robot is any machine which is completely automatic, i.e.
it starts on its own, decides its own way of work and stops on
its own. It is actually a replica of human being, which has been
designed to ease human burden. It can be controlled
pneumatically or using hydraulic ways or using the simple
electronic control ways. The first industrial robot was
Unimates built by George Devol and Joe Engelberger in the
late 50s and early 60s. Any robot is built on 3 basic laws
defined by the Russian Science fiction author Isaac Asimov:
o A robot should not harm the human being directly or
indirectly.
o A robot should obey human orders unless and until it
violates the first law.
o A robot should protect its own existence provided the
1st two laws are not violated.

Robots can be fixed robots or mobile robots. Mobile


Robots are robots with a mobile base which makes the robot
move freely in the environment. One of the advanced mobile
robots is the Line Follower Robot. It is basically a robot which
follows a particular path or trajectory and decides its own
course of action which interacts with obstacle. The path can be
a black line on the white floor (visible) or a magnetic field
(invisible). Its applications start from basic domestic uses to
industrial uses, etc. The present condition in industry is they
are carrying the parcels or materials one place to another place
using the crane system. Sometimes lifting of big weights at that
time may cause the breakage of lifting materials and will be
cause damage to the parcels also. The line following robots is
commonly used for carry children through shopping malls,
homes, entertainment places, industries. The use of line
following robotic vehicle is transport the materials from one
place to another place in the industries. This robot movement
completely depends on the track. The robot can do anything
you set them to do. Like in factories all they have to do with
making their products is make the robot.
The mechanical part or body of the robot can be designed
using AutoCAD or Workspace. A basic Line follower robot can
consist of a base at the two ends of which the wheels are
mounted. A rectangular sheet of hard plastic can be used as the
base. Further a rigid body like a cylinder can be added along
with other shaped bodies inter connected with each other by
joints, and each with its defined motion in particular direction.
The Line follower robot can be a wheeled mobile robot with a
fixed base, a legged mobile robot with multiple rigid bodies
interconnected by joints.
The next step involves defining the Kinematics of the
robot. Kinematic analysis of the robot involves the description
of its motion with respect to a fixed coordinate system. It is
concerned mainly with the movement of the robot and with
motion of each body in case of a legged robot. It generally
involves the dynamics of the robot motion. The whole
trajectory of the robot is set using the Kinematic analysis. This
can be done using Workspace software.
The control of the robot is the most important aspect of its
working. Here the term control refers to the robot motion
control, i.e. controlling the movement of the wheels. A basic
line follower robot follows certain path and the motion of the
robot along this path is controlled by controlling the rotation of
wheels, which are placed on the shafts of the two motors. So,
the basic control is achieved by controlling the motors. The
control circuitry involves the use of sensors to sense the path
and the microcontroller or any other device to control the

motor operation through the motor drivers, based on the sensor


output. [5]

FIG. 1. SCHEMATIC DIAGRAM OF AN ARDUINO UNO.

Ultrasonic Sonar Sensor


Us-100 compact ultrasonic sonar module is a low cost
solution for circuit applications which requires distance
measurements from an object, such as walls, furniture, and
even pets. User initiates a measurement by driving the US-100
trigger input to logic HIGH. The US-100 in response, will send
short bursts of ultrasonic wave, and then will output a pulse as
soon as a returning echo is detected. The user circuit resolves
the distance by measuring the pulse width of the output pulse.
The distance from the object can be computed by:
Distance = Pulse Width * Speed of Sound/2
Distances up to 4.5 meters from the sensor can be measured,
with resolving resolution depending mainly on the user circuit.
The features of the ultrasonic sonar used in this activity
include a technology of a 40 kHz Ultrasonic Sonar, a sensor
range of 2cm - 350cmm, a power input of 3V-5VDC at 3.5
mA, a TTL trigger input, a TTL echo output and a PCB size of
20x45 mm. The pin assignments of the ultrasonic sonar sensor
are found in Table I. [3]

III. METHODOLOGY
A. Materials
The materials used in this activity were three US-100 sonar
sensors, an Arduino uno, a breadboard, wires and a mobot.

FIG. 2. ULTRASONIC SENSOR ILLUSTRATION WITH ITS MAJOR


COMPONENTS[3]
TABLE I. ULTRASONIC SENSOR PIN ASSIGNMENTS AND DESCRIPTION [3]

Pin No.
1
2

ID
VCC
Trigger

3
4
5

Echo
GND
GND

Description
5V Power input
Trigger input
active HIGH
Pulse output
Ground
Ground

Self-Parking Systems
In 2004, Toyota Motor Corporation developed the first
automatic parking system, known as the Intelligent Parking
Assist (IPA) system. Cars with this system have a sonar
warning system that consists of ultrasonic wave sensors built
into the corners of a cars bumper to detect the distance of
surrounding objects. The system also utilizes two additional
sensors on the front side fenders. These sensors provide enough
information for a computer to calculate optimal parking angles.
The IPA system uses computer processors that are tied to the
cars built-in sensors and integrated with a rear-facing camera
to provide even more parking information for the driver.
Automobile manufacturers such as Toyota, Lexus, Volvo,
and Ford offer some car models that include self-parking
systems. Currently, self-parking cars are not completely
autonomous. The driver still controls the speed of the cars
brake pedal when necessary. [6]

B. Procedure
The researchers inputted the code given below in the IDE.
//1 = front
//2 = right
//3 = left
const int trigger1 = 6;
const int echo1 = 7;
const int trigger2 = 4;
const int echo2 = 5;
const int trigger3 = 2;
const int echo3 = 3;
int front;
int right;
int left;

int i;
int run1 = 9; // 0 to 255, 255 = max, 0 = stop
int run2 = 10;
int dir1 = 8;
int dir2 = 11;
void setup() {
Serial.begin(9600);
pinMode(trigger1, OUTPUT);
pinMode(echo1, INPUT);
pinMode(trigger2, OUTPUT);
pinMode(echo2, INPUT);
pinMode(trigger3, OUTPUT);
pinMode(echo3, INPUT);
for (i = 8; i <= 11; i = i + 1) {
pinMode(i, OUTPUT); //motor control
}
delay(10);
//stop motors
for (i = 8; i <= 11; i = i + 1) {
digitalWrite(i, LOW);
}
}
void loop() {

Sonar1();
Sonar2();
Sonar3();
if (right - left > 2 && front > 18) {
forwardright();
stop ();
}
else if (right - left > 2 && front < 18) {
backward();
forwardright ();
stop();
}
else if (left - right > 2 && front > 18) {
forwardleft ();
stop();
}
else if (left - right > 2 && front < 18) {
backward();
forwardleft();
stop();
}
else {
if (front>15){
forward();
stop();
}
}
}

void Sonar1() {
//Sonar 1
// Trigger US-100 to start measurement
// Set up trigger
digitalWrite(trigger1, LOW);
delayMicroseconds(5);
// Start Measurement
digitalWrite(trigger1, HIGH);
delayMicroseconds(10);
digitalWrite(trigger1, LOW);
// Acquire and convert to mtrs
front = pulseIn(echo1, HIGH);
front = front * 0.01657;
// send result to UART
Serial.println(front);
delay(0);
}

void Sonar2 () {
//Sonar 2
// Trigger US-100 to start measurement
// Set up trigger
digitalWrite(trigger2, LOW);
delayMicroseconds(5);
// Start Measurement
digitalWrite(trigger2, HIGH);
delayMicroseconds(10);
digitalWrite(trigger2, LOW);
// Acquire and convert to mtrs
right = pulseIn(echo2, HIGH);
right = right * 0.01657;
// send result to UART
Serial.println(right);
delay(0);
}
void Sonar3 () {
//Sonar 3
// Trigger US-100 to start measurement
// Set up trigger
digitalWrite(trigger3, LOW);
delayMicroseconds(5);
// Start Measurement
digitalWrite(trigger3, HIGH);
delayMicroseconds(10);
digitalWrite(trigger3, LOW);
// Acquire and convert to mtrs
left = pulseIn(echo3, HIGH);
left = left * 0.01657;
left = left / 1;
// send result to UART
Serial.println(left);
delay(0);
}
void forward () {
cmd1(200, 1, 250, 1); //forward
delay(300);
}
void backward () {
cmd1 (150, 0, 230, 0); //backward
delay(700);
}

void stop () {
cmd1 (0, 0, 0, 0); //stop
delay(400);
}

both sides were equal and the mobot was pulled far enough in
front. Figure 3 shows the schematic diagram of the system.

void forwardright() {
cmd1 (90, 1, 50, 1); //right
delay (700);
cmd1 (50, 1, 140, 1); //half left
delay (600);
}
void forwardleft() {
cmd1 (50, 1, 100, 1); //left
delay (700);
cmd1 (100, 1, 50, 1); //half right
delay (710);
}

void cmd1(int speed1, int mydir1, int speed2, int


mydir2 ) {
// motor1
digitalWrite(dir1, mydir1); //direction control of
motor1, 1 = forward
analogWrite(run1, speed1); //speed control of motor1,
0 =stop, 255 =fastest
// motor2
digitalWrite(dir2, mydir2); //direction control of
motor2, 1 = forward
analogWrite(run2, speed2); //speed control of motor2,
0 =stop, 255 =fastest
}
Three ultrasonic sensors were connected to the pins D2-D8
of the arduino. The trigger and echo pins of the front sensor
were connected to pins 6 and 7 respectively. As for the trigger
and echo pins of the right sensor, the two were connected to
pins 4 and 5 respectively. Lastly, the trigger and echo pins of
trigger and echo of the left sensor were connected to pins 2 and
3 respectively. The D0 to D8 pins of the arduino were not
connected to the mobot. Only pins D8 to D11 were connected.
The VCC and ground pins of the sensors were then connected
to the VCC and GND pins of the arduino. After uploading the
code to the Arduino, the researchers then tested if the code was
running properly by checking if the distance of the mobot in

FIG. 3. SELF-PARKING MOBOT CIRCUIT

FIG. 4. ACTUAL SELF-PARKING MOBOT

IV. RESULTS AND DISCUSSION


To make the discussion easier, this section is separated into
sub parts, one explaining the setup and the other elaborating
the logic behind the code of the self-parking mobot.
Setup
The hardware setup of the self-parking mobot could be seen
in Figure 3. First and foremost, the prototype has three
elements. The mobot, the Arduino uno and the sonar sensors.
The setup shows how these three elements were connected in
order to successfully transfer data and control signals in
between processes.
The sensors have five pins each, namely; Trigger, Echo,
VCC, and two ground pins. The triggers are output pins while
the echos are the input pins. The VCC and the ground pins
were set and cleared respectively to avoid the hassle of
connecting those pins to an external power supply. This makes
an efficient use of the Arduino and the pins because it

maximizes the capabilities of both elements. The trigger and


the echo pins were also connected to the other pins of the
Arduino. Where its connected doesnt matter because during
the coding process, the programmer could set any pins to play
any function. In this case, all the triggers for the three sonar
sensors for front, right and left are located at pins 6, 4 and 2
respectively while the echos for front, right and left are
connected at pins 7, 5 and 3 correspondingly.
The Arduino is connected on the mobot in order for it to be
able to execute the program. But pins D0-D8 were not
connected to the mobot since the sensors were connected to
these pins.
Code
The code for the self-parking mobot was created using the
Arduino IDE. The complete code can be seen in the
methodology section of this paper.
To clarify, the mobot would mimic the act of parking by
positioning itself at the center of two arbitrary objects and at a
distance of 12 cm from a wall or an object in front.
To give an overview, the logic behind the mobot lies on the
relationship of the three distances measured by the sonar
sensors. Those distances tell how far the mobot is from another
object on its front and sides. This information tells how the
mobot needs to adjust itself relative to its position. For
example, whenever the distance between the mobot and any
object on its right is greater compared to the other side, the
mobot has to adjust in a way that it will position itself at the
center of the objects on its sides without bumping to anything
in front. Not only that, after adjusting its position and
successfully moving at the center, it will now move towards the
front at a certain distance away from any object.
Moving now to the code itself, the first part declares the
variables needed for the program to work. Notice that there are
several variations of the trigger and echo variables. trigger1
and echo1 are both for the front sonar sensor, trigger2 and
echo2 are for the right sensor and trigger3 and echo3 are
for the left. The next variables that were declared, which are
front, right and left pertain to the distances from other
objects. Note that the data type used is int in order to remove
the decimal places in the distances measured. Further
parameters were set up, such as the type of the pins and the
corresponding pin assignments of the mobots motors.
The next section of the code is the looped code which is
responsible for the whole program of the mobot. The first three
lines call the functions that are responsible for saving to
memory the data gathered by the three sensors. These

functions are defined at the bottom of the program just to make


it seem more organized and make the code look cleaner.
When measuring the distance using the sonar sensor, the
trigger input will be first cleared in order to ensure that trigger
input has no data. It will then be activated with a pulse. After
which, the sonar will respond with an echo output pulse. The
echo response pulse width is equivalent to the time it takes for
the ultrasonic sound to travel from the sensor to the object and
back.
Based on the gathered information, the Arduino checks the
condition satisfied by the location of the mobot and executes
the consequence of that condition. Taking the first case as an
example, when the distance on the right of the mobot is greater
than the one on its left by 2cm and the front distance from an
object is greater than 17cm, the Arduino will execute the
forwardright function. This, just like the others, is defined at
the bottom of the program. But what it tells the Arduino is to
move right with a delay of 700ms and then move left with a
delay of 600ms. By doing this, the mobot would be able to
adjust a few centimeters to the right. However, an execution of
this process sometimes isnt enough to bring the mobot into the
center so it would rerun the loop to check again as to where it
needs adjustments. When the mobot is finally at the center, it
will execute the last condition which is to move forward until
the distance between the mobot and the object in front is equal
to 12cm. After executing that last code, the mobot should be
parked exactly at the center and 12cm away from anything on
its front.
V. CONCLUSION
With regards to the explicit goal of this laboratory activity,
which again was to make a prototype of a self-parking system,
the researchers were successful by having the mobot park
exactly in the middle of the parking slot. Although the
researchers had a difficulty in calibrating the wheels of the
mobots, the researchers were able to determine which wheel
was more powerful than the other. Taking all of that aside,
there was also an implicit objective which was to learn more
about the interface, function on how the Arduino and coding
with IDE works and how the ultrasonic sensors operates. With
regards to that goal, the researchers think that the project really
helped in deepening the understanding and appreciation of
electronics.
REFERENCES
[1]
[2]
[3]
[4]

What Is Arduino In Arduino. n.d. Web. 16 Sep 2015.


Arduino Software (IDE) In Arduino. n.d. Web. 16 Sep 2015.
Arduino Uno In Arduino. n.d. Web. 16 Sep 2015.
Arduino Shields In SparkFun. n.d. Web. 16 Sep 2015.

[5] Ultrasonic Sonar Module. In e-Gizmo. n.d. Web. 2 Dec 2015.


PDF.
[6] Chen, Claire. Autonomous Parallel Parking Car. In Menlo
School. n.d. Web. 8 Dec 2015. PDF.

[7] K.

Potrebbero piacerti anche