[Music]
hello everyone
welcome to the first class of linux and
electronics at raspberry pi course
my name is pablo jarzo and this is the
first class
of the linux and electronics course uh
giving to you thanks to hakareyu
and this is gonna be a really fun class
um we're gonna see many things about the
raspberry pi we're gonna see how you're
gonna step
up your uh raspberry pi again
uh if you come from a background of
arduinos
or any other microcontrollers and you
want to use something more powerful this
is the right course for you okay
so let's do it
okay so in this first class we're going
to talk about the raspberry pi
basics what is a raspberry pi
is in short words it's the most famous
single word computer
um a raspberry pi is a single board
computer's
a computer as i as i said uh
what that means it's it means that for
example
a pc computer or a tower computer or a
desktop computer as we know it
is usually in a box which is composed by
the motherboard the ram the processor
maybe
a gpu a hard drive etc
and all those components are separate
from each other and you can
you can modify the computer a single
board computer
means that every part that i just
mentioned is together
it's assembled together and you cannot
take them apart
it's also a credit card size which means
it's really really small which is
the one of the favorite features from
the raspberry pi
it's open source of course which is
really really good
it means that you can ideally if you
have the means you can just
replicate the raspberry pi and and or
modify it
make it better etc it's also a great
learning platform which means that
once you take um
into the raspberry pi world you're gonna
see there are
lots lots of people in it you're gonna
see many resources
there's a lot of singapore computers out
there but there are not
many um
[Music]
but there are not that many uh as
famous and as um
people backed or or
or so many people use it that it's
there are so many resources so yeah this
is
this is one of the reasons if i want to
do a
long-term project with the raspberry pi
i or with a single board computer i mean
i usually take the raspberry pi
this is the difference between um
how does it compare between a pc and
arduino
an arduino is a microcontroller which
means it's just a single chip
which you make a program for it and then
and the mic and the microcontroller is
just gonna make the program run
it's gonna follow each instruction and
it's just only gonna do that
a raspberry pi is a computer
which has an operating system that has
many programs running in the background
a pc computer
is the same as a raspberry pi but it's
more powerful
more you can change parts it doesn't
have
access to the gpio etc so
the thing about the raspberry pi which
sits between the arduino and the pc
is that you can take the
raspberry pi and it has gpios in it
if you want to put gpios on the pc
you can have them it's not as easy as in
the raspberry pi
and obviously it's not that it's not
that small either
so this is why the raspberry pi it sits
between a pc project and arduino project
so what are the specs right what we're
seeing
here is the raspberry pi 4. the one that
we
we we asked you to to buy for this
course is a raspberry pi
3b you could have also buy
uh bought this one and it would have
been fine
but i i wanted to go with the 3b because
it has it
it already has many years out and it has
been proven to be a really good product
so here as you can see uh first the
power supply comes from a usb
usb c port this is for the raspberry pi
4. there's a
the razer pi 3 has a micro usb one
um here is what usually is the the
processor is
this looks maybe looks different
different
in yours in your raspberry pi 3 it may
be look like this
ship um here in the raspberry pi 4 you
can choose
the ram there there are many there are
three models that you can choose from
and you can have uh different amounts of
ram
here this uh system of a chip
on a ship that you can see here is is
called is is the bluetooth and wi-fi
chip it comes shielded so it doesn't
have interference
um from the outside
these are two micro hdmi ports
uh the the raspberry 3 this is another
reason why one you
wanted youtube to buy the raspberry pi 3
is because the micro hdmi ports are
are kind of rare so i wanted you to to
buy the
full hdmi port for the raspberry pi
here is a support for
another kind of display and here
is the perform for for the raspberry pi
camera
here is a jack for audio
usb 2 usb
3 and a gigabit ethernet
in the raspberry pi 3 that you have it's
also the same
but but no usb 3.
so 12 million 500
is the amount of raspberry pi that have
been sold since
2012 where it was born
that's a lot that's a lot of raspberry
pies out there
this is why i like about it there are so
many out
people are using it making products
making projects and
they all share their their experiences
in the internet
so here are a couple of modules um
the raspberry pi uh 4b is the one that
we just saw
this is a raspberry pi model 3 model b
this is the one that i asked we asked
you to buy
a raspberry pi 0w and raspberry pi
zero so as you can see this is a
different form factor
this is um kind of if
the size of the raspberry pi 3 if you
split it right in the middle
the raspberry pi zero is a lot cheaper
it's a lot less powerful
but it's a lot less um is a lot less
smaller
it's way smaller i should say um
as you can see here you have a couple of
things
from from the other uh from bigger
raspberry pi
here you have i what i believe is a mini
hdmi
uh two micro uh usb ports
the processor and the and the micro sd
port and i don't know if this is the
uh display port or the camera or most
likely the camera one
so the difference between the raspberry
pi zero w
and the zero is that the serial w is
wireless so you can connect through
wi-fi with it
this one the raspberry pi zero it
doesn't it doesn't have
any any kind of wireless connection so
everything should you should you should
be able
if you want to talk to it you you're
gonna be
talking through the usb cable
this is another kind of module this is
for industrial um
computing this is where you want
um something that you can take off and
on
these modules come um it's the third
generation so it's along with the
raspberry pi 3b
they come in sizes uh
like ram and you can and you can buy
module kits or you just make
you can images on your own board and put
them in and take them out
as you wish
so raspberry pi has something called
hats
um they were introduced in 2014
and they they are um
some on a standard that the the
raspberry pi foundation made
so you can if you ever do a project
you can have the same pinout between the
between um
raspberry pi's um it's it's the same
ones
since uh i i believe since the beginning
and and you can and you and whatever hat
was made from
for the raspberry pi let's say one or
two is gonna work for the
three or four
so these are the peanuts that you're
gonna
find in the raspberry pi um they don't
change a lot between them
because that's that's uh they try to
keep these standard
you're gonna see a couple of for example
five volts
pins 3.3 volts
ground pin a couple of them actually
you're also going to see a lot of gpios
with also
double as serial buses
for example i square c these are the two
bosses for it
and serial serial ports
and and more uh there's also
pwms and and
more ports we're going to talk about
them more in the next classes
so this is what a um raspberry pi had
looked like this is one type of it
someone
decided to make a hat with leds
addressable as you can see it sits on
top
of the raspberry pi and it makes a an
animation
that could have just been a program made
into it or
something that happened once uh one
condition happened for example if you
got an email or something like that
this is the primary unicorn hat uh you
can find it if you want it
but this is really cool this is another
example
i don't know if you can notice but this
easy hat
for the raspberry pi zero
it could have been also the w but the uh
it's the it's compatible still um
compatible and this also could have
went into the raspberry pi 3 but it's
but the thing is
it's not going it was not going to be as
um
comfortable as a joystick for it so this
is really cool
this is just someone made this to make a
a
full um a full
um video game out of a raspberry pi zero
in a controller and in a raspberry pi
uh zero hat
okay so at first when i saw this uh it
it was it kind of blew my mind because
it's really really really small um
as you can see is this is a
an arcade cabinet made with a couple of
pcbs um or
uh per four pcbs so they solder a couple
of
um buttons and a joystick or a mini
joystick
a a lcd screen and they connect
and they connected everything to a
raspberry pi zero
this is another kind of project and this
is the project that you usually see
when you are working with um
with uh people that come from a linux
background
they usually make something called
cluster which
means that you put a couple of computing
computing power which can be
um processors gpus etc
you can put a couple of uh
raspberry pi's and make a cluster out of
it
so here the raspberry pi 3
is working as a bit like the host and
they made a hat so you can fit a couple
of raspberry pi zeros on top of it
to make a cluster so this is the cluster
hat
uh 2.5 by palmer pine moroni if you want
to find
more about it so here
what is linux right this is a linux and
electronic course so we're going to
explain what linux is
linux in basic words are an open source
operating system it's an operating
system same
same as um windows and and
and the operating system from uh from
mac which
uh the name i just forgot
wait a second
so linux is an operating system um
same as windows and mac os um
and it's open source this is something
that the other ones
doesn't doesn't have uh they come
packaged into many distributions so
types of clinic that like there's
imagine there were kinds of
windows they they come
a couple of linux distributions
uh the the most a couple of the most
um famous ones are ubuntu
deviant raspberry pi os and
and more they are really really
linux is really really popular for
servers and iot because it's open source
easy to work with and the the
um the operating system
is very secure and reliable
center it it was made to be reliable and
to be
easy to use for big and complicated
purposes
this is what we know as a linux console
or terminal
this is where you're gonna interact with
the operating system and this is what
we're gonna use in the next classes to
do commands talk um to the to the
to the computer make programs etc
i know this this looks really really um
complicated but
it is really not so in this diagram
i'm showing you the the the the
connections between shell
internal and the hardware and the user
so the shell the char is a program
that interprets the
commands that you that you
that you typed in as an user send that
information to the kernel
which is the part of the operating
system
that talks to the hardware so let's say
drivers um let's say special programs
that that
that only the hardware can can um
special programs to talk to the hardware
this is basically the kernel
and the chill is there are many type of
shells but
like um shells
are usually the program that accepts the
commands okay
so this is a step down
for for how it goes from
application to hardware so you use an
application uh
you open a chrome spotify or you on your
terminal
you do a cd or mv to move
and you do if you do those commands
or if you run those programs they
usually gonna run on a chill
they're gonna run on a terminal and
they're gonna run
uh for example um sh
csh or bash are three examples of
shells these are the most famous ones
okay
so um then then the shell is gonna talk
to the kernel
and then the kernel as we said is gonna
talk to the hardware
so what is electronics electronics is
one of the coolest in my opinion is one
of the coolest branch
of physics electronics is
um the field that studies the flows
the flow of electrons within semi
with the semiconductors so
same technically when you're uh
switching a a
a light in your house on and off just
you're
um
controlling the flow of electrons
but it's not with it's not small it's
not that that korean is not
uh small it's you're not doing it with
semiconductors
so what i the analogy that i like to use
for example for electronics
is that um electr
the difference between electronics and
electrical or electricity
is that electrical uh usually works with
things are more power and bigger
electronics is where
when you wanna uh where where you
deal with smaller stuff and more
dedicated stuff
in in in
in practice the difference usually comes
with
what are you using for example in
electronics we
mostly use transistors or
microcontrollers to do our controlling
in electricity we you use um
relays um controls plc
whatever things are big and robust
to to take those currents
um electronics are or things that are
also
used in the electronics field are
microcontrollers asics and fpgas
asic is an application of it and you can
find that out but it's like a little
bit advanced i just wanted to say that
and fpgas
are like the next step is is when you
when you when you get to the limits of
the microcontroller where the
microcontroller cannot run fast enough
for you to do something then you need to
run fpga
and fpga is the closest thing as maker
that we have to make our own
um um
chip or make our own uh
integrated circuit that's that's the
best way i can put it
so this is a pcb from 1966.
this is what it looks electronic
electronics
look like um this as you can see it has
many many integrated circuits in on top
of a pcb
switches as capacitors
and some resistors over here more
capacitors
yeah so the difference between this
macbook pro logic board from the 2010
and this it's basically that
first of all we advance at a point that
integrated circuits are way smaller so
mostly everything
that is here you can just replace it
with a couple of
chips like this one and this one
and yeah so we have more more populated
uh the pcb is more popular than this one
because we're being more efficient as
you can see
these are like the cables on top of the
pcb
pcb means printed circuit board so
it's it would be like instead of cables
it would be like the cable would be
drawn on top of the pcb imagine the pcb
being like
a a top um
[Music]
sheet of plastic and he had and it has
copper on top and at the bottom
and the cables are drawn
on top and and and and down to it okay
here we have the same but we don't have
as many
layers what i just described you that it
goes on top and the bottom are layers
this board has many layers probably more
than
ten and yeah
so here are you as you can see we are
this board is completely populated with
stuff so
this means that we just been way more
efficient
so let's talk about a little bit about
the raspberry pi os
previously no one previously known as
raspbian so
i just noticed that um they just changed
the name from raspbian
to um raspberry pi os which is um
an okay um change
so yeah so just be mindful when you find
uh when you wanna
to look for um help on the internet if
you want something that it
you can see it's a problem that could be
really old you may you may be
uh needing to put raspbian on your query
on google
so this is the raspberry pi os desktop
this is what it looks like when you go
when you go inside of it
it looks like a typical desktop but a
few changes
right here is the the hour the um
the volume control wi-fi status
bluetooth
status um here's for the usb
uh i believe this is the uh amount of
percent that the cpu
is using so here are
the the the main menu
here you can see here's where you shut
down the the raspberry pi
um or reboot it this is where you run
commands
preferences for the raspberry pi os
system
uh account and in here are programs
just packed into different categories
so the difference between the raspberry
pi os um desktop
and the minimal version that we're gonna
see a little bit later but i just wanted
to explain this to you
is that the minimal doesn't have
any desktop doesn't have any uh gui
which means
graphical user interface uh basically
gui is
what whenever you you can
move the mouse or use the keyboard
it's a uh to change stuff or basically
the mouse
um is a gui here on the raspberry pi
minimum you cannot
like you cannot use the mouse you may be
using it
but not directly
so we here we mostly use the keyboard
so we type everything that we want and
this is better
for some applications because gui
um takes uh many resources to put
pixels by pixels um in each frame
it takes a lot of power so whenever you
want to do something
that is not um that you want to the the
most
uh the most out of the raspberry pi you
should go
through to minimal i usually use minimal
um for example you cannot do
on computer uh vision applications
with the raspberry pi os minimal you
need to use the raspberry pi
um desktop for that because it's not
gonna allow you even to download
or install some programs
um so yeah so to have that in mind
so if you go to the raspberry pi
downloads
page of the raspberry pi foundation
you're going to see
two types of raspberry pi
os options you're gonna
you're gonna choose the raspberry pi os
previously uh called raspbian and choose
that one
and then you're gonna see a couple of
third-party operating system images
it's this this you're gonna see it below
this
so this me these are a couple of um
images or let's say you can you can
maybe call them distributions
um for the raspberry pi as you can see
um there are uh versions of ubuntu i
want to make core
and server for the raspberry pi these
are another kind
of um raspberry pi images
for the raspberry pi i haven't um
test them all um so yeah if
whatever you want to do on internet of
things applications you
may be you may want to look for for
these images
before downloading them and trying them
out
so again we're gonna touch the raspberry
pi os one
and then we're gonna see three options
okay
so let me explain these three options
for you
so on top of that both of them are the
desktop versions
okay the the the bottom one is the
debian
the raspberry pi slide
if you can see there's a a big
difference in sizes for example
here there's a raspberry pi os light
just weights only
um size is only 435 megabytes
uh and the raspberry pi os with the
desktop
it it weighs on one gigabyte the
raspberry pi
os with the desktop and the recommended
software
it weighs 2.5 gigabytes so
what is the difference between these two
you may ask here this one
comes with um some programs um
suggested if you want to use the
raspberry pi as a full computer
if you don't have any computer and you
want to use this one
uh i mean if you one uh if you want to
use the raspberry pi as a full computer
you may you you want to choose this one
because
it already comes with a word processor
a um excel like program
etc this one is which is the one that
we're going to use
gonna comes with a few programs but it's
not going to be
like uh full of it so
if if we ever need a program um
and we we're gonna we're gonna download
some programs
you're gonna download you're gonna use
this one okay then
download this one and this is the one
that we're going to be using in this
class
so let's do a checklist for the things
that you
have you need to have for this first
class you need to have the image file
downloaded
um this is in case the this is gonna be
depending on the
on the method but i suggest you to
download it anyways it's really good to
have it
a unzip tool to take
um the the image out of the
zip file that is gonna come
the and then the flasher
which you're going to use either ballina
etcher or the raspberry pi imager which
is a
really uh is a new program from the
raspberry pi foundation
this is the one that we're going to use
today the raspberry pi imager but you
can use
both it's really simple the one of the
i'm sorry one of the process uh the
process of using
a image file on the baleno etcher is
also
available to do on the raspberry pi
imager
so let's start flashing the raspberry pi
so here
so here this is the raspberry pi imager
um
you may have a another one by the time
you see this video
but yeah this is where we choose the
type of operating system that we have
if we had the image file that image file
or amg file downloaded
you can you can use use custom and then
you can select this one
i have this one because of the um
uh i had this one because of a project
that i was
doing and and this is an image for for
using it
with the 3d printer
i'm going to choose this one the
raspberry pi os 32 bits
and i'm gonna choose this
i have the sd card that comes with the
raspberry pi connected
uh to my laptop which is what i'm using
right now
so i'm just gonna click right
and it's i'm gonna go
so yeah this process takes a little bit
um first of all it's gonna take all the
files from the image
and it's gonna um unzip it and then it's
gonna burn it into the
to the uh flash to the sd flash
then it's gonna validate it and then
we're going to be able to use them
so let's wait a little bit for it
so yeah as you can see it's taking a
little bit right
um that i i like to do this in the
background
whenever i want to uh before before i
need to start working on it
i usually put the put that in the
background and then when it's finished i
i'm ready to go
so yeah after this writing
part is going it's going to verify it
hopefully it goes well
and then we're gonna be uh ready
to to keep to keep uh working with the
raspberry pi
so let's wait a little bit more and so
yeah
as you can see now we're verifying um
the
that everything went well and yeah this
part is
way faster uh so we should be able to
finish
this really really quick so yeah um
we're just gonna wait here
me
music
um
so
okay we are almost done everything
uh have you been you cannot remove the
st card from the reader
okay good good good good so everything
went
wrong so this is a really important part
don't take the usb or the micro usb
out or the sd card don't take it out
of your computer yet make sure
to do to go to your computer
um wait to go to your
[Music]
um
here to your files here um to your pc
okay it's out but make sure to be to to
to have it out of your computer first in
case
it's not out you click right you right
click it and then click eject okay this
is a really
important part i just take it out
i'm gonna put it back in
and it should be it should be displaying
in a bit
let's wait a bit let's wait a second
for some reason is not recognizing it
let me see something
that can happen
let's wait a second
so now we're gonna put the memory
the usb back in or the i or the sd card
and this should be appearing here yeah
so here uh it's something that we're
gonna have and that we're gonna use in a
bit so
let's stick to let's stick together for
that
so the other option that you had was
that
using baleno etcher which is
kind of the same you just click the
select the image is gonna pop
the window for you to select the dot
image file
select the drive that you're gonna
choose the one that you just connect to
the computer and then flash
it's gonna do the same process it's
gonna be burning very fine
in case it it goes wrong uh you do it
again
in case it doesn't it doesn't work maybe
you need to um
um wipe your sd card
again or reformat it which is something
that that you can
uh that that may happen so i suggest you
if
you haven't that kind of trouble i
suggest usual to look for it
on the hackadayu page for this course
which
uh we have in the class notes a couple
of
useful links for that so yeah
if you need to format i suggest you to
do it yeah there's also an option in the
raspberry pi imager to do that
let's plus here let's see here's this
one
you can see there's a way to format the
card
and then flash the sd card with an
imager
you can use the raspberry pi imager as
we just use or use the baleno etcher
eject the memory from your computer
right
and then plug it in again this is what
we're going to do
the wi-fi configuration and that's ssh
config configuration so it's always
first
before using them so connect the sd back
up into your computer does
that's what we just did and for the
ssh we're gonna use we're gonna right
click and create a file
named ssh we're gonna close this i'm
gonna go to
boot and here we're gonna create a file
called a text file called without
anything yes no extensions so
you notice that that i created a txt
file
delete that just ssh the computer
the raspberry pi once you pop this out
and put
put it in the raspberry pi this is going
to recognize it as a permission
to to to get um connections through
ssh from outside the raspberry pi which
is
what we're going to be using to talk to
that raspberry pi
in the next chord in the next class um
have this in mind this is not something
that you need to understand right now
the next class is gonna be better
it's gonna be a little bit more detailed
for the wi-fi so
for the wi-fi it's kind of the same
you need to go to here and edit i
i i put it at it but you need to create
as well
we're going to use the same name here
wpa
supplicant dot config
configuration.com
yes and we
click and then as you can see this is
the final example that comes
um uh on your on your
uh for the um wi-fi configuration
file be aware that this
step is not necessary configuration you
don't need to do it
like it's not required this is i'm
showing you just a way to do it
so what
what what is requires to do the ssh so
have that in mind the ssh
you need to do it the wi-fi you don't
need to do it
so i'm just gonna type that part
network
ssid
um let's use test as the
the the wi-fi network that i want wanted
to go
and psk is going to be the password
so i'm just going to put here uh one two
three four five six
seven eight five this is just an example
right
i'm gonna save this and set
okay so you gonna very important
don't take out the memory card just
every every time
just eject it
we're gonna wait we're gonna wait
and then
should be good there you go
so i'm just gonna take it out and
everything should be set to put
on the raspberry pi so now you're gonna
go and boot up your raspberry pi
connected to your um to your
monitor connect the the the keyboard the
mouse
and then you're gonna connect the power
so you should go it should look
something like this once it goes on
and you're gonna type you're gonna open
a terminal that you're gonna look for
in the top left corner as we saw and
you're gonna type sudo apt
update which is gonna download every
update that
it should be it that it needs okay this
process also takes a little while
so i also do that and put it in the
background and then you're gonna do a
full
upgrade which is gonna take everything
that you downloaded
and it's gonna uh apply it and and and
and
it's gonna upgrade every program that it
has
um that is all
so this is what's the first class um
i hope you liked it uh any questions
that you have
go to to the to the hackaday you course
page on the hakka io page
um text me or email me
uh or talk to me in the public chat room
for the raspberry pi course and
see you on the next club i will see you
on the next class this is gonna be a
really fun class
uh each class is gonna be more fun i
promise you that
and i hope you learned this a lot with
this with this class
thank you