Before we get started with the course, let's understand why.
Why use both Raspberry Pi and Arduino?
And why not just Raspberry Pi or just Arduino?
In this video, I will explain this to you with a practical mindset so you can start with a better understanding
which will help you throughout the course.
The first and maybe the biggest difference is that Arduino is run by a microcontroller, whereas the
Raspberry Pi is run by a microprocessor.
So the microcontroller on the Arduino is quite simple.
It's going to run just one program at the maximum speed capacity.
That's it.
On the Raspberry Pi, you have a microprocessor, which is something completely different.
A microprocessor is what you also have on your computer, on your phone, etcetera.
You usually install an operating system on it and then you can run many programs to do many different
things.
If you compare the specs of the microcontroller and the Arduino Uno and the microprocessor on the Raspberry
Pi four, well, there is a world of difference, but and that's what we're going to see now with those
specs and a few more details I'm going to add later, you will see that the Arduino is better suited
for controlling hardware components, and the Raspberry Pi is better suited for software applications
with more processing power.
Now you might say, well, there are some applications that you can do with either an Arduino or a Raspberry
Pi, for example.
If you try to control an Led with a push button, this can be done with both boards with the same result.
So yes, for a few applications, both boards are going to overlap.
And for those kinds of applications, there is no right or wrong solution.
Now let's focus on what the Arduino can do better than the Raspberry Pi.
First, there are some hardware functionalities that are only possible with Arduino.
The Gpio panel on the Raspberry Pi is great, but quite limited when you compare it to the pins on the
Arduino, for example, Only with Arduino you can read from an analog sensor that can be a potentiometer,
a photoresistor, etcetera.
There is no way to do that directly with the Raspberry Pi Gpio.
Also, some of the pins have a functionality which very basically allows you to send a custom voltage
to a component instead of just for example, zero and five volt on Arduino is native and is handled
by the hardware, which means that it's not going to take away any software resources on the Raspberry
Pi you could use.
But this is not a hardware one.
This is a software, which means that it's going to take resources from your CPU and it's maybe not
going to be as stable as on the Arduino.
Then the Arduino is best suited to control motors.
And one additional thing here which is quite important is the capability to respect real time constraints.
So what is the real time constraint?
Let's use an example here.
So let's say that you are controlling a motor and you need to give a command to the motor every 20 microseconds.
If you fail to give the next command before 20 microseconds, the motor will not behave very smoothly.
So with the Arduino, no problem because of the nature of the microcontroller, it's just running one
program and it's what we call deterministic, which means that you know exactly how long a command will
take to execute every time.
So if you write your code, well, you can respect the 20 microseconds delay every time on the Raspberry
Pi, things are completely different.
The operating system you are running has a scheduler for all the tasks.
The scheduler will try its best to make all the tasks run as smoothly as possible, but it can't guarantee
that one particular program is going to respect exactly 20 microseconds between each command it sends.
If, for example, another independent program is taking too much resources, then the first program
which controls your motor, is going to slow down.
And that's a problem, especially when you control physical hardware components.
So in this course for the activities and project, we won't have to deal with this real time constraint.
But I wanted to explain it briefly here so you can understand that it's very important parameter which
you will need to take into account for some of your future projects.
All right.
You can already see that the Arduino is superior to the Raspberry Pi for quite a few things that are
related to hardware control.
Now let's give a chance to the Raspberry Pi and see when it is better than the Arduino on Raspberry
Pi.
You get a complete operating system.
For example, Linux with the Raspberry Pi OS and you can install many more.
For example, Ubuntu, Android and even some versions of Windows if you want to with a complete operating
system.
Well, instead of running just one program, you can see that we have a world of possibilities that
are not available on the Arduino, on the Raspberry Pi.
You can program with C plus plus, but also with Python, which we are actually going to do in this
course.
In fact, you could use any programming language you want.
And now a few more examples.
With Raspberry Pi, you can control a camera, for example, the Pi camera or any USB camera or webcam
that you just need to plug in.
And to that you can add computer vision, artificial intelligence with machine learning.
ET cetera.
You can also host a complete web server if you want to.
And well, on the Raspberry Pi, basically you can just run many different applications and programs
simultaneously with scheduling and Multithreading.
Multithreading is super powerful and it's something that doesn't exist on the Arduino on Arduino.
By writing your code, well, you can kind of fake it and create a multitask program, but nothing to
see with what you can do with the Raspberry Pi.
Okay.
And I'm going to stop here because the list could go on and on and on forever.
But what you can see here is that the Raspberry Pi is superior to the Arduino when it comes to software.
To recap, Arduino is better for hardware or low level control, and Raspberry Pi is better for application
software or high level control.
So depending on your project, maybe you just need one board.
If your application is to take some photos, process them and publish them on a web page, then just
go with a Raspberry Pi.
If, however, you want to just open a door with a motor when you detect a presence nearby, Arduino
will do 100%.
But if you need to combine both hardware control and high level software applications, then why not
use the best of both worlds and use the combination Raspberry Pi and Arduino?
With this combination, you can do a much more complete and complex project by taking advantage of each
board's superiority.
That's what we're going to do in the Intercom project, where we will use the Raspberry Pi to handle
a telegram bot and take some photos and the arduino to control a servo motor, as well as other hardware
components that use.
For example, the Raspberry Pi will send comments to the Arduino, and the Arduino will also send some
data back to the Raspberry Pi.
And you may not be aware of it, but this combination of microprocessor plus microcontroller is actually
used everywhere.
If you have a phone, a computer, a TV, well, all of them are using a microprocessor as the main
software control.
And then this microprocessor is connected to many microcontrollers which are handling the hardware.
A more robotic example, maybe if you take a mobile robot with autonomous navigation, well, you would
have a microprocessor to handle localization, high level motion planning, image processing.
ET cetera.
And you have some microcontrollers to control the wheels with real time constraints and also get data
from different sensors.
To conclude, you can see the Raspberry Pi or microprocessor as the brain of your application and the
Arduino or microcontroller as the muscles of your application.
All right.
Now that you have a better understanding of the big picture, you are ready to start the course.