Raspberry Pi LESSON 40: How to Set Up a Remote Desktop on Raspberry Pi Using VNC

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is Paul McCarter with talktechboy.com and we're here today with episode number 40. in our incredible new tutorial Series where you're teaching your Raspberry Pi who's boss what I will need you to do is pour yourself a nice tall glass of ice cold coffee that would be straight up black coffee poured over ice no sugar no sweeteners none needed and as you're pouring your coffee as always I want to give a shout out to our friends over at Sun founder Sun founder is actually sponsoring this most excellent series of video lessons and in this class we will be using the sun founder Raphael kit for Raspberry Pi yeah most of you guys probably already have your gear but if you don't look down in the description there is a link over to Amazon and you can hop over there and pick this kit up and believe me you're live in my life are going to be easier if we are working on identical Hardware but enough of this Shameless advertising let's jump in and talk about what I am going to teach you today and what I'm going to teach you is how to run your Raspberry Pi remotely by having a remote desktop up on your Windows machine pretty cool I hope it sounds cool to you and I hope that's why you are here to learn that now why would we want to do that in the earlier 39 lessons in this class we've learned to do some pretty cool stuff and we're ready now to start deploying our prototypes and deploying our projects that we've developed but if we're going to actually be using the things that we develop on the Raspberry Pi we don't have to we don't want to have to walk around with a 19-inch monitor under our arm and carrying a keyboard and a mouse we want to have small simple packages for the Raspberry Pi and then we want to control the Raspberry Pi remotely now you got a little hint of how to do this last week where I showed you how to use putty to SSH into the Raspberry Pi and then you could open up a Linux terminal you could end up with a terminal on your Windows machine and you could control the remote Raspberry Pi through that terminal and really you can do a lot just by doing that but let's be honest a lot of times we want that comfort of having the full Raspberry Pi desktop so that's what I'm going to be teaching you today so let me go ahead and uh have a sip of coffee get out of your way we're going to go over we're going to go over and I'm going to show you an overhead view I'm going to have to probably zoom in a little bit here yep that looks pretty good to our Raspberry Pi and you can see that right now this Raspberry Pi is running live We Got The Power we've got the HDMI cable and then we've got this little dongle that goes out to the Raspberry Pi keyboard and the Raspberry Pi Mouse now if we want to deploy this in a real project or a real prototype what do we need to get rid of we need to get rid of the HDMI cable we need to get rid of the keyboard and the mouse and then we need to operate it remotely and the only direct connection to the Raspberry Pi should be power and so that is what I'm going to show you how to do today so what I need you to do is switch over to your Raspberry Pi View and there's two things we're going to have to do we're going to have to configure the Raspberry Pi and then we're going to have to configure the windows PC machine and so let's jump in on the Raspberry Pi side and let's see if we can I hear dogs barking that's my yard I can't see what the dogs are barking at but I digress I digress okay not sure one of the dogs are barking sorry if that disturbs you but let's jump in and let's get busy here so the way that we get a remote desktop on our PC for the Raspberry Pi is we run a product called BNC there's two parts to VNC there's the VNC server and then there is the VNC client or the VNC viewer the VNC server will be running on the Raspberry Pi why because it will be serving up the desktop to who to the client over on PC and the client will be then getting that desktop and showing it to you on your PC monitor and so the product is called VNC now what's the good news your little Raspberry Pi with the Buster or later operating system comes with DNC already installed on it so all we have to do mainly is just turn it on so I need you to go to the lower left your happy little Raspberry Pi icon I need you to come to preferences and then Raspberry Pi configuration you get this dialog box that pops up and then what you're going to do is you're going to come over to interfaces and then you see VNC here we are going to need to enable that now it's actually good that it comes disabled because you can actually start you know generating some security questions when you allow someone to access the desktop like this if you guys are doing really important stuff or you've got stuff on your network you know you've got to go out and figure out all the security implications yourself I'm not teaching you security I'm teaching you just the basics of how to turn on VNC and how to connect to the Raspberry Pi me personally if I'm not actually using this I just generally turn it off but if I need to use it I will turn it on as we are here and then I'll say okay and then boom what I'm going to show you is if you come over here now if you come over down here what you can see is there is now a little VNC icon indicating that the VNC server is up and running on the Raspberry Pi so that is a good thing now what we got to do is if we're going to connect to that we've got to know what the IP address of our Raspberry Pi is and so you open up a terminal you just type in if con config and it's going to tell you what your IP address is and since we're on Wi-Fi it's going to be under WLAN and then here on inet this is my IP address 192.168.88.41 don't use my IP address you need to use your IP IP address so when you do this is config just make note of what your IP address is man we are almost there but there's one other thing that I have to show you and let's come back over to our Raspberry Pi view here let's cut hey I've got another Raspberry Pi view let's see if I can show you that one you guys hated this on the live stream but I kind of like these coming in from the side ones but you guys like the overhead one so I'll do the overhead for you so what is the goal the goal is for us to shut down the Raspberry Pi and then when we boot it back up to take to not have the HDMI cable connected and not have the monitor or not have the keyboard and the mouse connected now this is the problem and this is the pro tip that I'm going to give you because if you try to do this and don't know this little secret you are going to pull your hair out the problem is if I shut this down and I take the HDMI cable off and then I put power back on when it boots it does not see a monitor connected therefore it doesn't know what screen resolution to set the uh the Raspberry Pi at and therefore it cannot render a desktop because it doesn't have a resolution and therefore it cannot serve a desktop and over on the VNC client you're going to get nothing but a blank page and so what I need to show you is I need to show you a setting where we we tell the Raspberry Pi what screen resolution to use even if the screen isn't connected sound good I hope it sounds good so we're going to come back over to the old Raspberry Pi View and then what we are going to do is we are going to do a pseudo for super user and then what we are going to do is a raspy config and you've probably used this before we come up with this remember when we're in raspy config in the terminal you have to use the up and down arrow keys the mouse isn't going to help you but what we need to do is come down to display options and then we want to set the screen resolution and instead of default instead of that default setting I want to come down and for me with the monitor that I'm using 1920x1080 60 hertz at 16.9 that will work for most of you maybe if you're somewhere else where else you would need to look at the six the 50 hertz settings but for us in the good old us of a 60 hertz should work so then it says that it's set I click enter for ok and now I'm going to come down and I'm going to finish and then it says would you like to reboot your pie now let's go ahead and reboot it and then that should just take a second to come back on and I'm kind of floating up there in midair or not I'll put the title back on so it doesn't look like that I'm just now it's like I'm rest resting on the title and not just floating in mid-air but then here really quickly we should have the Raspberry Pi so what do we have now we've got the VNC server working we know our IP address and when we boot up without the without the HDMI cable it's going to know what the screen resolution is so I think this would be a most excellent time to switch over to the PC side and now there's a little very very important thing I need to tell you one of the reasons that it is so hard to get this remote desktop working is there's a little something you need to understand that I'm going to explain we say VNC we're running VNC but what you have to see is there's many different brands and many different flavors of VNC There's real VNC there's tight VNC there's tiger VNC and this is the problem that if you're running one flavor of VNC as a server and another flavor of VNC is the client sometimes they don't play well together now if you're a VNC or Linux expert you could go in and you could get any VNC server to talk to any DNC client but for us home Gamers it's a lot easier to what use the same brand flavor of VNC server as we use flavor of the NC client or VNC viewer and the little secret I'll tell you is the server on the Raspberry Pi that comes installed with it is realvnc so if we're using a real VNC server what should we do on the PC side or the client side we should use a real VNC client does that make sense and that would explain why I am searching on realvnc you get these results here and then what we want to do is I'm going to go right straight to the old download page and so I'm going to click on that enjoy a little sip of coffee and since I am working on a Windows machine I will click on Mac no just joking just joking we'll do windows and then I'm going to come directly down here to download the NC viewer and then you can see it asks you a question and you can give them that information if you want to I am going to come back over here and I am going to turn the title off and then what you can see is it is already downloaded so that was a very quick download so now I'm going to install the VNC viewer the VNC client on my Windows machine with a little clickety-click and then it pops up I think today I will be selecting the English language use the language language or the most comfortable with but I'll say okay and then I'm going to say next and then I will agree to probably I'm agreeing to give my firstborn child in a left kidney as far as I know but we're going to live dangerously and just agree to whatever they think that we should agree to and then I'm going to say next and then I'm going to say install okay and then I'm going to say finish all right now if I come over here the first time you can see where is that that should be here somewhere maybe I need to search on it so I will say V and c and there it is VNC viewer and then it pops up like this now a heads up earlier I had this installed and I uninstalled it if you're installing It For the First Time very likely as you do this there's going to be a window that pops up that you that wants you to log into realvnc log into a realvnc account and then it will ask you oh don't have an account set it up let me tell you down at the bottom of that little pop-up there is a different option which says continue without an account so if you don't want to register and give your email and set up a VNC on their side VNC password and username you can just say skip that part and then you'll end up here so you see with me ending up here it's my PC talking to my Raspberry Pi and it's not logging into the the VNC corporate website or whatever or their cloud or whatever we're just going Raspberry Pi to PC so just don't get confused so some people see that and well I'm not going to put in my email okay don't worry just look down there find that little link and click on it and then you should end up here okay now it should be really pretty easy we're going to come over to file we are going to say new connection again this sign in would be for that signing into the VNC server or the VNC website or whatever note we're going to make a new connection and then the IP address remember you should have made note of that earlier I am 192.168.88.41 like that and now we're going to come down and say okay now the first time you do that again I am redoing this from earlier the first time you do that you're probably going to get a pop-up with a red warning someone's trying to connect this and that blah blah blah and you know that it's you trying to connect so you can just say okay and not worry about it you should just be able to say okay and not worry about it now let's see let me see if I can rename this I kind of got quick on that and I should have given it something like like uh like uh my pie and I'll put an IV for four okay my Pi 4 and then we'll call it that we'll call it that okay now with that created I am going to right Mouse click and I'm going to say connect okay and then it is trying to connect there and we'll see what happened boom now it's coming up and it's asking me for what my username and my password this is the login username for your Raspberry Pi and so like if you're at default you would be username pi and password raspberry now I am username Pi but I change my password but don't get confused this isn't a V and C credentials or anything like this this is just flat out how you would normally log into your Raspberry Pi so for me I'm pi and then I am my pet's name no no I don't use pets names for uh passwords okay so now I put that in I might go ahead and remember the password so next time I can just connect without putting it in you've got to think about the security implications of all that sort of stuff but I'm going to click ok and Shazam look at that guys this is the PC screen here this is the PC screen here and what do you have you have a Raspberry Pi desktop now if you come here you see this little pop down I'm going to make it full screen and now wow look at that that really is just like you're working on the Raspberry Pi so you see like I could come I could come over here and I could fire up a uh I could fire up a terminal and then I could come over here and I could say if config using what using my windows keyboard my windows monitor my windows Mouse and then what you can see is it's just like you were connected directly to the Raspberry Pi pretty cool huh pretty cool okay so now I got to show you a couple of other little things so what I'm going to do is I'm going to close this and you can see that I can actually come down here and I can log out and then I can shut down from here now when I shut down from here it's going to give a oh disconnected disconnected well why am I disconnected I am disconnected because the Raspberry Pi I'm disconnected because the Raspberry Pi got shut down and so now I'm just going to kill this window because it's sitting there trying to find something that isn't running anymore so now what we're going to do is we're going to come back to our overhead view of the Raspberry Pi and then it is shut down now so what I'm going to do is I'm going to take this little keyboard and mouse dongle out I'm going to take the HDMI cable off and now this one last cable all it has is power like yeah this goes to a little power plug but there would be no reason that I couldn't just plug it into a USB battery bank or whatever power source that you wanted the point is we are totally headless we don't have a monitor we don't have a keyboard we don't have a mouse so what I'm going to do is I'm going to unplug it okay and then I am going to plug it back in and as I plug it in what I do is I like to watch that little green light and that little that happy little green light is going to dance around for a little while and when it seems to have kind of settled down then I'm just gonna you know then I'm going to sort of say okay it's probably booted but you need to give it some you know half a minute or a minute to get booted and you need to make sure that you gave it enough time to hook up to your router now I do need to say one more thing about it being hooked up to your router you saw that we got our IP address earlier when we were configuring things understand that that's probably a dynamic IP address and what that means is is that if you're router if your router shuts down or your router reboots the next time the router comes up chances are it might not give your Raspberry Pi the same IP address that it did last time and so if that's the case you would need to come in and find out again what the new Raspberry Pi Pi I pre-addressed this which I just showed you how to do however what you can do is you can connect to your router usually what you would do is you would type in the IP address of your router which you can get from the box or the back of the router or the instructions you type that into a browser it brings you to a router configuration page and usually on there there's something called like reserve an IP address or a static IP address and what you would want to do is you would want to reserve that IP address for your Raspberry Pi so that every time when you reboot the router or every time you connect you have the same IP address now I can't show you how to do that because there's a million different routers and there's a million different configurations you might have but all of them they should have a place to re either it'll say reserve an IP address or set you know Reserve an IP address or set a static IP address and then Reserve that for the Raspberry Pi you can look in the instructions of your particular router to see how to do that and then it will always have the IP address and this will always work and I hate sitting there floating in midair as I have been doing okay so it looks like it's booted make note the only thing coming in here is what power so we are really remote here we are really mobile we have gone mobile and so let's come over here and then what I am going to do is we have come here and then uh yeah I was confused it looked like the pie wasn't booting ah yeah I remember I don't have the monitor connected so yeah that's exactly what we'd expect we come over here right Mouse click connect with a little look boom Shazam look at that guys do you see let me remind you what we have here no monitor no keyboard power only and the pi is operating completely from the remote desktop and again I can just show you here I this is the PC monitor that you're looking at it's the PC Mouse and the PC keyboard that I'm using and I can come up and do something like fire up a terminal okay guys that is just pretty cool if you ask me and a lot of times I'll be honest with you a lot of times if I can do it with putty and just SSH and do things for from the terminal window that's the way that I usually do it I usually do it from the terminal window but I will admit for a lot of things that's very nice to have VNC running and I really like how Snappy and how quick VNC is these days you know we've all got faster routers we have faster computers the raspberry itself is faster and so as I am working on the remote desktop I can't really detect hardly any latency or slowness or or laggishness on it at all it's as if I was just really running directly from the Raspberry Pi okay guys I hope you are having as much fun taking these lessons as I am making them if you enjoyed the video be sure to give us a thumbs up if you have not already subscribed to the channel when you do make sure you ring that Bell because uh that will notify you when new lessons are coming out and then what the most important thing is the most important thing is for you to share these lessons with other people because the world needs more people writing code and doing engineering and fewer people sitting around watching silly cat videos Paul McWhorter with toptechboy.com I will talk to you guys later
Info
Channel: Paul McWhorter
Views: 11,443
Rating: undefined out of 5
Keywords:
Id: DKwpOTzPP_A
Channel Id: undefined
Length: 23min 38sec (1418 seconds)
Published: Thu Dec 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.