WEBVTT

00:00.000 --> 00:06.080
ever noticed how you can control a drone with just a few commands from your phone or computer

00:06.720 --> 00:10.800
or how warehouse robots can move forward, turn, and stop.

00:11.520 --> 00:16.960
Exactly when we tell them to? That's all possible thanks to a programmable smart car.

00:18.080 --> 00:24.080
Welcome. In this video, we'll build our own two WD smart car. Let's see how it's built.

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

00:30.000 --> 00:36.640
The Raspberry Pi. It is the brain of our smart car. The Raspberry Pi is a small but powerful

00:36.640 --> 00:41.920
computer that allows us to connect and control different electronic components, like motor drivers,

00:41.920 --> 00:50.240
motors, and sensors. Our second component is the L298N motor driver. This component is used to

00:50.240 --> 00:56.720
control motors in our project. Our third component is two DC geared motors with two wheels.

00:57.280 --> 01:00.160
These motors are responsible. These motors are responsible.

01:01.840 --> 01:07.120
Our fifth component is the robot car chassis. Along with other components used to mount

01:07.120 --> 01:15.680
parts like motors, the Arduino, battery, and sensors. Our sixth component is the power bank with

01:15.680 --> 01:21.680
cable. It powers the Raspberry Pi and protects it from voltage drops while the motors run.

01:22.160 --> 01:28.480
There are several components are used like battery to supply power, a rocker switch for control,

01:29.200 --> 01:34.400
and jumper wires to connect different parts of the robot. With all these components,

01:34.400 --> 01:39.440
along with some essential, we're going to build a two WD smart car with Raspberry Pi.

01:40.960 --> 01:46.240
Let's understand the principles and real-world applications of a two-wheel drive smart car.

01:46.960 --> 01:53.920
The smart car moves based on instructions sent by the command center from a laptop or remote

01:53.920 --> 02:02.560
control interface. First, open the Raspberry Pi OS on your laptop. Then, launch the Thani IDE

02:02.560 --> 02:08.400
Editor where you can enter commands for the smart car to follow. When F is entered, the car moves

02:08.480 --> 02:15.680
forward. When F is entered, the car stops immediately. If B is entered, it moves backward.

02:16.480 --> 02:24.560
R turns it to the right and L turns the car to the left. After pressing T, it runs a testing

02:24.560 --> 02:33.200
sequence and pressing Q quits the program. The Raspberry Pi processes these commands in real time,

02:33.200 --> 02:39.200
sending control signals to the motor driver, which adjusts motor direction and speed accordingly.

02:40.000 --> 02:44.800
This ensures the car responds instantly and smoothly to every instruction.

02:47.120 --> 02:53.200
This technology is widely used in remote control drones for quick, precise responses to pilot

02:53.200 --> 02:59.760
commands. It's also found in industrial robots that require precise, real-time movement,

03:00.400 --> 03:07.280
ensuring they react instantly to every command. Let's explore the core components of a two-wheel

03:07.280 --> 03:15.280
drive smart car and understand the science behind them. The Raspberry Pi is the brain of the robot.

03:15.840 --> 03:23.280
It processes commands, controls the motors, and can interact with sensors. We upload Python code

03:23.360 --> 03:30.160
to control how the robot behaves. Technically, the Raspberry Pi is a small, single-board computer.

03:31.040 --> 03:36.240
It includes USB ports for peripherals, HDMI for display,

03:38.080 --> 03:44.000
GPIO pins for connecting electronic components, a processor for running programs,

03:44.960 --> 03:50.720
and built-in storage via a micro SD card. It runs a full operating system,

03:51.280 --> 03:53.360
and processes tasks in real time.

03:56.640 --> 04:00.640
The motor driver acts like a power manager between the Raspberry Pi and the motors.

04:01.440 --> 04:06.320
The Raspberry Pi sends control signals, but those signals aren't strong enough to run motors

04:06.320 --> 04:12.080
directly. So the motor driver boosts the control signals and sends them to the DC motors.

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

04:22.800 --> 04:29.200
It has terminal blocks for motor and power connections, input pins for signals from the Raspberry Pi,

04:29.840 --> 04:36.720
and enable pins for speed control. A built-in heat sink prevents the chip from overheating during

04:36.720 --> 04:46.640
operation. Now let's build our 2WD smart car. Begin by assembling all the required components.

04:48.720 --> 04:54.240
We'll start by soldering wires to each of the motor terminals, one for positive, and one for

04:54.240 --> 04:59.920
negative. Make sure the solder joints are strong and clean to avoid any loose connections during

04:59.920 --> 05:07.920
operation. Assemble the chassis by securely mounting DC motors in place, ensuring proper

