When I first ordered my Pi, I envisioned myself working on it from my laptop the entire time.
Thankfully, this is now true, but it took a few steps to get everything setup.
In this tutorial, you’ll learn how to access your Pi’s desktop remotely so you can use your laptop to work on your Pi projects.
This means you can plug the power into your Pi and leave it in another room while you work on it remotely from your laptop. No need for the keyboard, monitor, mouse, and cable mess.
Brand new Pi’s need a monitor, mouse, and keyboard connected to initially set up. If you are still just thinking about getting a Pi, you’ll need to purchase these accessories or borrow them from a friend for the first time you turn on your Pi. I purchased a cheap keyboard and mouse from Amazon.
The end result
When you’re finished, you’ll have a window on your laptop just like this where you can use your Pi’s interface.
The cursor is perfectly responsive and there is only a tiny bit of input lag when connecting in this way.
Let’s get to the first step for enabling remote access.
Enable VNC
The software we’ll be using is called “VNC” and it comes pre-installed on the Pi OS.
To enable VNC on your Pi, click on the Pi icon in the toolbar, hover your cursor over the Preferences item, and click Raspberry Pi Configuration.
In the menu that pops up, open the Interfaces tab and check the Enable option for VNC.
Pretty darn easy, right?
Now that you have VNC enabled, you can start your VNC server. You need to turn on the server on your Pi to allow remote devices (like your laptop) to connect.
Turn on your VNC server
Turning on the server is equally easy.
Click on the terminal icon in the status bar to open up your command line, and enter the following command.
vncserver
Hit Enter and the server will spin up in a matter of seconds allowing you to connect to your Pi from your laptop.
Next, you need to install VNC Viewer so you can access the server running on the Pi.
Install VNC Viewer
You can download VNC Viewer for free from this page on their site.
The installation process is straightforward and will only take a minute. You don’t need to create an account unless you want to access your Pi from a remote network.
Once you’ve downloaded and installed VNC Viewer, you’re ready to connect to your Pi.
Connect to your Pi
When you first open up VNC Viewer, you’ll see an empty interface where your connected devices will show up.
To connect remotely to your Pi, you’ll enter it’s IP address into the input at the top.
To find your Pi’s IP address, enter the following command into the terminal:
hostname -I
You should see the IP address output plainly on the next line.
Enter this IP address into VNC Viewer and the connection process will begin. You’ll see this notice confirming this is a new server you haven’t connected to before. Click Continue.
After this, you’ll be asked to login. The username will be “pi” and the password will be whatever password you entered when initially setting up your Pi.
If you forgot your password, you can change it anytime from the configuration menu.
Once you enter the username and password, VNC may request access to certain accessibility features.
Click Give access, and if you’re using a Mac, you’ll recognize this screen where you’ll check VNC Viewer and then click the lock icon at the bottom to finish your changes.
Once that’s complete, you’re in! You should now see your Pi’s desktop loaded inside the VNC Viewer window.
While I’m sure you’re excited to work on a project, there’s one more thing you need to know.
You have to update the IP address
During this tutorial, you had your Pi plugged into a monitor and VNC was using a replica of that monitor’s screen. When the Pi isn’t plugged into a monitor, there is no screen to replicate so you need to use a “virtual desktop” instead. This requires a slight change to the IP address.
In my example, the Pi’s IP address was 192.168.1.17
. In order to connect with VNC when the Pi isn’t hooked up to a monitor, :1 needs to be added to the end of the IP address, like this: 192.168.1.17:1
.
Make sure you update the IP address so you can continue using VNC Viewer even when your Pi isn’t plugged into a monitor.
Learn SSH next
Another great way to connect remotely to your Raspberry Pi is by using SSH. In fact, learning how to run simple commands via SSH is going to make your life a whole lot easier.
For example, if you turn off your Pi or reboot it, the VNC Server is going to shut off. That means to use VNC Viewer again, you’ll have get your Pi and plug in the monitor, keyboard, and mouse just to access the terminal and type “vncserver.”
On the other hand, if you know how to connect to your Pi with SSH, you can simply run the vncserver
command from your laptop without needing to connect in all the peripherals.
Once you understand both of these techniques for remote access, you can reliably use your laptop for all of your Raspberry Pi projects.
Be First to Comment