Вы находитесь на странице: 1из 19

Faculty of Engineering and Quantity Surveying

(FEQS)
EEE 3210 Electronics and Microprocessor

Final Project Report : Obstacle Avoiding Robot

Name : Liang Jin Yang


ID : I13003069
Program : BMEGI
Course Code : EEE3210
Session : 1K1
Lecturer : Dr. Jeyagopi Raman

1
Table of Content
Title Page
1.0 Introduction 3
2.0 Objective 4
3.0 Apparatus and Materials 5
4.0 Procedure 8
5.0 Result and analysis 9
6.0 Discussion 17
7.0 conclusion 18
8.0 Reference 19

2
1.0 Introduction

Robotics is a branch of engineering that involves the conception, design, manufacture, and
operation of robots. This field overlaps with electronics, computer science, artificial
intelligence, mechatronics, nanotechnology and bioengineering. Besides, robotics is the study
of mechanical engineering, electrical engineering, electronic engineering and computer
science and is a broader way of looking at developments. An autonomous, self-driving car
may or may not be a robot, depending on your interpretation of the definitions, but robotics is
definitely involved in its design process.

Figure 1 – Robotics in engineering manufacturing field

Now day’s many industries are using robots due to their high level of performance and
reliability and which is a great help for human beings. The obstacle avoidance robotics is
used for detecting obstacles and avoiding the collision. This is an autonomous robot. The
design of obstacle avoidance robot requires the integration of many sensors according to their
task.

The obstacle detection is primary requirement of this autonomous robot. The robot gets the
information from surrounding area through mounted sensors on the robot. Some sensing
devices used for obstacle detection like bump sensor, infrared sensor, ultrasonic sensor etc.
Ultrasonic sensor is most suitable for obstacle detection and it is of low cost and has high
ranging capability. So, the tittle of this project is obstacle avoidance robot. An Obstacle
Avoidance Robot is an intelligent robot, which can automatically sense and overcome
obstacles on its path. It contains of a Microcontroller to process the data, and Ultrasonic
sensors to detect the obstacles on its path.

3
2.0 Objective

For this project students need to achieve the objective as an obstacle avoiding robot is one
which can avoid an obstacle by using ultrasound sensor and navigate on its own path.
Students need to develop an obstacle avoidance robot by using Arduino Uno R3. Obstacle
avoidance robot works with self-intelligence if there is any hardly or obstacle in its way. It
turns its direction automatically in case of any obstacle in its way.

3.0 Background Study

Arduino Uno R3

Figure 2 – Arduino Uno R3 diagram

For this project an Arduino/Genuino Uno is used which based on the ATmega328P
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6
analogue inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header
and a reset button. It has everything necessary parts needed to support the microcontroller.
All need to use it is simply connect it to a computer with a USB cable or power it with a AC-
to-DC adapter or battery to get started. The advantage is UNO can be made to modify almost
everything upon interest without have to worry when something went wrong. In those cases,
simply replace the chip and the UNO board can be used again.

4
In today’s technologies where gadgets precede anything and growing ever faster, the main
control unit for a simple yet advanced gadgets is mostly a microcontroller. A microcontroller
is a device that acts as a link for parts of a robot such as batteries, LEDs, servo, sensors and
much more. A motor controller works by suing a Hall Effect Sensor to determine the
orientation of the rotor and apply a magnetic field perpendicular to the rotor magnets. The
voltage applied is Pulse Width Modulated (PWM) which is used to control the speed of the
motor in this case. A motor controller using the Hall Effect Sensor also can figure out the
speed of the motor by taking the time taken for the Hall Effect Sensors to go through one full
rotation.

Servo Motor

Figure 3 – Figure of servo motor

One of the microcontroller used in this case in a servo motor. A servo motor is an actuator
which can rotate a full 360ᵒ or can be used as 180ᵒ linear actuator that allows for total control
of angular or linear position, velocity and acceleration. In a servo motor, it has a motor which
is connected to a sensor for its position feedback. Servo motor is often used in a module
design for relatively sophisticated controller. It is a type of closed-loop control system. In
order to understand its basic operation, the power supply to the motor stops when the shaft is
at the desired position. For instance, the program can be code so that the motor will rotate at a
certain angle and stop or rotate back to original position as programmed to do so. When the
shaft does not stop at the desired position, the motor will run until it gets into the appropriate
direction. The desired position is sent through the signal wire, which uses electrical pulses.

