Wednesday, 24 January 2018

Using Laptop as your Raspberry Pi's Display

Hi guys,

                Those who want to step into the raspberry pi world have a question, how can I use my laptop as the Pi’s display, the most common answer for this is ‘VNC Server’, when we look into the procedure it seems very easy but many people will get stuck. I’m sharing my experiment in this. And I feel this will be very simple to everyone to follow.



What all things you need?
  • 1.       A Raspberry Pi installed with Raspbian OS
  • 2.       RJ-45 Ethernet cable
  • 3.       5V charger to power the Pi
  • 4.       Laptop
  • 5.       Internet Connection
  •  Step 1


Most of the issues coming when you are trying to connect with VNC is due to the IP address conflicts happening when you connect via router or direct to laptop. First thing you need to do is to install the Pi with Raspbean OS by using Win32 Disk imager, configure Pi by connecting to a display. If you are not having any display you follow my tutorial for connecting Pi to your Android device and using the command prompt or by using Putty you can jump to the package installation(Step 3) after configuring the Pi. But for the first boot and configuration you need a display and keyboard. Don’t forget to enable the SSH in the advanced options of the configuration menu appear on your first startup, If you forgot you can invoke it by calling raspi-configfrom terminal.  Enable the desktop mode from the Config if you want to start up the Pi in desktop mode.


Now you need to install some packages from the internet for the VNC server, If you can’t connect the Pi to the router via Ethernet you can Connect the Pi to the laptop with an Ethernet cable, (assuming you are connected to internet via Wifi). If you can connect the Pi to both display and router you can skip to Step 3.

  • Step 2


Connect the laptop to the wifi and connect the Pi to your laptop’s Ethernet port. Go to the control panel of the laptop-> Network and Sharing center->change adapter Settings-> Right click on your wifi adapter which you are connected now-> Take properties-> In sharing tab put tick mark for “Allow other network users to connect through this computer’s Internet connection”, and select the ‘Home networking connection’ as your local Area Connection, that is your Ethernet connection you have connected the Pi, Click Ok and wait for a while. Your Pi will be enabled with internet !!! Check the connectivity by opening any address in you Pi.

  • Step 3


Now open the Terminal, we need to update the OS to meet the requirements to install VNC, follow the commands
$ Sudo apt-get update
$ sudo apt-get install tightvncserver

After installation of the vnc server, start the VNC server by cmd,
$ vncserver :1
When you are running it for the first time it will ask for a password, give it anything you can remember, after that it will again ask for another type of password, you can ignore that one by giving no when it ask. Now your Pi will start the VNC server. If you want to make the Pi to start the VNC server every time when it boots go through the following steps.
$ cd /home/pi
$ cd .config
$ mkdir autostart
$ cd autostart
$ nano tightvnc.desktop
Now Nano will open a new file, type the following code snippet to it.
[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false

Press Cntrl+X, then type Y and then Enter. Now the file will be saved in the directory. From the next restart VNC Server will be auto started after boot.
Now you have installed the VNC Server.

  • Step 4


Now you install the VNC server  for your desktop, you can get it from the official site of VNC and get a one month free licencing option. If you don’t want it to purchase you can go for a torrent version, I mean a cracked one. Install it and do the further process.
In many tutorial it is said to make the Pi’s Ethernet as static IP, but in my case it was making some ip conflicts in my router, don’t know clearly about the networking related issues. I prefer to remain the network setting of the Pi in Manual mode if you are using a single laptop with the Pi. Normally people are using static IP in order to remain the IP of your Pi be constant so that it can be easy to give the IP to the VNC server during login. But like me many fiends will face issues with static IP, so better remain in the manual mode and let you laptop or router to provide the IP. You can easily find out in one step and it is very easy and error free. For that make sure that your laptop Ethernet is set to DHC mode.
Go to control Panel -> Network and Sharing center -> Manage Adapter Settings-> Take Properties of the Ethernet connection-> IP V4 Properties, and select ‘Obtain IP Address Automatically’. Wait for a few seconds and now your Pi running with VNCServer is being attached to your laptop via Ethernet.
For finding the IP of your RasPi, go to Command Prompt in your laptop and type the command:
arp –a
Now a list of connections and connected devises to each connections will be shown, most cases the first network interfaces listed will be the Ethernet connection and in that list the first device should be the device which is connected to the Ethernet port that is your Pi. You can also confirm the PI by verifying the Physical Address ie, the MAC ID. You can get the MAC ID of your PI by typing the command ‘ifconfig’ in the Pi’s Terminal.


Here the IP of my PI is 192.168.137.97, since it is elected as dynamic for the next boot it may change, but be sure that If you are using DHCP there will not be any IP conflict happen in your system. Now open the VNC Viewer Software in your laptop and the put the IP as “192.168.138.97:1”(in this case), the last ‘:1’ is the port and you need to mention that also like this format, and that is same is you have started the vncserver in your Raspi at port 1 (vncserver :1) and press connect option. Now the system will prompt the password, give the password you given when you setup the VNCserver in RasPI and click OK.

Now your Pi’s Desktop will be displayed and the remote access service has started. Kudos !!!!! You done it !!!!!


At each time you startup Pi for this you just need to check the Pi’s IP by using the command ‘arp -a’ and just give it to the VNC. This is a simple and easy technique who can follow those who are having issue when using static IP.
Hope you enjoyed the post, put your issues and suggestions below. Thanks for reading….

No comments:

Post a Comment