05:07.920 --> 05:14.480
alignment for smooth movement of the robot. Then attach the third wheel to the chassis,

05:14.480 --> 05:21.600
using screws and brass spacers. Next, attach each wheel firmly to the shaft of the DC motors.

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

05:28.000 --> 05:32.400
Carefully mount the L298N motor driver onto the chassis.

05:33.280 --> 05:37.920
Choose a flat and central spot on the chassis to keep the wiring neat and balanced.

05:39.200 --> 05:43.600
Since we're using two motors, we'll connect one motor to each motor channel on the driver.

05:44.160 --> 05:46.800
Refer the circuit diagram and chart for connections.

05:48.640 --> 05:55.680
Now, place the small chassis plate on top of the main chassis. Use brass spacers and nuts

05:55.760 --> 06:02.080
to secure it in place. This upper section adds stability and provides a sturdy platform to mount

06:02.080 --> 06:10.640
the Raspberry Pi securely. Next, place the Raspberry Pi on top of the small upper chassis plate,

06:10.640 --> 06:15.600
using spacers or double-sided tape to keep it stable and secure.

06:17.440 --> 06:23.840
Now, connect the L298N motor driver to the Raspberry Pi using jumper wires.

06:24.800 --> 06:29.760
Make sure each control pin is connected to the correct GPIO pin on the pie.

06:31.920 --> 06:39.600
IN1 goes to GPIO17, which is physical pin 11 and controls motor A direction.

06:39.600 --> 06:46.880
IN2 goes to GPIO27, which is physical pin 13, also for motor A direction.

06:46.880 --> 06:54.320
ENA connects to GPIO4, which is physical pin 7 and controls motor A speed using PWA.

06:55.280 --> 07:01.120
IN3 goes to GPIO5, which is physical pin 29 for motor B direction.

07:01.920 --> 07:09.120
IN4 connects to GPIO6, which is physical pin 31, also for motor B direction.

07:09.120 --> 07:17.440
INB goes to GPIO13, which is physical pin 33 and controls motor B speed via PWM.

07:18.400 --> 07:23.920
Refer to the wiring chart and Raspberry Pi pin diagram for a clearer understanding of these connections.

07:25.920 --> 07:33.440
And finally, connect the GND of the L298N motor driver to the ground pin on the Raspberry Pi,

07:33.520 --> 07:34.960
which is physical pin 6.

07:37.520 --> 07:44.640
Now, mount the lithium batteries securely onto the chassis to supply power to the L298N motor driver.

07:45.600 --> 07:49.840
Connect the battery's negative terminal to the GND of the motor driver.

07:51.040 --> 07:58.720
Use a switch, connecting the battery's positive terminal to the plus 12 volt input on the L298N motor driver,

07:58.720 --> 08:01.760
so you can easily turn the power on or off when needed.

08:03.600 --> 08:08.320
Now, provide external power to the Raspberry Pi, using a power bank,

08:09.040 --> 08:13.840
or a dedicated USB power supply, ensuring stable performance,

08:13.840 --> 08:17.040
and protecting it from voltage drops caused by the motor load.

08:19.280 --> 08:21.120
Now, all the components are connected.

08:21.760 --> 08:25.680
Our two-wheel drive smart car is ready for programming and testing.

08:27.600 --> 08:30.400
Let us program and test our 2WD smart car.

08:33.760 --> 08:39.760
Now, turn on the mobile hotspot that you configured earlier during the Raspberry Pi setup.

08:40.560 --> 08:44.720
Power on the Raspberry Pi and open the Raspberry Pi OS.

08:44.720 --> 08:48.480
Now, open the programming menu and select THONNY IDE.

08:49.120 --> 08:54.080
Open your Python code, then save the file with a .py extension.

08:54.880 --> 08:56.720
Go ahead and run your program.

08:57.440 --> 09:03.200
When your code runs successfully, you'll see a prompt on the screen where you can enter commands

09:03.200 --> 09:04.320
to control the robot.

09:06.080 --> 09:09.600
Now, let's see the 2WD smart car in action.

09:10.320 --> 09:16.240
In the prompt, enter commands to control the car, F for forward, D for backward,

09:16.240 --> 09:21.840
L for left, R for right, S to stop, T for testing, and Q to quit.

09:22.640 --> 09:27.600
As soon as you type a command and press enter, the robot reacts instantly,

09:27.600 --> 09:31.040
turning, moving, or stopping exactly is instructed.

09:31.840 --> 09:35.920
This quick response makes it easy to guide the robot with precision,

09:35.920 --> 09:40.560
similar to how warehouse robots, or remote operated vehicles,

09:40.560 --> 09:50.080
respond to operator inputs in real time.

