WEBVTT

00:00.110 --> 00:00.530
All right.

00:00.530 --> 00:04.130
And let's finish this section with a servo motor.

00:04.130 --> 00:09.920
And just after that, we are going to practice with the Arduino components, the serial communication

00:09.920 --> 00:11.630
and the Raspberry Pi.

00:11.660 --> 00:14.720
So I'm going to add a servo here.

00:14.840 --> 00:16.970
So a micro servo.

00:17.000 --> 00:19.820
Okay, let's actually flip it.

00:21.040 --> 00:22.400
Like that.

00:22.420 --> 00:31.000
Okay, So on a classic hobby servo motor you will have here, you will see three different pins, okay?

00:31.060 --> 00:32.590
And three wires.

00:32.590 --> 00:38.020
So you will have a brown one, a red one and an orange one or something that is similar.

00:38.020 --> 00:41.110
So the brown one corresponds to the ground.

00:41.110 --> 00:47.230
So we are going to first connect the ground to the ground of the Arduino.

00:47.230 --> 00:50.470
So let's connect to the common ground here.

00:50.500 --> 00:54.340
Let's put that in black and then we have power.

00:54.460 --> 01:01.300
So power we can give five volt here and let's go here.

01:03.280 --> 01:05.610
That's going to be red.

01:05.630 --> 01:07.220
And then we have the signal.

01:07.220 --> 01:13.550
So the signal is basically to be connected to a digital pin.

01:13.550 --> 01:14.720
I'm going to use 12.

01:14.750 --> 01:23.780
So for this digital pin, you don't need any pin or any special pin, just any digital pin will do.

01:24.080 --> 01:26.420
And let's use a different color.

01:26.420 --> 01:28.430
Let's use brown.

01:29.860 --> 01:30.130
Okay.

01:30.130 --> 01:31.420
And that's it for the servo motor.

01:31.420 --> 01:34.180
But I'm going to explain you something a bit extra here.

01:34.180 --> 01:38.580
So here what you're doing is you're going to control the servo motor with PIN number 12.

01:38.590 --> 01:40.960
So that's going to give the command to the servo.

01:40.990 --> 01:42.550
But the servo is powered.

01:42.550 --> 01:42.870
Okay.

01:42.970 --> 01:43.990
From the Arduino.

01:43.990 --> 01:49.420
Also, the thing is that the servo motor, so if you use a hobby one, a standard one, it's completely

01:49.420 --> 01:49.870
fine.

01:49.870 --> 01:52.330
It's going to be powered on from the Arduino.

01:52.330 --> 01:52.750
Okay.

01:52.750 --> 01:53.980
That's obvious here.

01:53.980 --> 01:58.780
But the servo may draw more power than other components.

01:58.780 --> 02:06.070
So if you want to add multiple servers or give more strength to the servo, you may also want to add

02:06.070 --> 02:07.750
an external power supply.

02:07.750 --> 02:09.400
So I'm just going to show you.

02:09.670 --> 02:14.560
So I'm just going to use this nine volt battery here just as an example.

02:14.560 --> 02:19.030
So yours is not going to be that one that can be any other power supply.

02:19.060 --> 02:24.280
But basically what you can do is you can see when you have an external power supply, you have a negative

02:24.280 --> 02:25.330
and a positive.

02:25.330 --> 02:33.110
So let's actually connect these two to this side of the breadboard.

02:34.250 --> 02:38.510
Okay, So I'm going to put that in black and that in red.

02:38.960 --> 02:45.860
So now we have this side of the breadboard with the ground connected to the Arduino here, the line

02:45.860 --> 02:49.520
with five volts and now the other side here.

02:49.520 --> 02:53.540
So the, the piezo here is not in this.

02:53.540 --> 02:53.750
Okay?

02:53.750 --> 02:56.120
It's just on top, but it's just a visual.

02:56.420 --> 03:02.330
So you have another line with another ground and another plus line, which is this time the external

03:02.330 --> 03:03.200
power supply.

03:03.200 --> 03:09.800
And what you can do is that instead you can just power on the servo.

03:09.950 --> 03:11.660
So I'm just going to do this.

03:15.520 --> 03:22.360
So put the ground here and then the power supply is going to come from.

03:23.750 --> 03:24.350
The.

03:27.310 --> 03:29.110
External power supply.

03:30.290 --> 03:30.670
Okay.

03:30.670 --> 03:37.420
And one very important thing to do is to actually connect the grounds of everything, okay?

03:37.420 --> 03:42.520
Because if you don't connect the ground of everything, then the comment you're going to send here on

