WEBVTT

00:00.080 --> 00:03.810
Before we get started with the course, let's understand why.

00:03.830 --> 00:06.560
Why use both Raspberry Pi and Arduino?

00:06.560 --> 00:10.010
And why not just Raspberry Pi or just Arduino?

00:10.040 --> 00:16.430
In this video, I will explain this to you with a practical mindset so you can start with a better understanding

00:16.430 --> 00:18.560
which will help you throughout the course.

00:18.590 --> 00:24.860
The first and maybe the biggest difference is that Arduino is run by a microcontroller, whereas the

00:24.860 --> 00:28.100
Raspberry Pi is run by a microprocessor.

00:28.100 --> 00:31.990
So the microcontroller on the Arduino is quite simple.

00:32.000 --> 00:37.040
It's going to run just one program at the maximum speed capacity.

00:37.040 --> 00:38.000
That's it.

00:38.030 --> 00:43.700
On the Raspberry Pi, you have a microprocessor, which is something completely different.

00:43.790 --> 00:49.110
A microprocessor is what you also have on your computer, on your phone, etcetera.

00:49.130 --> 00:55.220
You usually install an operating system on it and then you can run many programs to do many different

00:55.220 --> 00:55.820
things.

00:55.820 --> 01:02.130
If you compare the specs of the microcontroller and the Arduino Uno and the microprocessor on the Raspberry

01:02.130 --> 01:08.790
Pi four, well, there is a world of difference, but and that's what we're going to see now with those

01:08.790 --> 01:14.490
specs and a few more details I'm going to add later, you will see that the Arduino is better suited

01:14.490 --> 01:20.940
for controlling hardware components, and the Raspberry Pi is better suited for software applications

01:20.940 --> 01:23.120
with more processing power.

01:23.130 --> 01:29.640
Now you might say, well, there are some applications that you can do with either an Arduino or a Raspberry

01:29.640 --> 01:31.110
Pi, for example.

01:31.110 --> 01:37.830
If you try to control an Led with a push button, this can be done with both boards with the same result.

01:37.830 --> 01:42.720
So yes, for a few applications, both boards are going to overlap.

01:42.720 --> 01:47.250
And for those kinds of applications, there is no right or wrong solution.

01:47.250 --> 01:52.410
Now let's focus on what the Arduino can do better than the Raspberry Pi.

01:52.470 --> 01:57.780
First, there are some hardware functionalities that are only possible with Arduino.

01:57.810 --> 02:04.860
The Gpio panel on the Raspberry Pi is great, but quite limited when you compare it to the pins on the

02:04.860 --> 02:12.150
Arduino, for example, Only with Arduino you can read from an analog sensor that can be a potentiometer,

02:12.150 --> 02:14.160
a photoresistor, etcetera.

02:14.190 --> 02:18.000
There is no way to do that directly with the Raspberry Pi Gpio.

02:18.000 --> 02:26.310
Also, some of the pins have a functionality which very basically allows you to send a custom voltage

02:26.310 --> 02:33.510
to a component instead of just for example, zero and five volt on Arduino is native and is handled

02:33.510 --> 02:39.360
by the hardware, which means that it's not going to take away any software resources on the Raspberry

02:39.360 --> 02:40.770
Pi you could use.

02:41.520 --> 02:43.410
But this is not a hardware one.

02:43.440 --> 02:50.490
This is a software, which means that it's going to take resources from your CPU and it's maybe not

02:50.490 --> 02:53.250
going to be as stable as on the Arduino.

02:53.250 --> 02:57.210
Then the Arduino is best suited to control motors.

02:57.210 --> 03:03.960
And one additional thing here which is quite important is the capability to respect real time constraints.

03:03.960 --> 03:06.150
So what is the real time constraint?

03:06.150 --> 03:07.920
Let's use an example here.

03:07.920 --> 03:15.060
So let's say that you are controlling a motor and you need to give a command to the motor every 20 microseconds.

03:15.060 --> 03:21.990
If you fail to give the next command before 20 microseconds, the motor will not behave very smoothly.

03:21.990 --> 03:27.600
So with the Arduino, no problem because of the nature of the microcontroller, it's just running one

03:27.600 --> 03:35.070
program and it's what we call deterministic, which means that you know exactly how long a command will

03:35.070 --> 03:37.230
take to execute every time.

03:37.230 --> 03:44.100
So if you write your code, well, you can respect the 20 microseconds delay every time on the Raspberry

03:44.100 --> 03:46.950
Pi, things are completely different.

03:46.980 --> 03:51.840
The operating system you are running has a scheduler for all the tasks.

03:51.840 --> 03:59.100
The scheduler will try its best to make all the tasks run as smoothly as possible, but it can't guarantee

03:59.130 --> 04:06.360
that one particular program is going to respect exactly 20 microseconds between each command it sends.

04:06.390 --> 04:12.150
If, for example, another independent program is taking too much resources, then the first program

04:12.150 --> 04:14.850
which controls your motor, is going to slow down.

04:14.850 --> 04:19.320
And that's a problem, especially when you control physical hardware components.

04:19.320 --> 04:25.440
So in this course for the activities and project, we won't have to deal with this real time constraint.

04:25.440 --> 04:32.010
But I wanted to explain it briefly here so you can understand that it's very important parameter which

