WEBVTT

00:00.000 --> 00:04.000
Ever wondered how self-driving tractors avoid rocks in a farm field?

00:04.000 --> 00:08.000
Or how delivery drones steer clear of trees and power lines while flying?

00:08.000 --> 00:12.000
That's all thanks to obstacle avoidance technology.

00:12.000 --> 00:18.000
Welcome! In this video, we'll build an Arduino obstacle avoiding robot car.

00:18.000 --> 00:20.000
Let's see how it's made.

00:20.000 --> 00:24.000
Let's start with the first and most important component of our project.

00:24.000 --> 00:26.000
The Arduino Uno Board.

00:26.000 --> 00:28.000
It is the brain of our project.

00:28.000 --> 00:36.000
Our Arduino is a microcontroller board that allows us to control and connect different electronic components like sensors, motors, etc.

00:36.000 --> 00:40.000
Our second component is the L298N motor driver.

00:40.000 --> 00:44.000
This component is used to control motors in our project.

00:44.000 --> 00:50.000
Our third component is four DC geared motors with four wheels.

00:50.000 --> 00:52.000
These motors are responsible for moving our robot.

00:52.000 --> 00:58.000
Fourth component is the ultrasonic sensor, HCS-R04.

00:58.000 --> 01:04.000
It helps to the robot for detect obstacles and avoid crashing into things.

01:04.000 --> 01:08.000
Our fifth component is the robot car chassis.

01:08.000 --> 01:16.000
Along with other components used to mount parts like motors, the Arduino, battery, and sensors.

01:16.000 --> 01:20.000
Our next component is the Servo Motor SG90.

01:20.000 --> 01:24.000
It is used to rotate the ultrasonic sensor, allowing it to scan the surroundings.

01:24.000 --> 01:30.000
Several components are used like a battery to supply power, a rocker switch for control,

01:30.000 --> 01:34.000
and jumper wires to connect different parts of the robot.

01:34.000 --> 01:42.000
With all these components, along with some essential, we're going to build an obstacle avoiding robot.

01:42.000 --> 01:48.000
Let's understand the principles and real world applications of obstacle avoiding robots.

01:48.000 --> 01:52.000
The robot starts by moving forward on its own.

01:52.000 --> 01:58.000
While it moves, the ultrasonic sensor continuously measures the distance to any object in front of it.

01:58.000 --> 02:04.000
If the sensor detects an object within 20 centimeters, the robot stops immediately to avoid a collision.

02:04.000 --> 02:13.000
Next, the Servo Motor rotates the ultrasonic sensor to the left and right, scanning both sides like the robot is looking for a clear path.

02:13.000 --> 02:16.000
It compares the distance on both sides.

02:16.000 --> 02:20.000
If the left side is clear, the robot turns left.

02:20.000 --> 02:23.000
If the right side is clearer, it turns right.

02:23.000 --> 02:29.000
This decision is made in real time using the code uploaded to the Arduino.

02:29.000 --> 02:33.000
But if both sides are blocked, the robot takes a smart step back.

02:33.000 --> 02:40.000
It moves in reverse for a short distance, then turns in a different direction to find a new path.

02:40.000 --> 02:45.000
Obstacle avoiding technology like this is widely used in self-driving cars.

02:45.000 --> 02:49.000
To detect and avoid pedestrians, other vehicles, or roadblocks.

02:49.000 --> 02:58.000
It's also used in robotic vacuum cleaners, helping them avoid walls, furniture, and stairs while cleaning homes efficiently.

02:58.000 --> 03:05.000
Let's explore the core components of an obstacle avoiding robot and understand the science behind them.

03:05.000 --> 03:08.000
The Arduino Uno is the brain of the robot.

03:08.000 --> 03:12.000
It receives input from sensors and sends output to motors.

03:12.000 --> 03:16.000
We upload code to control how the robot behaves.

03:16.000 --> 03:23.000
Technically, the Arduino Uno is a development board based on the AT-MEGA-328P microcontroller.

03:23.000 --> 03:33.000
It includes digital and analog eye-opens, a USB port for programming, a voltage regulator for stable 5 voltage power,

03:33.000 --> 03:38.000
a crystal oscillator for timing, and a reset button.

03:38.000 --> 03:45.000
It runs C and C++ code and controls sensors and motors in real time.

03:45.000 --> 03:52.000
This ultrasonic sensor helps the robot detect obstacles, just like how bats use sound to sense their surroundings.

03:52.000 --> 03:58.000
It sends out an ultrasonic pulse and waits for the sound to bounce back from an object.

03:58.000 --> 04:05.000
By calculating the time it takes for the one wave to return, the robot figures out how far away the object is.

04:05.000 --> 04:13.000
It uses basic formula, distance equals speed of sound, multiplied by time, and divided by two.

04:13.000 --> 04:18.000
The motor driver acts like a power manager between the Arduino and the motors.

04:18.000 --> 04:24.000
The Arduino sends control signals, but those signals aren't strong enough to run motors directly.

04:24.000 --> 04:29.000
So the motor driver boosts the control signals and sends them to the DC motors.

04:29.000 --> 04:39.000
The L298N motor driver includes the main L298N IC, which controls motor direction and power.

04:39.000 --> 04:49.000
It has terminal blocks for motor and power connections, input pins for signals from the Arduino, and enable pins for speed control.

04:49.000 --> 04:55.000
A built-in heat sink prevents the chip from overheating during operation.

04:55.000 --> 05:06.000
The servo motor is a special type of motor that can rotate to a specific angle, like zero degrees, 90 degrees, or 180 degrees, and hold that position.

05:06.000 --> 05:11.000
We use the servo to rotate the ultrasonic sensor side to side.