5
DC Motor

Figure 4 – SC motor figure

There is another different type of motor which is DC motor. A DC motor is any of a class of
rotary electrical machines that converts direct current electrical energy into mechanical
energy. The most common types rely on the forces produced by magnetic fields. Nearly all
types of DC motors have some internal mechanism, either electromechanical or electronic, to
periodically change the direction of current flow in part of the motor. DC motors were the
first type widely used, since they could be powered from existing direct-current lighting
power distribution systems. A DC motor's speed can be controlled over a wide range, using
either a variable supply voltage or by changing the strength of current in its field windings.
Small DC motors are used in tools, toys, and appliances. This DC or direct current motor
works on the principal, when a current carrying conductor is placed in a magnetic field, it
experiences a torque and has a tendency to move. This is known as motoring action. If the
direction of current in the wire is reversed, the direction of rotation also reverses. When
magnetic field and electric field interact they produce a mechanical force, and based on that
the working principle of DC motor is established.

6
Ultrasonic Sensor

Figure 5 – Ultrasonic Sensor

For this project, it is required that students use ultrasonic sensors as the given title for this
project is Object Avoidance Vehicle. An ultrasonic sensor is a type of sensor that can
measure the distance to an object by using sound waves. It measures distance by sending out
a sound wave at a specific frequency and listening for that sound wave to bounce back. By
recording the elapsed time between the sound wave being generated and the sound wave
bouncing back, it is possible to calculate the distance between the sonar sensor and the object.
Since it is known that sound travels through air at about 344 m/s, you can take the time for
the sound wave to return and multiply it by 344 meters to find the total round-trip distance of
the sound wave. Round-trip means that the sound wave travelled 2 times the distance to the
object before it was detected by the sensor; it includes the 'trip' from the sonar sensor to the
object and the 'trip' from the object to the Ultrasonic sensor after the sound wave bounced off
the object. To find the distance to the object, simply divide the round-trip distance in half. It
is important to understand that some objects might not be detected by ultrasonic sensors. This
is because some objects are shaped or positioned in such a way that the sound wave bounces
off the object, but are deflected away from the Ultrasonic sensor. It is also possible for the
object to be too small to reflect enough of the sound wave back to the sensor to be detected.

7
4.0 Design
List of material used

Table 1 – List of material used

Project Demostration

Top view

8
Side view

Front View

9
Back view

10
Coding
#include <Servo.h> //Servo motor library. This is standard library
#include <NewPing.h> //Ultrasonic sensor function library. You must install this library

//our L298N control pins


const int LeftMotorForward = 7;
const int LeftMotorBackward = 6;
const int RightMotorForward = 4;
const int RightMotorBackward = 5;

//sensor pins
#define trig_pin A1 //analog input 1
#define echo_pin A2 //analog input 2

#define maximum_distance 200


boolean goesForward = false;
int distance = 100;

NewPing sonar(trig_pin, echo_pin, maximum_distance); //sensor function


Servo servo_motor; //our servo name

void setup(){

pinMode(RightMotorForward, OUTPUT);
pinMode(LeftMotorForward, OUTPUT);
pinMode(LeftMotorBackward, OUTPUT);
pinMode(RightMotorBackward, OUTPUT);

servo_motor.attach(10); //our servo pin

11
servo_motor.write(115);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
}

void loop(){

int distanceRight = 0;
int distanceLeft = 0;
delay(50);

if (distance <= 20){


moveStop();
delay(300);
moveBackward();
delay(400);
moveStop();
delay(300);
distanceRight = lookRight();
delay(300);
distanceLeft = lookLeft();
delay(300);

if (distance >= distanceLeft){

12
turnRight();
moveStop();
}
else{
turnLeft();
moveStop();
}
}
else{
moveForward();
}
distance = readPing();
}

