Final Report ph102
Final Report ph102
Team Members:
- Dhruva Kumar (Entry No. 2024EEB1196) – Coding, Wiring and Material Gathering
OBSTACLES IN ITS PATH AND ALTERS ITS Sensor Car provides a glimpse into
Arduino Uno
An ultrasonic sensor is a
device that uses ultrasonic
sound waves to measure
distance. It’s widely used in
robotics, automation, and
security applications for
obstacle detection and
ranging. The most common
ultrasonic sensor module is
the HC-SR04, which is
inexpensive and easy to use
with microcontrollers like
Arduino. Its range is from
2cm to 4m. It frequency is 40
kHz
Challenges
1. Assembly:
caster wheel.
driver.
detecting obstacles.
2. Programming:
- The ultrasonic sensor effectively detects obstacles within a range of 2-400 cm.
- The motor driver responds accurately to commands for turning and stopping.
- The car encounters minor delays during sensor processing, which could be optimized in
future iterations.
A. Smooth Navigation:
If the environment has few obstacles, the robot moves smoothly, adjusting direction
only when necessary.
B. Erratic Movements:
If obstacles are densely packed, the robot may show frequent changes in direction,
indicating high sensor activity.
C. Response Time:
The quicker the response time, the better the robot avoids obstacles without collisions.
D. Sensor Accuracy:
Higher accuracy sensors lead to better obstacle detection and smoother navigation.
Low accuracy or misaligned sensors can cause incorrect distance readings, affecting
the car’s navigation.
Continuous sensor operation and motor control drain the battery. The robot may slow
down or exhibit weaker obstacle avoidance as the battery depletes
Applications
Future
Improvements
- Adding more ultrasonic sensors to
detect obstacles in multiple
directions.
- Implementing a more complex
algorithm to make smoother turns.
- Using a more powerful battery to
enhance motor performance.
- Using large battery for longer run
time.
Results
- The car successfully moves forward
and stops when an obstacle is
detected.
- When the ultrasonic sensor detects
an object within 15 cm, the car stops,
turns right, and continues moving in
a different direction.
Conclusion
The Arduino ultrasonic sensor car
successfully detects and avoids
obstacles, demonstrating the
capability of ultrasonic sensing in
autonomous navigation. This project
highlights how simple components
can create a basic obstacle-avoiding
robot. Future improvements may
include adding sensors for smoother
directional control and optimizing
the response time.
Code
#define trigPin 9
#define echoPin 10
#define motor1Pin1 4
#define motor1Pin2 5
#define motor2Pin1 6
#define motor2Pin2 7
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
Serial.begin(9600);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
void moveForward() {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}
void stopCar() {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
}
void turnRight() {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}