WEBVTT

00:00.000 --> 00:06.640
Ever noticed, cars within car shade that opens automatically when the sunlight gets too

00:06.640 --> 00:10.880
strong, or curtains that close on their own.

00:10.880 --> 00:16.480
When the sunlight becomes too bright, keeping the room cool and comfortable, that's all

00:16.480 --> 00:20.560
possible thanks to light avoiding technology.

00:20.560 --> 00:21.560
Welcome!

00:21.560 --> 00:25.320
In this video, we'll build an Arduino light avoiding robot.

00:25.320 --> 00:28.160
Let's see how it's built.

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

00:31.840 --> 00:34.240
The Arduino Uno Board.

00:34.240 --> 00:36.760
It is the brain of our project.

00:36.760 --> 00:41.280
Arduino is a microcontroller board that allows us to control and connect different electronic

00:41.280 --> 00:44.640
components like sensors, motors, etc.

00:44.640 --> 00:49.280
Our second component is the L298N motor driver.

00:49.280 --> 00:53.200
This component is used to control motors in our project.

00:53.200 --> 00:57.560
Our third component is two DC geared motors with two wheels.

00:57.560 --> 01:01.600
These motors are responsible for moving our robot.

01:01.600 --> 01:05.360
Our fourth component is the LDR sensor module.

01:05.360 --> 01:09.800
It helps the robot detect and follow the light.

01:09.800 --> 01:14.920
Our fifth component is the robot car chassis, along with other components used to mount

01:14.920 --> 01:21.440
parts like motors, the Arduino, battery, and sensors.

01:21.440 --> 01:25.960
There are several components are used like a battery to supply power, a rocker switch

01:26.080 --> 01:31.240
for control, and jumper wires to connect different parts of the robot.

01:31.240 --> 01:35.840
With all these components, along with some essential, we're going to build a light avoiding

01:35.840 --> 01:38.760
robot with Arduino.

01:38.760 --> 01:45.720
Let's understand the principles and real world applications of light avoiding robot car.

01:45.720 --> 01:51.280
The robot avoids light using its LDR sensors mounted at the front.

01:51.280 --> 01:55.920
Once light is detected, it begins to move, guided by the difference in light intensity

01:55.920 --> 01:59.200
between the left and right sensors.

01:59.200 --> 02:03.640
If the left sensor detects more light, the robot turns right, moving away from the light

02:03.640 --> 02:05.440
source.

02:05.440 --> 02:09.840
If the right sensor detects more light, it turns left.

02:09.840 --> 02:15.840
And if both sensors detect equal brightness, the robot either stops or reverses, avoiding

02:15.840 --> 02:18.520
moving toward the light.

02:18.520 --> 02:23.320
This continuous comparison helps the robot escape the brightest light, avoiding sources

02:23.320 --> 02:27.480
like flashlights or direct sunlight.

02:27.480 --> 02:33.000
The Arduino processes the sensor data in real time, adjusting motor speeds for smooth,

02:33.000 --> 02:38.680
responsive steering, ensuring the robot actively steers away from light even as brightness

02:38.680 --> 02:44.720
levels shift.

02:44.720 --> 02:50.080
Light avoiding technology is used in smart windows that automatically tint to block excess

02:50.080 --> 02:53.520
sunlight and save energy on air conditioning.

02:53.520 --> 02:59.000
It's also used in greenhouse automation systems, where shades or curtains adjust their position

02:59.000 --> 03:03.120
to protect plants from excessive light and heat.

03:03.120 --> 03:08.320
Let's explore the core components of a light avoiding robot and understand the science behind

03:08.320 --> 03:10.320
them.

03:10.320 --> 03:13.480
The Arduino Uno is the brain of the robot.

03:13.480 --> 03:17.520
It receives input from sensors and sends output to motors.

03:17.520 --> 03:21.600
The upload code to control how the robot behaves.

03:21.600 --> 03:28.800
Technically, the Arduino Uno is a development board based on the AT-Mega3-8P microcontroller.

03:28.800 --> 03:35.720
It includes digital and analog eye opens, a USB port for programming, a voltage regulator

03:35.720 --> 03:43.080
for stable 5 voltage power, a crystal oscillator for timing, and a reset button.

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

03:50.280 --> 03:56.240
This LDR sensor helps the robot detect light using changes in resistance, just like how automatic

03:56.240 --> 04:00.840
street lights turn on when it gets dark and turn off when it's bright.

04:00.840 --> 04:05.400
The LDR sensor responds to the brightness of surrounding light.

04:05.400 --> 04:11.480
As more light falls on it, the resistance decreases, allowing more current to flow.

04:11.480 --> 04:21.720
When there's less light, the resistance increases, and the current flows more slowly.

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

04:26.640 --> 04:31.240
The Arduino sends control signals, but those signals aren't strong enough to run motors

04:31.240 --> 04:32.240
directly.

04:32.240 --> 04:38.400
So, the motor driver boosts the control signals and sends them to the DC motors.

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

04:47.960 --> 04:53.480
It has terminal blocks for motor and power connections, input pins for signals from the

04:53.480 --> 04:58.280
Arduino, and enable pins for speed control.

04:58.280 --> 05:05.480
A built-in heat sink prevents the chip from overheating during operation.

05:05.480 --> 05:08.680
Let's build our light avoiding robot car.

05:08.680 --> 05:13.480
Begin by assembling all the required components.

05:13.480 --> 05:18.400
We'll start by soldering wires to each of the motor terminals, one for positive and

05:18.400 --> 05:20.400
one for negative.

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

