SlideShare a Scribd company logo
1 of 14
ROVER PROJECT #2: Obstacle Avoidance Robot
ROVER PROJECT #1: Maneuvering the Rover
Andrew Brouillete, Michael Hernandez, and Bach Nguyen
Report by: Bach Nguyen
CSIT Department
Southeastern Louisiana University
Hammond, LA 70401
Contact Number: 985-662-2106
Contact Email: bach.nguyen-2@selu.edu
ABSTRACT:
This project is to demonstrate our understanding of how to combine a distance sensor and
the 4 wheels drive vehicle to avoid obstacles to reaches its destination.
INTRODUCTION:
In robotics, obstacle avoidance is the task of satisfying some control objective subject to
non-intersection or non-collision position constraints. In unmanned air vehicles, it is a hot topic.
What is critical about obstacle avoidance concept in this area is the growing need of usage of
unmanned aerial vehicles in urban areas for especially military applications where it can be very
useful in city wars. Normally obstacle avoidance is considered to be distinct from path planning
in that one is usually implemented as a reactive control law while the other involves the pre-
computation of an obstacle-free path which a controller will then guide a robot along.
BACKGROUND:
In this project we combined two of our previous projects to make the obstacle avoiding
rover. Using DFRobot’s mobile platform kit and an ultrasonic sensor with 9 pins to make this
project possible.
METHODOLOGY:
List of material uses:
 Ultrasonic Sensor URM37 V 4.0
 DF05BB Servo
 DFRobot 4WD Pirate Rover
 DFRobot Arduino Uno
 DFRobot Motor Shield V1.2
