From the course: Raspberry Pi Essential Training

Using VNC on a Raspberry Pi

- [Instructor] When you have a VNC connection set up between your Raspberry Pi and your laptop, you have several new ways to use your Raspberry Pi. The most obvious new capability is remote control. This provides a way to control your Raspberry Pi over the network and without a keyboard, mouse, or monitor. Less obvious, VNC provides a way to use your Raspberry Pi without a tangle of wires. Both of these mean your Raspberry Pi can fit in less space, with less clutter, and in inconvenient locations. I've mentioned this before as weatherproofing, but it also applies to applications such as an overhead kiosk. Another use of VNC is file transfer. Depending on the VNC client you are using, it's easy to transfer files to and from the Raspberry Pi. To transfer a file from the Raspberry Pi to a RealVNC client running on Macintosh, Windows, or Linux laptop, start at the Raspberry Pi. Open the VNC dialogue from the widget in the upper right-hand corner, select the menu in the upper right-hand corner of the VNC Connect dialogue, go to File Transfer, select Send Files, which is located at the lower left corner of the file transfer dialog. You can also choose which directory the file is transferred to. You'll now be able to choose a filed transfer. Navigate to the file. In this case, I'm choosing a file from the exercise files located on the desktop. When the file is transferred, you'll see a confirmation dialogue on the client computer and that dialogue isn't shown here. The Raspberry Pi dialogue will return to send files. When you're finished sending files from the Raspberry Pi, close the dialogue. To transfer a file from a client running on Macintosh, Windows or Linux laptop to a Raspberry Pi, start on the client laptop. Here, we're looking at the Raspberry Pi as seen from the VNC client running on the laptop. On the VNC client running on the laptop, move the mouse to the top of the screen. You'll see a menu drop down. Select the icon that looks like a page with arrows pointing both ways. This will open the VNC viewer file transfer menu. Click on Send Files located in the lower left-hand corner. You can also select a destination folder on the Raspberry Pi from the pop-up menu at the bottom of this dialogue. Navigate to the file you wish to transfer. In my case, I'm transferring a file named Articles.pdf from the laptop downloads folder. When you click on Open, that file will be transferred to the Raspberry Pi. You can close the file transfer dialogue. Now, we're again looking at the Raspberry Pi from the VNC client viewer. Notice that dialogue in the middle of the screen, declaring a transfer to be complete. Also notice the appearance of Articles.pdf on the Raspberry Pi desktop. RealVNC provides a way to control the Raspberry Pi from outside your local network. Imagine controlling an information kiosk located in downtown Portland from your home office in Seattle. Setting up VNC in a cloud is a three-step process. First, create an account at RealVNC. Go to realvnc.com and click on Sign in. If you don't already have an account, RealVNC will help you create one. After you successfully create an account and log in, you'll see the team and account menu on the left. If you have more than one account, you may have more than one team. By the way, I've enabled two factor authentication so you'll see I'm being asked for extra verification. Next, add the Raspberry Pi to the cloud. To do this open, the VNC menu on the Raspberry Pi, click on the down menu in the upper right, then go to Licensing. Use your RealVNC username password and two factor authentication if you have it and log in. You might want to change the name of this computer in the team so you can clearly identify which Raspberry Pi this is. With that, you're done adding this Raspberry Pi to the team. Now, when you go back to the RealVNC website, you'll see this new computer listed. To control that Raspberry Pi, open the RealVNC client, then use the menu in the upper right to log into your RealVNC account. When you're logged in, you'll see an address book and a team menu. Click on the team menu to see the Raspberry Pis connected to the cloud. Double click on the Raspberry Pi you wish to talk with and when prompted, enter the username and password for the Raspberry Pi. This is not your RealVNC account password. You have now established a VNC connection to that Raspberry Pi through the RealVNC cloud and can control the Raspberry Pi from anywhere in the world. The last VNC trick I'm going to discuss is the range of VNC clients. You don't need a laptop. You can also control the Raspberry Pi from your phone or even another Raspberry Pi. Navigate to the RealVNC website and download a client for your laptop, handheld phone, or Raspberry Pi. You can use standard VNC connection methods to control the Raspberry Pi. VNC is a really useful tool for controlling your Raspberry Pi without a keyboard, mouse, or monitor. I encourage you to add it to your toolkit.

Contents