This is the third tutorial in our Raspberry Pi programming course. In the previous chapter, we learned how to install Raspbian on our Raspberry Pi mini-computer. In this chapter, we’ll learn how to use a VNC server to remotely control and see its desktop from our computer.
What is VNC?
Computing over a network is known as “virtual network computing,” or “VNC.” To remotely control another computer, you can use this screen-sharing technology, which works on all major operating systems. As a result, a remote user can interact with a computer’s display (screen, keyboard, and mouse) as if they were sitting right in front of it.
VNC takes advantage of the client/server concept. Rather than installing a VNC server on the distant device, users will instead use a VNC viewer or client on the device they wish to control. Use a tablet or a smartphone in place of one of the previously mentioned computers. As soon as a viewer and a server are connected, the server gives the viewer a screen copy of the computer on the other side of the world.
Thanks to the application, both the remote user and the connected user can see and control everything on the distant computer’s screen using keyboard and mouse instructions from afar.
What’s a VNC Server?
Other programs (referred to as “clients”) can access the resources on a computer server. The server can provide services to one or more clients, such as data or resource sharing, in what is known as the “client-server model.” The advantage of this strategy is that a single server can service many clients, while a single client can make use of several servers. A server will respond to a request from a client by sending back a response.
When a computer has VNC Server software installed, it can be accessed and controlled remotely from another device. The software makes it possible to stream the device’s desktop to another computer running VNC Viewer. Once a connection is established, users using VNC Viewer can view exactly what a person seated in front of the remote computer sees (with permission).
What’s a VNC Viewer?
A viewer is a piece of software that allows you to see the contents of a digital file in its entirety.
Remote control of local PCs and mobile devices is made possible through the usage of VNC Viewer. Using VNC Viewer software, a user can access and operate a machine from another place using a device such as a computer, tablet, or smartphone.
As a desktop sharing system, it delivers keystrokes, mouse clicks, and other input events to a remote computer running VNC Server so that you may control it from your mobile device once connected. It’s as if you’re sitting directly in front of the computer that you’ve accessed remotely.
What protocol is used by VNC?
VNC uses a protocol called remote framebuffer to share data between the client and server, which determines the type of data exchanged. Using this, clients can access and control another machine from afar. Because it’s compatible with all windowing apps and systems, it may be used on any mainstream operating system, including Windows, macOS, Linux, and others.
User access to a computer’s monitor, mouse and keyboard is provided via the RFB client or viewer (also known as a client). Framebuffer updates originate on the RFB server (as in the windowing system). A key goal of Remote Framebuffer is to run on a wide range of hardware and to simplify the process of building a client by requiring as little input from the client as possible.
File transmission, more advanced compression, and stricter security procedures have all been added to RFB since its inception as a basic protocol. When using VNC, clients and servers can agree on the appropriate RFB version to use, as well as the security and compression options that are supported by both parties. Cross-platform interoperability is made possible as a result of this.
Why use VNC?
There are times when you won’t be able to use your Raspberry Pi. For instance, you might have forgotten about your Raspberry Pi while away, or it may be buried beneath your TV or other devices. Using Raspbian and the free VNC software, you can connect to your Raspberry Pi wirelessly from any other device running Raspbian. You have the option of connecting to the internet or to your home network.
Prerequisites
- Raspberry Pi running Raspbian
- A network connection
- A VNC server and viewer
Configuring VNC on a local network
Enable VNC
Begin by ensuring that both computers involved are on the same local network.
Select Preferences > Raspberry Pi Configuration from the apps menu icon (raspberry) at the top-left of the screen.
The default password for Raspbian is ‘raspberry,’ which you should change right away. By clicking the Change Password option, you can set a new password. Select the Enabled radio button next to VNC on the Interfaces tab. OK when you’re finished. Menu bar in upper right corner of screen has VNC button at end of menu bar VNC Server will be launched as soon as you click on it.
Note your Ip address for the next steps.
Open VNC Viewer
You can now link your Raspberry Pi to another computer. Instead of a Windows computer, you might use a Mac or Linux computer on the same network or even another Raspberry Pi.
With a web-based interface, VNC Viewer may be used on a variety of platforms including macOS, Linux, Android, and iOS. On the official website of realvnc, download VNC Viewer. To use the software, it must first be downloaded and then installed.
Connect to Raspberry Pi
In the “Enter a VNC Server address or search” box of the VNC Viewer, enter the Raspberry Pi’s IP address (the four numbers displayed in VNC Server). RETURN is all that is needed to disconnect when a connection is established. If an error message appears, press the Enter key to proceed.
For security reasons, you’ll need to log in with your Raspberry Pi’s username and password. To remember your password and access Raspbian, select ‘Forgot Password’ and then OK.
Remote control
The Raspberry Pi window is shown on your windows computer. By dragging the mouse cursor around the screen, you can see the Raspberry Pi’s mouse. Remote control of your Raspberry Pi is now possible thanks to this window.
When you hover your mouse over the top of the VNC Viewer window, a menu will appear. Enter The Full Screen option is located to the left of the Options and allows you to have the preview window take over your screen. Because your Raspberry Pi display may not be compatible with your PC display, choose Scale from the menu (such that it is set to Scale Automatically).
Your Raspberry Pi will provide you a desktop PC-like experience.
Looking at properties
Close the VNC preview window and use the VNC Connect menu bar to get to the properties. You can end a session from the drop-down menu.
To access your Raspberry Pi’s desktop, simply open VNC Viewer from the Address Book. To reopen the connection, simply double-click on the icon and select Properties from the context menu that appears.
Enter ‘Raspberry Pi’ in the Name field. This will give your screen a more personal touch. After that, select Options. Automatic is the default setting for Picture Quality on your camera. The lower the setting, the better; if you have a fast connection, the higher it should be.
Make sure to check out the “Experts” section at the bottom. In this section, you’ll find configuration options for pretty about everything on your computer. You can change the False to True option in the Fullscreen drop down box. In VNC Viewer, you can preview your Raspberry Pi in full-screen mode. After you’ve made your options, click OK to keep them.
Remote access in wide area network
You may access your Raspberry Pi from anywhere in the world with a RealVNC account.
Verify your identity in the upper left corner of VNC Viewer when it has been opened. Sign up if you don’t have an account. Set up a password for your account. Keep your password at least eight characters long and difficult to decipher. There is a RealVNC home page that you will be taken to. Verify your email address and you’re done setting up.
Sign in
A single account must now be used to sign in to both of these applications.
You should be able to see the VNC Viewer Sign In window from the computer. Your Raspberry Pi must be running VNC Server before you can connect to the cloud.
Go back to the VNC Viewer application on your PC. In the Address Book area, you will find a Raspberry Pi Window, but you’ll also notice a Team option immediately below it.
What exactly is the distinction between the two?
This account can be used from different networks and operates remotely.
Send files
Sending and receiving files is possible between the Pi and computer. We’ve created a new text file called test.txt in our Documents folder.
Connect to the Pi using VNC Viewer to send a file. An option to transfer files can be found in the VNC Viewer preview window’s menu.
Sending files is as simple as clicking the Send Files button in the VNC Viewer’s File Transfer window and the transfer will begin. Click Open after you’ve selected a file from your computer’s file picker. On your Raspberry Pi’s desktop, the file will be saved. The message “Download complete” will appear in the File Transfer window; close it.
Retrieve files
With VNC Viewer, it is possible to download files from your Raspberry Pi’s SD card. VNC Server icon can be found in the Raspbian menu bar by right-clicking it. Select File Transfer from the VNC Server drop-down option to open the File Transfer window.
Your Raspberry Pi can now be accessed remotely. The screen and keyboard can now be removed from your Raspberry Pi and left connected to the network. The PC connection will be waiting for you when you’re ready.
Connect with Android and iOS
Using your smartphone, you can also remotely connect to the Raspberry Pi. Download the VNC Viewer software from the app store, then, open your VNC Connect account and log in using your email address and password.
Your Raspberry Pi will be listed in the Team drop-down menu. Click it and input your Raspberry Pi’s username and password.
On start up, you will have to go through the ‘Control the computer’ step. The ‘How to control’ window will open once you click Next. This screen shows you how to use movements like mouse clicks on the touchscreen. Start using Raspberry Pi from your phone by closing this window.
To move the cursor, make use of your smartphone’s touchscreen. An on-screen keyboard can be accessed with a simple swipe of your finger on a key at the top of the app.
Even on your phone, you can now access your Raspberry Pi. Remote monitoring has never been easier.
Misconceptions about VNC and VNC Connect
When it comes to deploying new software and systems, there will always be some trepidation, and there is a lot of misinformation floating about that influences how people feel about doing so. However, this has the drawback of preventing individuals and organizations from reaping the full benefits of new technologies.
In this article, we’ll debunk some of the most popular myths regarding VNC Connect, many of which can be traced back to VNC’s open-source roots.
- VNC is open source. Open-source software is common among recent adaptations of the VNC protocol; however, this does not apply to all VNC-based software. As of 2016, VNC Connect, which uses RFB protocol version 6, is not open source.
- It is not safe to use VNC-based software. Out of the box, open source VNC-based remote access is vulnerable to attack. Secure connections are built into VNC Connect right out of the box, and remote PCs are secured by default with a password or system login credentials.
- VNC doesn’t work with the cloud. The majority of open-source VNC-based applications is only available for use offline. Offline (commonly known as “direct”) and cloud connections are also available through VNC connect, so you can select the one that best suits your company needs.
- The VNC protocol is out of date. VNC technology has been around for more than 20 years, but it has undergone a major transformation. VNC Connect is continually checked and updated to correct any faults that may arise and to meet the ever-changing needs of its users. The software roadmap is based on user feedback to ensure that it incorporates the designs and features that are most frequently requested.
Conclusion
Because buying two keyboards, monitors, and mice for your computer and Raspberry Pi would be prohibitively expensive, VNC is a great option to gain access to your raspberry pi remotely. The two computers can be used at the same time, and you don’t have to switch between them. So far, we’ve learned how to set up our mini-computer for VNC and how to establish a remote connection to the VNC viewer. Our first project will be to use Python to control the GPIO pins of a Raspberry Pi 4, which we will cover in the next topic.
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
The post How to Control Raspberry Pi 4 from Laptop using VNC appeared first on The Engineering Projects.
No comments:
Post a Comment