To connect the servo to the platform we used 4 1/8 in screws with hex bolts to secure the rover in
place. Then we connect the sensor mount to the servo using provided ¼ in screw. Then the
Sensor is mounted to the servo and next we calibrated the servo using the code below.
//Center Servos
#include <Servo.h>
Servo servo;
void setup()
{
servo.attach(11);
}
void loop()
{
servo.write(90);
}
This code makes sure the servo works and can be change the the degree that we needed.
Below is how we connected the sensor and the servo to the Arduino board. Pin 1,2 on the sensor
is 5V and GND therefore its connected to + and – terminal of the circuit board respectively.
Below is the picture of the servos and the sensor connect to the pin of the Arduino perspectively.
Figure 1.1 – Pins needed to be connect to the Arduino
Figure 1.2 – How the pins needs to connect to the Arduino
Figure 1.2 – Pins connect to the Servo. The 2 White wires are GND and Power and Green is
signal which connect to pin 9 on the Arduino.
We choose to do a tank control mode for the turning since there are no mechanic part of the
rover that let us maneuver it using the default setup. To use the tank control mode of the rover
we connect the left side motors of the rover to the first 2 slots in the motor shield connector and
the right side to the last 2 slots of the motor shield. To make sure the wire stay connected and not
compromise the power connection between the shield and the motors we twist the wires together
to make one single input to the slot. Below is the picture of the finish product should look like.
Figure 1.4 – DC motors connections
Now this is the code we use to try to make this obstacles avoidance vehicle system works.
#include <Servo.h> // Include Servo library
Servo myservo; // create servo object to control a servo
int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;
int safety = 1516 ;
int pos=0; // variable to store the servo position
int URPWM=3; // PWM Output 0-25000us,every 50us represent
1cm
int URTRIG=10; // PWM trigger pin
boolean up=true; // create a boolean variable
unsigned long time; // create a time variable
unsigned long urmTimer = 0; // timer for managing the sensor reading flash
rate
unsigned int Distance=0;
uint8_t EnPwmCmd[4]={0x44,0x22,0xbb,0x01}; // distance measure command
void setup(){ // Serial initialization
Serial.begin(9600); // Sets the baud rate to 9600
myservo.attach(9); // Pin 9 to control servo
PWM_Mode_Setup();
}
void loop(){
forward();
scan90();
PWM_Mode();
rover();
delay(1000);
}
void scan90(){
if(millis()-time>=500){ // interval 0.02 seconds
time=millis(); // get the current time of program
if(up){ // judge the condition
if(pos>=90 && pos<=179){
pos=pos+0; // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
}
if(pos>179) up= false; // assign the variable again
}
else {
if(pos>=90 && pos<=180){
pos=pos-0;
myservo.write(pos);
}
if(pos<1) up=true;
}
}
if(millis()-urmTimer>50){
urmTimer=millis();
}
}
void scan180(){
if(millis()-time>=500){ // interval 0.02 seconds
time=millis(); // get the current time of programme
if(up){ // judge the condition
if(pos>=0 && pos<=179){
pos=pos+90; // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
}
if(pos>179) up= false; // assign the variable again
}
else {
if(pos>=1 && pos<=180){
pos=pos-90;
myservo.write(pos);
}
if(pos<1) up=true;
}
}
if(millis()-urmTimer>50){
urmTimer=millis();
}
}
void rover(){
while(Distance > safety){
forward();
PWM_Mode();
}
if(Distance <= safety){
avoid();
}
}
void avoid(){
backward();
left();
forward();
right();
left();
}
void PWM_Mode_Setup(){
pinMode(URTRIG,OUTPUT); // A low pull on pin COMP/TRIG
digitalWrite(URTRIG,HIGH); // Set to HIGH
pinMode(URPWM, INPUT); // Sending Enable PWM mode command
for(int i=0;i<4;i++){
Serial.write(EnPwmCmd[i]);
}
}
void PWM_Mode(){ // a low pull on pin COMP/TRIG triggering a
sensor reading
digitalWrite(URTRIG, LOW);
digitalWrite(URTRIG, HIGH); // reading Pin PWM will output pulses
unsigned long DistanceMeasured=pulseIn(URPWM,LOW);
if(DistanceMeasured==15000){ // the reading is invalid.
Serial.print("Invalid");
}
else{
Distance=DistanceMeasured; // every 50us low level stands for 1cm
}
Serial.print("Distance=");
Serial.print(Distance);
Serial.println("cm");
}
void forward(){
digitalWrite(M1,HIGH); //forward
digitalWrite(M2, HIGH);
analogWrite(E1, 150); //PWM Speed Control
analogWrite(E2, 150); //PWM Speed Contro
delay(1000);
}
void backward(){
digitalWrite(M1,LOW); //backwards
digitalWrite(M2, LOW);
analogWrite(E1, 150); //PWM Speed Contro
analogWrite(E2, 150); //PWM Speed Control
delay(1000);
}
void right(){
digitalWrite(M1,HIGH); //clockwise turn right
digitalWrite(M2, LOW);
analogWrite(E1, 100); //PWM Speed Control
analogWrite(E2, 150); //PWM Speed Control
delay(1000);
}
void left(){
digitalWrite(M1,LOW); //counter clockwise turn left
digitalWrite(M2, HIGH);
analogWrite(E1, 150); //PWM Speed Control
analogWrite(E2, 100); //PWM Speed Control
delay(1500);
}
void hault(){
digitalWrite(M1, LOW);
digitalWrite(M2, LOW);
analogWrite(E1, 0);
analogWrite(E2, 0);
delay(1000);
}
Here is how the code works. For the sensor we use the PWM mode. The PWM trigger, pin
COMP/TRIG produces a low level of triggered pulse signal starting distance measurement
operation once. The program started out by going forward and scanning what is in front of it. If
the distance measured smaller than 1516 which is 12 inches then the rover will start a function
called avoid, which supposedly will help he rover maneuver around the object and continue on
its merry way. After it done maneuver around the object the code which is on a loop. The code
reset and the rover will scan again after it finishes the function avoid and it continue till it stops
by the user or the terrain. The resources for the sensor and the motor shield are from DFRobot
website that we have modified and implemented into our design.
RESULT
The result for this project is extremely underwhelming. The project we attempted to do is
incomplete. The rover can avoid the object but once the rover goes around the obstacles the
wheels refuses to have the right traction we needed for it to go forward. Instead the traction
keeps leading it to another way that we cannot seems to control whether how much time to
calibrate it. The sensor decided to stop working in autonomous mode but after being changed to
PWM mode seems to work but not as accurate.
CONCLUSION
Even though this project is a fascinating experience, we encountered numerous bugs and
roadblock that can’t seems to be pass. For example, in the last report the traction was our worst
enemy. It took us way too much time to calibrate it and still it was a pain to get through. Hours
and hours was put into just to get the wheels to turn a certain degree. The sensor was inaccurate
for the longest time and we have to use PWM mode instead of TTL mode, auto measure mode.
In the end, we could not complete the project due to the insufficient of time for more research
and incompetent equipment. If we have a choice of doing things differently we would have
choose to reverse engineer an RC car and then build the project from there with a less
complicated sensor since there is no need for an industrial ultrasonic sensor if we just wanted to
get the distance of some object.
REFERENCE:
Seale, Eric. "DC Motors -- Background and History." DC Motors -- Background and
History. Solarbotics Websites, n.d. Web. 10 May 2016.
"Motor Shield v 1.2." - Robot Wiki. N.p., n.d. Web. 10 May 2016.
"Obstacle Avoidance." Wikipedia. Wikimedia Foundation, n.d. Web. 10 May 2016.
"URM37 v 4.0" - Robot Wiki. N.p., n.d. Web. 10 May 2016.