04:32.010 --> 04:35.820
you will need to take into account for some of your future projects.

04:35.850 --> 04:36.330
All right.

04:36.330 --> 04:42.630
You can already see that the Arduino is superior to the Raspberry Pi for quite a few things that are

04:42.630 --> 04:45.300
related to hardware control.

04:45.330 --> 04:51.780
Now let's give a chance to the Raspberry Pi and see when it is better than the Arduino on Raspberry

04:51.780 --> 04:52.110
Pi.

04:52.140 --> 04:54.600
You get a complete operating system.

04:54.600 --> 04:59.340
For example, Linux with the Raspberry Pi OS and you can install many more.

04:59.900 --> 05:06.590
For example, Ubuntu, Android and even some versions of Windows if you want to with a complete operating

05:06.590 --> 05:07.070
system.

05:07.070 --> 05:12.950
Well, instead of running just one program, you can see that we have a world of possibilities that

05:12.950 --> 05:15.890
are not available on the Arduino, on the Raspberry Pi.

05:15.920 --> 05:21.710
You can program with C plus plus, but also with Python, which we are actually going to do in this

05:21.710 --> 05:22.250
course.

05:22.280 --> 05:25.190
In fact, you could use any programming language you want.

05:25.190 --> 05:27.140
And now a few more examples.

05:27.140 --> 05:34.190
With Raspberry Pi, you can control a camera, for example, the Pi camera or any USB camera or webcam

05:34.190 --> 05:35.960
that you just need to plug in.

05:35.960 --> 05:41.210
And to that you can add computer vision, artificial intelligence with machine learning.

05:41.420 --> 05:42.290
ET cetera.

05:42.320 --> 05:46.250
You can also host a complete web server if you want to.

05:46.250 --> 05:51.530
And well, on the Raspberry Pi, basically you can just run many different applications and programs

05:51.530 --> 05:55.220
simultaneously with scheduling and Multithreading.

05:55.220 --> 06:01.950
Multithreading is super powerful and it's something that doesn't exist on the Arduino on Arduino.

06:01.950 --> 06:09.000
By writing your code, well, you can kind of fake it and create a multitask program, but nothing to

06:09.000 --> 06:11.340
see with what you can do with the Raspberry Pi.

06:11.370 --> 06:11.640
Okay.

06:11.640 --> 06:16.230
And I'm going to stop here because the list could go on and on and on forever.

06:16.230 --> 06:23.820
But what you can see here is that the Raspberry Pi is superior to the Arduino when it comes to software.

06:23.850 --> 06:31.350
To recap, Arduino is better for hardware or low level control, and Raspberry Pi is better for application

06:31.350 --> 06:33.840
software or high level control.

06:33.840 --> 06:38.340
So depending on your project, maybe you just need one board.

06:38.370 --> 06:45.150
If your application is to take some photos, process them and publish them on a web page, then just

06:45.150 --> 06:46.540
go with a Raspberry Pi.

06:46.560 --> 06:52.800
If, however, you want to just open a door with a motor when you detect a presence nearby, Arduino

06:52.800 --> 06:54.500
will do 100%.

06:54.510 --> 07:02.220
But if you need to combine both hardware control and high level software applications, then why not

07:02.220 --> 07:08.730
use the best of both worlds and use the combination Raspberry Pi and Arduino?

07:08.760 --> 07:15.330
With this combination, you can do a much more complete and complex project by taking advantage of each

07:15.330 --> 07:16.860
board's superiority.

07:16.860 --> 07:21.990
That's what we're going to do in the Intercom project, where we will use the Raspberry Pi to handle

07:21.990 --> 07:28.380
a telegram bot and take some photos and the arduino to control a servo motor, as well as other hardware

07:28.380 --> 07:29.670
components that use.

07:29.670 --> 07:36.570
For example, the Raspberry Pi will send comments to the Arduino, and the Arduino will also send some

07:36.570 --> 07:38.790
data back to the Raspberry Pi.

07:38.790 --> 07:45.270
And you may not be aware of it, but this combination of microprocessor plus microcontroller is actually

07:45.270 --> 07:46.500
used everywhere.

07:46.500 --> 07:53.100
If you have a phone, a computer, a TV, well, all of them are using a microprocessor as the main

07:53.100 --> 07:54.270
software control.

07:54.270 --> 08:00.390
And then this microprocessor is connected to many microcontrollers which are handling the hardware.

08:00.600 --> 08:06.720
A more robotic example, maybe if you take a mobile robot with autonomous navigation, well, you would

08:06.720 --> 08:13.410
have a microprocessor to handle localization, high level motion planning, image processing.

08:13.410 --> 08:14.250
ET cetera.

08:14.250 --> 08:20.100
And you have some microcontrollers to control the wheels with real time constraints and also get data

08:20.100 --> 08:21.660
from different sensors.

08:21.690 --> 08:29.100
To conclude, you can see the Raspberry Pi or microprocessor as the brain of your application and the

08:29.100 --> 08:33.840
Arduino or microcontroller as the muscles of your application.

08:33.960 --> 08:34.500
All right.

08:34.530 --> 08:40.200
Now that you have a better understanding of the big picture, you are ready to start the course.
