Ece 416 - Microprocessor System With Programming Finals Obstacle Avoiding Car
Ece 416 - Microprocessor System With Programming Finals Obstacle Avoiding Car
Ece 416 - Microprocessor System With Programming Finals Obstacle Avoiding Car
Submitted by:
Canubas, Brendalyn P.
Dalisay, Derick John M.
Quizon, Christian Joebert E.
EE - 5101
Submitted to:
Engr. Mark John Fel T. Rayos
II. Materials
Below are the materials used in making the activity.
III. Procedures
Here are the logical step by step procedures in making the activity.
1. Assemble all the chassis parts and attach the motors to the wheels (if not already
assembled).
2. Connect the red wire from the battery enclosure to Vin on the motor shield.
3. Connect the black wire from the battery enclosure to GND on the motor shield.
4. Connect the red wire from motor A to motor A+ on the motor shield, and the black
wire from motor A to A- on the motor shield.
5. Connect the red wire from motor B to B+ on the motor shield, and the black wire from
motor B to B- on the motor shield.
6. Attach the motor shield to the top of the Arduino Uno board. Be careful not to bend or
damage any of the pins.
7. Connect the Arduino Uno board to the computer via the USB cable and upload the
codes using the Arduino IDE software.
8. Insert four AA batteries in the battery enclosure.
9. Attach the servo motor and the ultrasonic sensor in front of the car kit. Make codes that
will command the car kit to avoid any obstacle that may come its way. Upload the codes to the
Arduino Uno.
9. Test your robot. Check if the motor pins are in the right places and make sure that no
pins are loose.
VI.Codes
#include <Servo.h> delay(100);
#include <NewPing.h> distance = readPing();
delay(100);
const int LeftMotorForward = 4; }
const int LeftMotorBackward = 5;
const int RightMotorForward = 6; void loop()
const int RightMotorBackward = 7; {
int distanceRight = 0;
#define TRIGGER_PIN A1 int distanceLeft = 0;
#define ECHO_PIN A2 delay(50);
#define MAX_DISTANCE 250
if (distance <= 20)
Servo servo_motor {
NewPing sonar(TRIGGER_PIN, moveStop();
ECHO_PIN, MAX_DISTANCE);
delay(300);
moveBackward();
boolean goesForward = false;
delay(400);
int distance = 100;
moveStop();
delay(300);
void setup()
distanceRight = lookRight();
{
delay(300);
pinMode(RightMotorForward, OUTPUT);
distanceLeft = lookLeft();
pinMode(LeftMotorForward, OUTPUT);
delay(300);
pinMode(LeftMotorBackward, OUTPUT);
int readPing()
void turnRight()
{
{
delay(100);
digitalWrite(RightMotorForward, LOW); {
digitalWrite(RightMotorBackward,HIGH); digitalWrite(RightMotorForward, HIGH);
digitalWrite(LeftMotorForward, HIGH); digitalWrite(RightMotorBackward, LOW);
digitalWrite(LeftMotorBackward, LOW); digitalWrite(LeftMotorForward, LOW);
} digitalWrite(LeftMotorBackward, HIGH);
}
void turnLeft()
VII. Conclusion
In this laboratory, the aim is to create an obstacle avoiding car which detects the obstacle
in his path and navigate according to the actions we set for it. This obstacle avoiding car was
designed and implemented with Arduino Uno microcontroller. Experimental work has been
carried out carefully.
Ultrasonic sensors were also used in this project to detect the obstacle in the way. The
ultrasonic sensor is attached in front of the car and it help the car navigate smoothly through
obstacle. The operation of the obstacle avoiding car is set through by having the car moved
forward direction. When an electrical pulse of high voltage is applied to the ultrasonic
transducer, it vibrates across a spectrum of frequencies and generates a burst of sound waves.
Whenever any obstacle comes ahead of the sensor, the waves will reflect back in the form of
echo and generates an electric pulse. It will allow the car to detect the obstacle in its path.
The codes for the Arduino were set by the students and help them familiarize the use and
functions of different components. This activity help the students to do different task and
programming in the future.