More Related Content

What's hot

Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopyObstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Elijah Barner
 
GSM controlled robot with obstacle avoidance using IR sensors
GSM controlled robot with obstacle avoidance using IR sensorsGSM controlled robot with obstacle avoidance using IR sensors
GSM controlled robot with obstacle avoidance using IR sensors
Rahul Sidhu
 
Obstacle avoiding robot.doc
Obstacle avoiding robot.docObstacle avoiding robot.doc
Obstacle avoiding robot.doc
Electronics - Embedded System
 

What's hot (20)

Microcontoller
MicrocontollerMicrocontoller
Microcontoller
 
Final report obstacle avoiding roboat
Final report obstacle avoiding roboatFinal report obstacle avoiding roboat
Final report obstacle avoiding roboat
 
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopyObstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
 
Obstacle Detection Robot
Obstacle Detection RobotObstacle Detection Robot
Obstacle Detection Robot
 
Obstacle avoiding robot
Obstacle avoiding robotObstacle avoiding robot
Obstacle avoiding robot
 
Real-time Obstacle Avoidance Algorithm for Mobile Robots
Real-time Obstacle Avoidance  Algorithm for Mobile RobotsReal-time Obstacle Avoidance  Algorithm for Mobile Robots
Real-time Obstacle Avoidance Algorithm for Mobile Robots
 
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNOObstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
 
Autonomous metal search,collect and collision avoidance robot
Autonomous metal search,collect and collision avoidance robotAutonomous metal search,collect and collision avoidance robot
Autonomous metal search,collect and collision avoidance robot
 
Obstacle avoiding robot(Lab report)
Obstacle  avoiding  robot(Lab report)Obstacle  avoiding  robot(Lab report)
Obstacle avoiding robot(Lab report)
 
LINE FOLLOWER ROBOT
LINE FOLLOWER ROBOTLINE FOLLOWER ROBOT
LINE FOLLOWER ROBOT
 
How to build a robot with an arduino and 8051 microcontroller
How to build a robot with an arduino and 8051 microcontrollerHow to build a robot with an arduino and 8051 microcontroller
How to build a robot with an arduino and 8051 microcontroller
 
GSM controlled robot with obstacle avoidance using IR sensors
GSM controlled robot with obstacle avoidance using IR sensorsGSM controlled robot with obstacle avoidance using IR sensors
GSM controlled robot with obstacle avoidance using IR sensors
 
Design and implementation of an obstacle avoiding robot
Design and implementation of an obstacle avoiding robotDesign and implementation of an obstacle avoiding robot
Design and implementation of an obstacle avoiding robot
 
Obstacle Avoidance Robotic Vehicle
Obstacle Avoidance Robotic VehicleObstacle Avoidance Robotic Vehicle
Obstacle Avoidance Robotic Vehicle
 
4. haptic robotic arm
4. haptic robotic arm4. haptic robotic arm
4. haptic robotic arm
 
Obstacle avoiding robot.doc
Obstacle avoiding robot.docObstacle avoiding robot.doc
Obstacle avoiding robot.doc
 
Obstacle Avoidance Robot (Powered by Arduino)
Obstacle Avoidance Robot (Powered by Arduino)Obstacle Avoidance Robot (Powered by Arduino)
Obstacle Avoidance Robot (Powered by Arduino)
 
Obstacle avoiding robot
Obstacle avoiding robotObstacle avoiding robot
Obstacle avoiding robot
 