int lookRight(){
servo_motor.write(50);
delay(500);
int distance = readPing();
delay(100);
servo_motor.write(115);
return distance;
}

int lookLeft(){
servo_motor.write(170);
delay(500);
int distance = readPing();
delay(100);
servo_motor.write(115);
return distance;
delay(100);

13
}

int readPing(){
delay(70);
int cm = sonar.ping_cm();
if (cm==0){
cm=250;
}
return cm;
}

void moveStop(){

digitalWrite(RightMotorForward, LOW);
digitalWrite(LeftMotorForward, LOW);
digitalWrite(RightMotorBackward, LOW);
digitalWrite(LeftMotorBackward, LOW);
}

void moveForward(){

if(!goesForward){

goesForward=true;

digitalWrite(LeftMotorForward, HIGH);
digitalWrite(RightMotorForward, HIGH);

digitalWrite(LeftMotorBackward, LOW);
digitalWrite(RightMotorBackward, LOW);
}

14
}

void moveBackward(){

goesForward=false;

digitalWrite(LeftMotorBackward, HIGH);
digitalWrite(RightMotorBackward, HIGH);

digitalWrite(LeftMotorForward, LOW);
digitalWrite(RightMotorForward, LOW);

void turnRight(){ // for turning right

digitalWrite(LeftMotorForward, HIGH);
digitalWrite(RightMotorBackward, HIGH);

digitalWrite(LeftMotorBackward, LOW);
digitalWrite(RightMotorForward, LOW);

delay(500);

digitalWrite(LeftMotorForward, HIGH);
digitalWrite(RightMotorForward, HIGH);

digitalWrite(LeftMotorBackward, LOW);
digitalWrite(RightMotorBackward, LOW);

15
}

void turnLeft(){ // for turning left

digitalWrite(LeftMotorBackward, HIGH);
digitalWrite(RightMotorForward, HIGH);

digitalWrite(LeftMotorForward, LOW);
digitalWrite(RightMotorBackward, LOW);

delay(500);

digitalWrite(LeftMotorForward, HIGH);
digitalWrite(RightMotorForward, HIGH);

digitalWrite(LeftMotorBackward, LOW);
digitalWrite(RightMotorBackward, LOW);
}
Table 1 – Coding for the project

16
5.0 Result and Discussion

The obstacle avoidance robotic vehicle uses ultrasonic sensors for its movements. A
microcontroller is used to achieve the desired operation. The motors are connected through motor
driver IC to microcontroller. The ultrasonic sensor is attached in front of the robot.

Whenever the robot is going on the desired path the ultrasonic sensor transmits the ultrasonic
waves continuously from its sensor head. Whenever an obstacle comes ahead of it the ultrasonic
waves are reflected back from an object and that information is passed to the microcontroller. The
microcontroller controls the motors left, right, back, front, based on ultrasonic signals. In order to
control the speed of each motor pulse width modulation is used (PWM).

Arduino controlled robot moves around detecting the obstacles on its way and thus making its
way through the free space avoiding all the obstacles it encounters. After designing and building
the robot, the robot can now emit sound wave through the ultrasonic sensor, and the ultrasonic
sensor will detect and receive the sound wave that strikes the obstacles if there are any. If there
are any obstacles and the waves collide with them, then the micro controller of the robot will
calculate the distance.

The robot is made activated after it is connected to a power. If there seems to have any obstacle
with in the distance set to it, it will move to the opposite direction of the obstacle detected. That
is, if the ultrasonic sensor detects the object on its way, it will turn left and start moving straight.
Additionally, if there seems to be obstacle all around the robot within the detection distance,
robot will keep on rotating 360°.

Overall, the Arduino robot performed very well. It had only minor problems with the sensor not
picking up any waves which was later on corrected by changing the pin on the breadboard.
However, there had to be many adjustments made to robot in order to achieve the objective
before the tests started.

17
6.0 Conclusion

Almost all navigation robot demands the some sort of obstacle detection, hence obstacle
avoidance strategy is of most importance. Obstacle Avoidance Robot has a vast field of
application. They can be used as services robots, for the purpose of household work and so many
other indoor applications. Equally they have great importance in scientific exploration and
emergency rescue, there may be places that are dangerous for humans or even impossible for
humans to reach directly, then we should use robots to help us. In those challenging
environments, the robots need to gather information about their surroundings to avoid obstacles.
Nowadays, even in ordinary environments, people require that robots to detect and avoid
obstacles. For example, an industrial robot in a factory is expected to avoid workers so that it
won’t hurt them. In conclusion, obstacle avoidance is widely researched and applied in the world,
and it is probable that most robots in the future should have obstacle avoidance function.

After the project, this project is considered successful if a student is able to students can design an
obstacle avoiding robot is one which can avoid an obstacle by using ultrasound sensor and
navigate on its own path. Students should be able to come out with some alternative technical
solutions based on existing requirement specifications. They can independently and proactively
analyse and solve complex technical challenges, as well as to study and evaluate the solution
proposals of others which will develop knowledge, skills and attitudes. The students will be
familiar with the most important technological and mathematical tools.

18
7.0 References

1. LEO Center for Service Robotics. 2018. Defining robots and robotics | LEO Center
for Service Robotics. [ONLINE] Available at: http://www.leorobotics.nl/definition-
robots-and-robotics.
2. A3 Association for Advancing Automation. 2018. Discover Four Benefits of Robotics
- A3 Association for Advancing Automation. [ONLINE] Available at:
https://www.a3automate.org/discover-four-benefits-of-robotics/.
3. Computer Business Review. 2018. What is Robotic Process Automation, and what
benefits could it bring to your enterprise? - Computer Business Review. [ONLINE]
Available at: https://www.cbronline.com/4th-revolution/what-is-robotic-process-
automation-benefits-bring-enterprise/.
4. Instructables.com. 2018. Obstacle Avoiding Robot . [ONLINE] Available at:
http://www.instructables.com/id/Arduino-Ultimate-Obstacle-Avoiding-Robot/.
5. Types of Engineering Degrees. 2018. Robotics Engineering Degree & Related
Programs. [ONLINE] Available at: https://typesofengineeringdegrees.org/robotics-
engineering/.
6. Obstacle Avoiding Robot With Servo Motors . 2018. Obstacle Avoiding Robot With
Servo Motors . [ONLINE] Available at:
http://www.robotiksistem.com/servo_motor_obstacle_avoiding_robot.html.
7. Electronics Hub. 2018. Obstacle Avoiding Robot using Arduino. [ONLINE]
Available at: https://www.electronicshub.org/obstacle-avoiding-robot-
arduino/#Circuit_Diagram.
8. Hackster. 2018. How to Make Obstacle Avoiding Robot - Hackster.io. [ONLINE]
Available at: https://www.hackster.io/darwindelacruz/how-to-make-obstacle-
avoiding-robot-e985b1.
9. Ardumotive Arduino Greek Playground. 2018. Arduino Obstacle Avoiding Robot -
Ardumotive Arduino Greek Playground. [ONLINE] Available at:
http://www.ardumotive.com/obstacle-avoiding-robot.html.
10. Electronics Hub. 2018. Obstacle Avoiding Robot using Arduino. [ONLINE] Available at:
https://www.electronicshub.org/obstacle-avoiding-robot-arduino/.
11. educ8s.tv - Watch Learn Build. 2018. Arduino Robot - An easy DIY project - educ8s.tv -
Watch Learn Build. [ONLINE] Available at: http://educ8s.tv/arduino-robot-easy-diy-
project/.
12. Basic obstacle avoiding robot | Let's Make Robots! | RobotShop. 2018. Basic obstacle
avoiding robot | Let's Make Robots! | RobotShop. [ONLINE] Available at:
https://www.robotshop.com/letsmakerobots/basic-obstacle-avoiding-robot.
13. Deepak Narayana Rao. 2018. Simple obstacle avoiding robot using arduino - !geek.
[ONLINE] Available at: https://tech.endeepak.com/blog/2016/01/02/simple-obstacle-
avoiding-robot-using-arduino/.

19

Вам также может понравиться