05:27.680 --> 05:32.960
Assemble the chassis by securely mounting DC motors in place, ensuring proper alignment

05:32.960 --> 05:36.640
for smooth movement of the robot.

05:36.640 --> 05:42.600
Then attach the third wheel to the chassis, using screws and brass spacers.

05:42.600 --> 05:48.960
Next, attach each wheel firmly to the shaft of the DC motors.

05:48.960 --> 05:53.480
Use screws or double-sided tape to securely attach the motor driver.

05:53.480 --> 05:58.760
Carefully mount the L298N motor driver onto the chassis.

05:58.760 --> 06:05.520
Use a flat and central spot on the chassis to keep the wiring neat and balanced.

06:05.520 --> 06:10.600
Since we're using two motors, we'll connect one motor to each motor channel on the driver.

06:10.600 --> 06:14.680
Refer the circuit diagram and chart for connections.

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

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

06:25.080 --> 06:32.280
Now connect the Arduino to the L298N motor driver by wiring the control pins.

06:32.280 --> 06:38.000
Connect ENA to digital pin 5 on the Arduino to enable speed control for the left motor.

06:38.000 --> 06:45.600
Then connect IN1 and IN2 to pins D6 and D7 to control the direction of the left motor.

06:45.600 --> 06:52.880
Next, connect IN3 and IN4 to pins D8 and D9 for the right motor's direction.

06:52.880 --> 06:57.880
Finally, connect INB to pin D10 to control the speed of the right motor.

06:57.880 --> 07:07.600
This setup, let the Arduino control both the direction and speed of the motors using digital and PWM signals.

07:07.600 --> 07:12.560
Now, make the connections using jumper wires as shown in the circuit diagram,

07:12.560 --> 07:20.000
ensuring proper links between the LDR sensor, the servo motor and the Arduino board.

07:20.000 --> 07:25.760
Use a single red wire to supply VCC to both sensors, sharing the same power line.

07:25.760 --> 07:30.160
Then connect a single black wire from the GND pins of both sensors.

07:30.160 --> 07:35.480
Next, connect a purple wire to the A-open of the right LDR sensor

07:35.480 --> 07:40.160
and a green wire to the A-open of the left LDR sensor.

07:40.160 --> 07:47.080
Now, attach the LDR sensors to the chassis using double-sided tape to keep them secure.

07:47.080 --> 07:52.440
Next, attach the red VCC wire to the 5V pin on the Arduino

07:52.440 --> 07:56.760
and the black GND wire to one of the GND pins.

07:56.760 --> 08:02.280
Then, connect the green wire from the left LDR sensor to Arduino pin A1.

08:02.280 --> 08:07.400
Connect the purple wire from the right LDR sensor to Arduino pin A0.

08:07.400 --> 08:13.000
These connections allow the Arduino to read light levels from both sensors.

08:13.000 --> 08:18.200
Now, power the Arduino using the L298N motor driver.

08:18.200 --> 08:23.240
Connect the VIN pin of the Arduino to the 5V pin on the motor driver.

08:23.240 --> 08:30.200
Then, connect the GND pin of the Arduino to the GND pin on the motor driver.

08:30.200 --> 08:34.680
Mount the battery on the robot chassis to power the robot.

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

08:40.760 --> 08:46.200
Connect the positive terminal of the battery to the VCC pin on the motor driver

08:46.200 --> 08:50.120
and the negative terminal to the GND pin.

08:50.120 --> 08:55.560
This will supply power to both the motors and the Arduino.

08:55.560 --> 09:04.600
Now that all the components are connected, our light avoiding robot is ready for programming and testing.

09:04.600 --> 09:09.720
Let us program and test our light avoiding robot.

09:09.720 --> 09:15.160
Connect the robots Arduino to the laptop using the Arduino USB cable.

09:16.280 --> 09:23.240
Open the Arduino IDE, then go to file, then open and select your line avoiding robot code.

09:23.800 --> 09:27.240
In the Tools menu, select board and then Arduino Uno.

09:28.200 --> 09:31.160
Then, go to port and select the correct COM port.

09:33.080 --> 09:36.680
Next, click the Verify button to check for any errors in the code.

09:37.640 --> 09:41.800
Once it's verified, click the upload button to send the code to the Arduino.

09:42.760 --> 09:47.320
Finally, wait for the done uploading message to confirm the process is complete.

09:48.280 --> 09:51.400
Now, you can safely disconnect your laptop from the Arduino.

09:54.360 --> 09:59.240
Now, let's adjust the LDR sensors for accurate light detection.

09:59.240 --> 10:03.720
Place the robot in a well lit area and use a torch to test the sensors.

10:04.200 --> 10:07.320
Shine the torch on the right sensor, then on the left.

10:07.960 --> 10:13.240
When light hits the sensor, the robot should turn away, avoiding the light source.

10:13.240 --> 10:16.680
Repeat to make sure both sensors respond properly.

10:17.320 --> 10:20.520
This ensures the robot stays in the shade effectively.

10:22.920 --> 10:25.560
Now, let's see the robot in action.

10:26.280 --> 10:29.000
Place it on a flat surface and turn on the switch.

10:29.720 --> 10:33.960
The robot stays still until light falls on its LDR sensors.

10:34.520 --> 10:38.120
As soon as it detects light, it quickly turns away from the source.

10:38.680 --> 10:41.000
The sensors constantly compare light levels.

10:41.720 --> 10:48.680
And the robot adjusts its path to stay in the shade, all guided by simple sensors and smart logic.