Line following robot - Mini project
Line following robot - Mini projectLine following robot - Mini project
Line following robot - Mini project
 
Edge detector robot
Edge detector robotEdge detector robot
Edge detector robot
 

Viewers also liked

Viewers also liked (7)

robotics project robotics engineering mechanical mechatronics
robotics project robotics engineering mechanical mechatronicsrobotics project robotics engineering mechanical mechatronics
robotics project robotics engineering mechanical mechatronics
 
Mechanical Project Title 2014
Mechanical Project Title 2014Mechanical Project Title 2014
Mechanical Project Title 2014
 
final bs project
final bs projectfinal bs project
final bs project
 
Project Report Distance measurement system
Project Report Distance measurement systemProject Report Distance measurement system
Project Report Distance measurement system
 
Obstacle Avoidance ROBOT using ARDUINO
Obstacle Avoidance ROBOT using ARDUINOObstacle Avoidance ROBOT using ARDUINO
Obstacle Avoidance ROBOT using ARDUINO
 
Obstacle Detctor Robot report
Obstacle Detctor Robot reportObstacle Detctor Robot report
Obstacle Detctor Robot report
 
B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robotB.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
B.Tech.Final Year ECE Project Report on Ultrasonic distance measure robot
 

Similar to Arduino Final Project

Robotics Report final.compressed (1)
Robotics Report final.compressed (1)Robotics Report final.compressed (1)
Robotics Report final.compressed (1)
Kael Kristjanson
 
Final Slot Car Report
Final Slot Car ReportFinal Slot Car Report
Final Slot Car Report
Kyle Avery
 
Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1
Nicholas Parisi
 

Similar to Arduino Final Project (20)

Hexapod ppt
Hexapod pptHexapod ppt
Hexapod ppt
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Servo 2.0
Servo 2.0Servo 2.0
Servo 2.0
 
Arm
ArmArm
Arm
 
Project Report
Project ReportProject Report
Project Report
 
obstacle avoiding robot project
obstacle avoiding robot projectobstacle avoiding robot project
obstacle avoiding robot project
 
Robotics Report final.compressed (1)
Robotics Report final.compressed (1)Robotics Report final.compressed (1)
Robotics Report final.compressed (1)
 
Final Slot Car Report
Final Slot Car ReportFinal Slot Car Report
Final Slot Car Report
 
renesas
renesasrenesas
renesas
 
Final Slot Car Report
Final Slot Car ReportFinal Slot Car Report
Final Slot Car Report
 
Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1Gulotta_Wright_Parisi_FinalProjectOverview1
Gulotta_Wright_Parisi_FinalProjectOverview1
 
project report
project reportproject report
project report
 
Self Obstacle Avoiding Rover
Self Obstacle Avoiding RoverSelf Obstacle Avoiding Rover
Self Obstacle Avoiding Rover
 
Quadcopter
QuadcopterQuadcopter
Quadcopter
 
Autonomous navigation robot
Autonomous navigation robotAutonomous navigation robot
Autonomous navigation robot
 
(11 16) rajiv g
(11 16) rajiv g(11 16) rajiv g
(11 16) rajiv g
 
Team7 report
Team7 reportTeam7 report
Team7 report
 
Arduino Based Collision Prevention Warning System
Arduino Based Collision Prevention Warning SystemArduino Based Collision Prevention Warning System
Arduino Based Collision Prevention Warning System
 
Automatic railway gate control using arduino uno
Automatic railway gate control using arduino unoAutomatic railway gate control using arduino uno
Automatic railway gate control using arduino uno
 
Automatic railway gate control using arduino uno
Automatic railway gate control using arduino unoAutomatic railway gate control using arduino uno
Automatic railway gate control using arduino uno
 