03:42.520 --> 03:44.380
PIN number 12 is not going to work.

03:44.410 --> 03:46.150
It's going to be some garbage comment.

03:46.150 --> 03:51.010
So you're going to connect the ground of this to the ground of the.

03:52.170 --> 03:52.560
Arduino.

03:52.560 --> 03:53.970
Make sure you connect the ground, okay.

03:53.970 --> 03:58.740
And not the ground to the VCC because you may have some problems.

03:59.680 --> 04:00.280
Okay.

04:00.990 --> 04:02.690
And now you have the same servomotor.

04:02.700 --> 04:10.210
You can give the same command, but it's externally powered by another battery or another power supply.

04:10.230 --> 04:12.210
So all the grounds are connected.

04:12.210 --> 04:14.610
Everything here is powered by the Arduino.

04:14.730 --> 04:16.950
The servo motor is powered by this.

04:17.100 --> 04:17.580
Okay.

04:17.580 --> 04:22.230
And then we still have the command from PIN number 12 that goes to the servo motor.

04:22.230 --> 04:29.730
And just one last thing is don't use PIN number 13 here on the Arduino Uno because PIN number 13 is

04:29.730 --> 04:32.430
also connected to the built in Led.

04:32.640 --> 04:39.000
And if you connect anything to that, well, you may have some unexpected behavior because this pin

04:39.000 --> 04:42.540
is going to be triggered automatically at some point.

04:42.540 --> 04:45.360
So just don't use the PIN number 13.

04:45.360 --> 04:51.660
So you can use PIN 2 to 12 on Arduino Uno because those ones are reserved.

04:51.690 --> 04:56.310
Better to reserve them for serial communication and this for the built in Led.

04:57.120 --> 04:57.540
All right.

04:57.540 --> 04:58.980
And that's it for the circuit.

05:00.060 --> 05:03.150
Then here is the real circuit with the servo motor.

05:03.180 --> 05:09.240
You can see here, I use a very small one and the gear is in a plastic here.

05:09.280 --> 05:13.180
Okay, that's very low quality one, but that's going to do for this course.

05:13.200 --> 05:19.170
That's basically the standard one, the cheapest you can find and maybe the one you have on your Arduino

05:19.170 --> 05:19.560
kit.

05:19.560 --> 05:25.770
And you can see I have some kind of stuff like this that I'm going to use on the servo for the final

05:25.770 --> 05:26.340
project.

05:26.340 --> 05:29.790
So you can see we have this wire here.

05:29.790 --> 05:37.800
So this cable with a brown, red and orange, So brown and red are connected here to ground and five

05:37.800 --> 05:38.970
volt of the Arduino.

05:39.000 --> 05:40.830
I'm not going to use an external power supply.

05:40.830 --> 05:43.200
I'm just going to power the servo from the Arduino.

05:43.230 --> 05:44.510
This is completely fine.

05:44.520 --> 05:44.760
Okay.

05:44.760 --> 05:46.740
For this circuit.

05:46.770 --> 05:52.530
It's just that if you want more servo or if you want to use that in a real application where you need

05:52.530 --> 05:54.780
to put a lot of torque.

05:54.810 --> 05:55.260
Okay.

05:55.260 --> 05:56.610
On the servo.

05:56.610 --> 05:58.200
So a lot of force on the servo.

05:58.230 --> 06:00.160
Maybe use an external power supply.

06:00.280 --> 06:07.720
So here I've just moved a bit the ground and the five volt line here on the right so I can put the servo

06:07.750 --> 06:08.770
here on the left.

06:08.950 --> 06:13.090
And then this is connected to PIN number 12.

06:13.390 --> 06:13.630
Okay.

06:13.630 --> 06:20.350
Just to show you, I have another servo so you can see that's completely different here about another

06:20.350 --> 06:20.740
one.

06:20.740 --> 06:23.170
And the gear here is in metal.

06:23.170 --> 06:27.790
And you can see when you buy a servo, usually you have stuff like this that comes with it.

06:27.820 --> 06:36.430
Okay, So you can just plug this to the servo so you can basically plug the servo to something mechanical,

06:36.430 --> 06:41.800
for example, a door mechanism or anything like a camera, anything that you want.

06:41.800 --> 06:47.950
So you can plug the servo here with the mechanical part with those tools here and you can see any hobby.

06:47.980 --> 06:50.200
Servo Well has the same.

06:50.320 --> 06:51.850
Okay, same connector.

06:51.850 --> 06:58.090
So I'm maybe going to use that one for the rest of the course, but that's the exact same servo.
