Connecting to Wi-Fi and Using SSH - Raspberry Pi for Developers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
when we're using a Raspberry Pi to connect things like sensors and motors we don't really want to have to plug in a keyboard and monitor every single time we want to write code on it so in this video we're going to learn how to connect the Raspberry Pi to our local Wi-Fi network and then login and control it using SSH the process of setting up a Raspberry Pi to be controlled without a keyboard or monitor plugged in is called a headless setup and we're going to be using SSH which is probably the easiest method when our Raspberry Pi is on the same network as our computer SSH or secure shell is a cryptographic network protocol for operating network services securely over an unsecured Network oh wait what let's say that we have two computers connected to a network this could be the internet or just a local network we can use SSH to do things like transfer files between the two computers or even log in remotely from one computer to another so that one computer can control the other one and it's also secure so all the information is safely encrypted before being sent this is going to be really helpful for us as we can use SSH to control the PI remotely and write all of our code and do everything else on our normal computers before we can control the PI using SSH we need to do two things one is actually connect the Raspberry Pi to our Wi-Fi and two is to enable SSH because it's disabled by default for security reasons once you've got raspbian installed on the SD card go ahead and plug it back into your computer it should show up as boot on your desktop now go ahead and open up your favorite text editor mine is vs code and create a new file called WPA underscore supplicant dot conf and then save that to your desktop in this file we need to add all of our Wi-Fi details before we can do that open up your web browser and go to bit ly slash WPA underscore copy all of the code from this webpage and paste it into the file that you just created the first line is your country's two letter code I'm in Canada so I've got CA make sure that you put in your country code and make sure that it's uppercase the next two lines are just some default settings that we're going to leave alone then in the network section this needs to be your Wi-Fi name and your Wi-Fi password so go ahead and enter your Wi-Fi name and password into these fields make sure you save all of these details and then create another brand new file and save that as SSH with no extension and just save that to the desktop now as well this file we're just going to leave blank so now we can close our text editor head back over to the desktop and drag both of these files into the boot image when the pie boots up it's going to use the information in these files to connect to my Wi-Fi network and enable SSH as a quick side note here the raspberry pi be models all have an Ethernet port on them so if you didn't want to connect to the Wi-Fi you could just plug it directly into the router using an Ethernet cable so now go ahead and eject the boot image from your computer can unplug it now and plug the SD card back into the Raspberry Pi then plug the Raspberry Pi back into a power supply then we'll just give that about a minute to boot up if everything works correctly our Raspberry Pi will now be connected to the Wi-Fi network and will be able to start logging into it using SSH we just need three pieces of information to start using SSH the name of the user that we're going to log in as the default user on the Raspberry Pi is PI the password for that user the default password is raspberry and the host name of the raspberry pi the default is raspberry pi don't worry we'll learn how to change the default settings in the next video back on your computer open up a new terminal window to log into the raspberry pi using SSH type in SSH then the username PI at the raspberry PI's hostname which is raspberry pi dot local and hit enter and the first time we do this we'll be asked if we're sure we actually want to connect so type in yes and hit enter and now you have to type in the password for the PI user which is raspberry now don't worry that you don't see any characters showing up here that's just for security reasons so type it in hit enter and then just like that we're logged on to the raspberry pi so immediately we can start running bash commands on the Raspberry Pi like Claire PWD LS but we're also connected to the internet now too so we can use curl to execute HTTP requests to websites like the pokey API I encourage you to take a little bit of time here and experiment with controlling the Raspberry Pi remotely from your computer before moving on to the next video there are two commands that you should run the first is sudo apt-get update and the second is sudo apt-get upgrade when you hit enter these two commands might take a little while to run so don't do this until you have a little bit of a break we just learned how to do a headless setup of the Raspberry Pi meaning that we can now control our Raspberry Pi remotely using our normal computer now anytime we want to do anything on the Raspberry Pi we can just SSH on to it [Music]
Info
Channel: Sam Meech-Ward
Views: 43,483
Rating: undefined out of 5
Keywords: raspberry pi, linux, sd card, raspbian, programming, terminal, bash, electronics, embedded, wireless, headless, ssh
Id: naDYXkI5UYE
Channel Id: undefined
Length: 6min 24sec (384 seconds)
Published: Fri Apr 12 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.