05:11.000 --> 05:18.000
This way, the robot can scan both left and right before making a decision about which direction to move.

05:19.000 --> 05:27.000
Now, let's build our obstacle-avoiding robot car. Begin by assembling all the required components.

05:27.000 --> 05:34.000
We'll start by soldering wires to each of the motor terminals, one for positive, and one for negative.

05:34.000 --> 05:41.000
Make sure the solder joints are strong and clean to avoid any loose connections during operation.

05:42.000 --> 05:51.000
Assemble the chassis by securely mounting all four DC motors in place, ensuring proper alignment for smooth movement of the robot.

05:51.000 --> 05:56.000
Attach each wheel firmly to the shaft of the four DC motors.

05:56.000 --> 06:01.000
Use screws or double-sided tape to securely attach the motor driver.

06:01.000 --> 06:07.000
Next, carefully mount the L298N motor driver onto the chassis.

06:07.000 --> 06:13.000
Choose a flat and central spot on the chassis to keep the wiring neat and balanced.

06:13.000 --> 06:18.000
Since we're using four motors, we'll connect two motors to each motor channel on the driver.

06:18.000 --> 06:22.000
Refer the circuit diagram and chart for connections.

06:22.000 --> 06:26.000
Now it's time to mount the Arduino board onto the chassis.

06:26.000 --> 06:32.000
Choose a central or rear area of the chassis where the board is safe and accessible for wiring.

06:32.000 --> 06:39.000
Now, connect the Arduino to the L298N motor driver by wiring the control pins.

06:39.000 --> 06:46.000
Connect IN1 and IN2 to Arduino pins D7 and D8 for the left motors.

06:46.000 --> 06:53.000
Then, connect IN3 and IN4 to D9 and D10 for the right motors.

06:53.000 --> 07:00.000
Connect ENA to D5 and ENB to D6 to enable speed control.

07:00.000 --> 07:08.000
This setup lets the Arduino control motor direction and speed using digital and PWM signals.

07:08.000 --> 07:18.000
Now, it's time to mount the ultrasonic sensor on top of the servo motor using the ultrasonic sensor holder for stable and accurate positioning.

07:18.000 --> 07:22.000
Next, mount the servo motor on the front side of the chassis.

07:22.000 --> 07:28.000
This setup allows the sensor to rotate and scan the surroundings for obstacles.

07:28.000 --> 07:40.000
Now, make the connections using jumper wires as shown in the circuit diagram, ensuring proper links between the ultrasonic sensor, servo motor and Arduino board.

07:40.000 --> 07:52.000
After connecting the ultrasonic sensor and servo motor to one end of the jumper wires, now let us connect the other ends to the Arduino board and motor driver as per the circuit diagram.

07:52.000 --> 08:00.000
The echo pin from the ultrasonic sensor connects to D12 on the Arduino and the trick pin connects to D11.

08:00.000 --> 08:08.000
Both GND pins from the sensor and the servo motor are connected to the motor driver's GND.

08:08.000 --> 08:16.000
The VCC pins from both the sensor and the servo motor are connected to the 5V output on the motor driver.

08:16.000 --> 08:22.000
Finally, the signal wire from the servo motor goes to D3 on the Arduino.

08:22.000 --> 08:32.000
Now, connect the Arduino 5V pin to the plus 5V pin of the L298N motor driver.

08:32.000 --> 08:38.000
Then, connect the Arduino GND to the GND of the motor driver.

08:38.000 --> 08:42.000
Mount the battery on the robot chassis to power the robot.

08:42.000 --> 08:48.000
We'll connect the battery using a switch button to the L298N motor driver.

08:48.000 --> 08:58.000
Connect the positive terminal of the battery to the VCC pin on the motor driver and the negative terminal to the GND pin.

08:58.000 --> 09:03.000
This will supply power to both the motors and the Arduino.

09:04.000 --> 09:12.000
All the components are connected. Our obstacle avoiding robot is ready for programming and testing.

09:12.000 --> 09:17.000
Let us program and test our obstacle avoiding robot.

09:17.000 --> 09:24.000
Connect the robots Arduino to the laptop using the Arduino USB cable.

09:24.000 --> 09:30.000
Open the Arduino IDE, click on the Tools menu, then select Board.

09:31.000 --> 09:37.000
Then, Arduino AV-R board. Then, Arduino Uno.

09:37.000 --> 09:43.000
After that, click on the Port option and choose the correct port for your Arduino.

09:43.000 --> 09:47.000
Let's take a look at the code for our project.

09:47.000 --> 09:53.000
First, we define the pins for the motors, sensor and servo.

09:53.000 --> 10:00.000
Then, in the Loop section, the robot constantly checks the distance using the Ultrasonic sensor.

10:00.000 --> 10:05.000
If there's no obstacle within 30 centimeters, the robot keeps moving forward.

10:05.000 --> 10:13.000
All these values work together. To make real-time decisions, helping the robot avoid obstacles as it moves.

10:13.000 --> 10:17.000
After editing the code, click the Verify button.

10:17.000 --> 10:21.000
Once the code is successfully verified, click the Upload button.

10:21.000 --> 10:28.000
When the message done uploading appears on the screen, you can safely remove the Arduino cable.

10:28.000 --> 10:35.000
Now, let's see the robot in action. Place it on a flat surface and turn on the switch.

10:35.000 --> 10:40.000
It moves forward, stops if it sees something, then scans and turns.

10:40.000 --> 10:48.000
If stuck, it backs up and tries a new direction, all guided by simple sensors and logic.

10:51.000 --> 10:56.000
Now, let's take a look at the robot.

10:56.000 --> 11:01.000
Now, let's take a look at the robot.

11:01.000 --> 11:06.000
Now, let's take a look at the robot.

