Friday, June 3, 2016

Tight VNC Server On Raspberry Pi

Good morning everyone so according to my plan I was experimenting with the Raspberry Pi and trying to document as much as possible but the process is still pretty slow but here is a small bit of that. So we know Raspberry Pi is a single board computer that has its own Video output but what if you don't want to use it and you are not happy with the SSH either then a virtual network computing might come handy. So this post is about how you can set up VNC and use it on raspberry pi. 


First of all what do we need?

1. The obvious one which is a Raspberry Pi, I'm using the Pi 2 model B. 





2. Next we need something to power up the Pi. I'm using my good old phone adapter from Asus. You can use whatever you have on hand but make sure it is from a reputable brand.



3. You need to connect the Pi to the network where the other system is connected in order to make this happen. Probably you can connect a Pi directly with your system and it will still work but it is much convenient to use a router or something. I'm just using my home router to connect with both my computer and Pi 2 via Ethernet cable. You can use wired or wireless network, no problem.


4. We need some software like Putty and Tight VNC for the computer which I will get more into in procedure section. These software are free and download links will be on the resource section.

So let's begin!


First let's talk about the connection.

I'm guessing you are running the latest version of Raspbian. So just plug in the network wire and power it up. In case of Wireless, make sure to connect to the network that you will be using and done.


Procedure:

1. Make sure your computer is also connected to the same network and get the IP address of your Pi. To do this you can check the router's client list. In my case it is 192.168.0.103. 




One important Tip here, if you have to frequently use SSH to login and you need the IP often and you don't want to turn off the DHCP of your router then what you can do is reserve the IP address against that MAC address. This way your Pi(or any other device) will always have the same IP as long as that MAC address matches.

There is another easy way however, just type ifconfig directly on the Terminal of Raspbian or via Putty and you will get the IP address. (Although if you already have the IP to connect via Putty why would you need the IP one more time right?)

 



As I'm using Pi 2, I only have the wired Ethernet, if you use Pi 3 or an USB Wi-Fi dongle you might get one more option of eth1 and make sure you use the proper IP. 

2. Now that we have the IP address we will move on to Putty and login.

Default User : pi 
Default Password: raspberry



Okay so we are in!

3. Make sure your Pi is fully updated, if not type in the following commands and update the pi.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Now when the upgrade process is finished let's start installing the VNC server. To do so type in

sudo apt-get install tightvncserver



So mine was already installed and updated. For you just install it.

4. Now to enter the password type in tightvncserver and hit enter.



It is nothing that complicated either, for the first time you need a password that viewer computer has to put in to see. I keep it at default raspberry.

5. Now let's start a full high definition session on display 1. Remember when your Pi boots up it has already started a display at display 0, so you have to use display 1. To do so type in

vncserver :1 -geometry 1920x1080 -depth 24



You can probably use 32bit depth but I tried using it and didn't work so 24bit is fine. 


6. Now download and install tight VNC viewer on your computer and launch it. 




Important thing to remember is the :1 part, if your pi starts broadcasting at display 2, you have to use :2 for that. Anyway after launching Tight VNC viewer, type in the IP with display number and hit enter. Next enter the password that you set up earlier. Click okay and done, now you should view through the network and work on it. Let me show you an example.



So that's pretty much how you can set the whole thing up. There are much to it actually like turning off the display at 0 because remember display 1 and display 0 are not showing the same thing. You can also set up tight vnc server to start at the boot, the way that I have shown will require you to start each time you boot up the pi.

Anyway that's pretty much it, let me add the useful links down below.


Resources: 


Good luck and happy experimenting!


No comments:

Post a Comment