Arduino Final Project

  • 1. ROVER PROJECT #2: Obstacle Avoidance Robot ROVER PROJECT #1: Maneuvering the Rover Andrew Brouillete, Michael Hernandez, and Bach Nguyen Report by: Bach Nguyen CSIT Department Southeastern Louisiana University Hammond, LA 70401 Contact Number: 985-662-2106 Contact Email: bach.nguyen-2@selu.edu
  • 2. ABSTRACT: This project is to demonstrate our understanding of how to combine a distance sensor and the 4 wheels drive vehicle to avoid obstacles to reaches its destination. INTRODUCTION: In robotics, obstacle avoidance is the task of satisfying some control objective subject to non-intersection or non-collision position constraints. In unmanned air vehicles, it is a hot topic. What is critical about obstacle avoidance concept in this area is the growing need of usage of unmanned aerial vehicles in urban areas for especially military applications where it can be very useful in city wars. Normally obstacle avoidance is considered to be distinct from path planning in that one is usually implemented as a reactive control law while the other involves the pre- computation of an obstacle-free path which a controller will then guide a robot along. BACKGROUND: In this project we combined two of our previous projects to make the obstacle avoiding rover. Using DFRobot’s mobile platform kit and an ultrasonic sensor with 9 pins to make this project possible. METHODOLOGY: List of material uses:  Ultrasonic Sensor URM37 V 4.0  DF05BB Servo  DFRobot 4WD Pirate Rover
  • 3.  DFRobot Arduino Uno  DFRobot Motor Shield V1.2 To connect the servo to the platform we used 4 1/8 in screws with hex bolts to secure the rover in place. Then we connect the sensor mount to the servo using provided ¼ in screw. Then the Sensor is mounted to the servo and next we calibrated the servo using the code below. //Center Servos #include <Servo.h> Servo servo; void setup() { servo.attach(11); } void loop() { servo.write(90); } This code makes sure the servo works and can be change the the degree that we needed. Below is how we connected the sensor and the servo to the Arduino board. Pin 1,2 on the sensor is 5V and GND therefore its connected to + and – terminal of the circuit board respectively. Below is the picture of the servos and the sensor connect to the pin of the Arduino perspectively.
  • 4. Figure 1.1 – Pins needed to be connect to the Arduino Figure 1.2 – How the pins needs to connect to the Arduino
  • 5. Figure 1.2 – Pins connect to the Servo. The 2 White wires are GND and Power and Green is signal which connect to pin 9 on the Arduino. We choose to do a tank control mode for the turning since there are no mechanic part of the rover that let us maneuver it using the default setup. To use the tank control mode of the rover we connect the left side motors of the rover to the first 2 slots in the motor shield connector and the right side to the last 2 slots of the motor shield. To make sure the wire stay connected and not compromise the power connection between the shield and the motors we twist the wires together to make one single input to the slot. Below is the picture of the finish product should look like. Figure 1.4 – DC motors connections
  • 6. Now this is the code we use to try to make this obstacles avoidance vehicle system works. #include <Servo.h> // Include Servo library Servo myservo; // create servo object to control a servo int E1 = 5; int M1 = 4; int E2 = 6; int M2 = 7; int safety = 1516 ; int pos=0; // variable to store the servo position int URPWM=3; // PWM Output 0-25000us,every 50us represent 1cm int URTRIG=10; // PWM trigger pin boolean up=true; // create a boolean variable unsigned long time; // create a time variable unsigned long urmTimer = 0; // timer for managing the sensor reading flash rate unsigned int Distance=0; uint8_t EnPwmCmd[4]={0x44,0x22,0xbb,0x01}; // distance measure command void setup(){ // Serial initialization Serial.begin(9600); // Sets the baud rate to 9600
  • 7. myservo.attach(9); // Pin 9 to control servo PWM_Mode_Setup(); } void loop(){ forward(); scan90(); PWM_Mode(); rover(); delay(1000); } void scan90(){ if(millis()-time>=500){ // interval 0.02 seconds time=millis(); // get the current time of program if(up){ // judge the condition if(pos>=90 && pos<=179){ pos=pos+0; // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' } if(pos>179) up= false; // assign the variable again } else {
  • 8. if(pos>=90 && pos<=180){ pos=pos-0; myservo.write(pos); } if(pos<1) up=true; } } if(millis()-urmTimer>50){ urmTimer=millis(); } } void scan180(){ if(millis()-time>=500){ // interval 0.02 seconds time=millis(); // get the current time of programme if(up){ // judge the condition if(pos>=0 && pos<=179){ pos=pos+90; // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' } if(pos>179) up= false; // assign the variable again }
  • 9. else { if(pos>=1 && pos<=180){ pos=pos-90; myservo.write(pos); } if(pos<1) up=true; } } if(millis()-urmTimer>50){ urmTimer=millis(); } } void rover(){ while(Distance > safety){ forward(); PWM_Mode(); } if(Distance <= safety){ avoid(); } }
  • 10. void avoid(){ backward(); left(); forward(); right(); left(); } void PWM_Mode_Setup(){ pinMode(URTRIG,OUTPUT); // A low pull on pin COMP/TRIG digitalWrite(URTRIG,HIGH); // Set to HIGH pinMode(URPWM, INPUT); // Sending Enable PWM mode command for(int i=0;i<4;i++){ Serial.write(EnPwmCmd[i]); } } void PWM_Mode(){ // a low pull on pin COMP/TRIG triggering a sensor reading digitalWrite(URTRIG, LOW); digitalWrite(URTRIG, HIGH); // reading Pin PWM will output pulses unsigned long DistanceMeasured=pulseIn(URPWM,LOW);
  • 11. if(DistanceMeasured==15000){ // the reading is invalid. Serial.print("Invalid"); } else{ Distance=DistanceMeasured; // every 50us low level stands for 1cm } Serial.print("Distance="); Serial.print(Distance); Serial.println("cm"); } void forward(){ digitalWrite(M1,HIGH); //forward digitalWrite(M2, HIGH); analogWrite(E1, 150); //PWM Speed Control analogWrite(E2, 150); //PWM Speed Contro delay(1000); } void backward(){ digitalWrite(M1,LOW); //backwards digitalWrite(M2, LOW);
  • 12. analogWrite(E1, 150); //PWM Speed Contro analogWrite(E2, 150); //PWM Speed Control delay(1000); } void right(){ digitalWrite(M1,HIGH); //clockwise turn right digitalWrite(M2, LOW); analogWrite(E1, 100); //PWM Speed Control analogWrite(E2, 150); //PWM Speed Control delay(1000); } void left(){ digitalWrite(M1,LOW); //counter clockwise turn left digitalWrite(M2, HIGH); analogWrite(E1, 150); //PWM Speed Control analogWrite(E2, 100); //PWM Speed Control delay(1500); } void hault(){ digitalWrite(M1, LOW); digitalWrite(M2, LOW);
  • 13. analogWrite(E1, 0); analogWrite(E2, 0); delay(1000); } Here is how the code works. For the sensor we use the PWM mode. The PWM trigger, pin COMP/TRIG produces a low level of triggered pulse signal starting distance measurement operation once. The program started out by going forward and scanning what is in front of it. If the distance measured smaller than 1516 which is 12 inches then the rover will start a function called avoid, which supposedly will help he rover maneuver around the object and continue on its merry way. After it done maneuver around the object the code which is on a loop. The code reset and the rover will scan again after it finishes the function avoid and it continue till it stops by the user or the terrain. The resources for the sensor and the motor shield are from DFRobot website that we have modified and implemented into our design. RESULT The result for this project is extremely underwhelming. The project we attempted to do is incomplete. The rover can avoid the object but once the rover goes around the obstacles the wheels refuses to have the right traction we needed for it to go forward. Instead the traction keeps leading it to another way that we cannot seems to control whether how much time to calibrate it. The sensor decided to stop working in autonomous mode but after being changed to PWM mode seems to work but not as accurate.
  • 14. CONCLUSION Even though this project is a fascinating experience, we encountered numerous bugs and roadblock that can’t seems to be pass. For example, in the last report the traction was our worst enemy. It took us way too much time to calibrate it and still it was a pain to get through. Hours and hours was put into just to get the wheels to turn a certain degree. The sensor was inaccurate for the longest time and we have to use PWM mode instead of TTL mode, auto measure mode. In the end, we could not complete the project due to the insufficient of time for more research and incompetent equipment. If we have a choice of doing things differently we would have choose to reverse engineer an RC car and then build the project from there with a less complicated sensor since there is no need for an industrial ultrasonic sensor if we just wanted to get the distance of some object. REFERENCE: Seale, Eric. "DC Motors -- Background and History." DC Motors -- Background and History. Solarbotics Websites, n.d. Web. 10 May 2016. "Motor Shield v 1.2." - Robot Wiki. N.p., n.d. Web. 10 May 2016. "Obstacle Avoidance." Wikipedia. Wikimedia Foundation, n.d. Web. 10 May 2016. "URM37 v 4.0" - Robot Wiki. N.p., n.d. Web. 10 May 2016.