The Best way to Connect Raspberry Pi to Laptop display

 

From our STAR Maker: Sohil Patel

Connect raspberry pi to laptop display DIY Hacking

Connect raspberry pi to laptop display

The reason why I came up with this tutorial was because: one day, me along with my friend Suvigya were struggling to work on the raspberry pi, since we did not have any HDMI/AV diaplays. Hence, I came up with this tutorial so that others who are also in the same situation as ours would be able to use the display of their laptops as a monitor to the Raspberry Pi.
As we know Raspberry Pi is known as the “Pocket Size PC”, but for debugging & project purposes its cumbersome to carry an additional display just for that. Also, many of us wont have access to a HDMI display too. So, we figured out a way to easily connect raspberry pi to laptop display. So sit back and enjoy this simple tutorial :)

Connect raspberry pi to laptop display DIY Hacking

What are the stuff required to do this?

  1. Raspberry Pi.
  2. Ethernet Cable.
  3. Laptop.
  4. SD Card with Raspbian.
  5. Micro USB Cable.

(Optional) Components required for setting it up the first time:

  1. HDMI/ AV Display.
  2. Keyboard and Mouse.
How does it work?
To connect raspberry pi to laptop display, you can simply use an ethernet cable. The desktop GUI (Graphical User Interface) of the raspberry pi can be viewed through the laptop display using a 100Mbps ethernet connection between the two. There are many softwares available that could establish connection between the raspberry pi and your laptop. We would be using the VNC server software to connect the pi to your laptop.
Installing the VNC server on your pi allows you to see the raspberry pi’s desktop remotely, using the mouse and keyboard as if you were sitting right in front of your pi. It also means that you can put your pi anywhere else in your home, but still control it. Also, internet can be shared from laptop’s WiFi over Ethernet. This also lets you access internet on the pi and connect raspberry pi to laptop display.

Step 1 : Setting up your Raspberry Pi

Before moving to connect raspberry pi to laptop display, you need an SD card having the OS preinstalled. You will find lots of blogs and tutorials about preparing an SD card for the Raspberry Pi. But if you are a beginner, you can simply download this free beginner’s guide eBook on pi: Raspberry Pi guide. This will show how to install the OS for the raspberry pi.
After setting up your SD Card, insert it into the raspberry pi. Next, for powering the pi connect your micro USB cable to it. Also connect your raspberry pi to the laptop via an ethernet cable. And connect the keyboard & mouse to it. Now, connect the HDMI display (the HDMI is only required for running the pi for the first time). Now power on your Pi. And follow the next steps to connect raspberry pi to laptop display.

Step 2 : Sharing internet over ethernet

This step explains how you can share your laptop internet with the raspberry pi via Ethernet cable.
In Windows : For sharing internet to multiple users over Ethernet, go to Network and Sharing Center. Then click on the WiFi network:

Connect raspberry pi to laptop display DIY Hacking

Click on Properties (shown below), then go to Sharing and click on “Allow other network users to connect”. Make sure that networking connection is changed to “Local Area Connection”:Connect raspberry pi to laptop display DIY Hacking

Connect raspberry pi to laptop display DIY Hacking

Note : Doing this will provide a dynamic IP to the Ethernet port of your laptop and other Devices connected to your laptop. Now, for checking the IP assigned to your laptop, click on the new local area connection link created:
Connect raspberry pi to laptop display DIY Hacking
As shown above, the IP assigned to my laptop is 192.168.137.1. For checking the IP assigned to the connected ethernet device, do the following. Considering that IP assigned to your Laptop is 192.168.137.1 and subnet mask is 255.255.255.0 :
  • Open command prompt.
  • Ping on broadcast address of your IP. (Type) Eg: ping 192.168.137.255
  • Stop the ping after 5 seconds.
  • Check the reply from device: arp –a

Step 3 : Setting up the VNC server to connect Raspberry Pi to laptop display

If you have an HDMI display: Using the connected HDMI display on your pi, you should install VNC server in raspberry pi. Open the LX-Terminal and type the following commands to install VNC:
$ sudo apt-get update
$ sudo apt-get install tightvncserver
If you don’t have an HDMI display: If you do not have a display even for one time setup, then no need to worry. Install Putty as per your windows configuration and via SSH you can connect with your raspberry pi. And, as you get access of your pi terminal, run the same commands as above to install VNC.
Starting VNC Server on Pi :
For starting VNC, enter the following command in SSH terminal:
$ vncserver :1
You will be prompted to enter and confirm a password. This will be asked only once, during first time setup. Enter an 8 digit password. Note that this is the password you will need to use, to connect to the Raspberry Pi remotely. You will also be asked if you want to create a separate “read-only” password – say no (n).
Yippeee :)….The VNC server is now running on your Pi and so we can attempt to connect to it. But first we must switch to the laptop, from which we want to control the pi. Then setup a VNC client to connect to the pi.

Step 4 : Setting up the client side (Laptop)

Download VNC client from here and install it. When you first run VNC viewer, you will see following:

Connect raspberry pi to laptop display DIY Hacking

Enter IP address of your raspberry pi given dynamically by your laptop (you got the address from the earlier step). And append with :1 (denoting port number) and press connect. You will get a warning message, press ‘Continue’:

Connect raspberry pi to laptop display DIY Hacking

Enter the 8 digit password which was entered in VNC server installation on raspberry pi:

Connect raspberry pi to laptop display DIY Hacking

Finally, the raspberry pi desktop itself should appear as a VNC window. You will be able to access the GUI and do everything, as if you were using the pi’s keyboard, mouse and monitor directly. As with SSH, since this is working over your network, your pi could be situated anywhere as long as it is connected to your network.
Connect raspberry pi to laptop display DIY Hacking

Raspberry pi desktop on your laptop display

Step 5 : Running VNC server at startup in Raspberry Pi

Connecting to your raspberry pi remotely with VNC is fine as long as your pi does not reboot. If it does, then you either have to connect with SSH and restart the VNC Server. Else, arrange for the VNC Server to run automatically after the raspberry pi reboots. To ensure that VNC starts automatically each time on booting up, run the following commands on terminal:
Open “.config” folder from pi’s: user folder (it is a hidden folder).
$ cd /home/pi
$ cd .config
Create folder called “autostart” in it. Also create file called “tightvnc.desktop” in that folder. To create file you can use any known text editor. Here I use gnome-text-editor for this:
$ mkdir autostart
$ cd autostart
$ gnome tightvnc.desktop
Edit the contents of file with the following text and save the file:
[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false
Now next time you reboot your Pi, vncserver will start automatically. And seamlessly would connect raspberry pi to laptop display. Good job :)
So, whenever you want to do something with your pi, just connect it with ethernet cable to your laptop and power it. Then open VNCViewer, mention the IP address of your pi. And you can use the display of your laptop as the raspberry pi’s monitor.
Sohil Patel

Sohil Patel- STAR Maker at DIY Hacking

-Sohil Patel
I am a Coder and highly enthusiastic towards Computer Vision, Electronics Hardware.
Co-Founder of www.printajoy.com
http://sohilpatel.org/

 

 

 

Recommended Posts
Showing 77 comments
  • sharath
    Reply

    each and every restart ip of raspberry is changing

  • Wesley
    Reply

    Hi, I would like to ask how do you configure the microphone? It does not record anything and shows No Translation. And how do you edit the command file? I faces Permission denied problem. By the way, I am using Raspberry Pi 3 model b+ and Logitech Webcam C170. Thank you.

  • Walt Williams
    Reply

    What if your running Debian on your laptop?

  • Veera Ragav
    Reply

    Hi… My pi got connected. The desktop is opened in the vnc viewer. But the desktop is empty(fully grey). Right click works which shows some options like terminal emulator, web browser, restart, exit etc., Why cant i see my desktop wallpaper and the icons on it…??

  • Duarte
    Reply

    Beautiful, it worked for me! Just one thing: do not connect the ethernet cable while the RPI is restaring (otherwise it just keeps on restarting). At least that is what happened to me. Thanks a lot!

    • Tayyab
      Reply

      So i have a question, i have already configured my pi, summing up all the steps above, if i connect my pi to an Ethernet connection and give that ip address to the VNC server software on my laptop, it should display the raspbian screen right? It worked with putty, just wondering if it will work this way. I did this at my university so i am assuming that my laptop was connected to a wifi and the pi to an ethernet cable and by just giving the ip address of the pi to my the VNC software on my laptop should yield an instant access to the raspbian?

  • su
    Reply

    whenever i connect to my respberry pi, the screen is duplicating and cannot do anything. how can i solve that?

  • ammy
    Reply

    great post wanna see more

  • GAURAV TYAGI
    Reply

    Hi Friends,

    I a beginner , starting to use raspberry PI Model B. Connected it to the laptop via HDMI port. Setup Putty, commands worked and everything done. Downloaded VNC. Assigned password for VNC viewer but when I click connect it opens it an array of hundred’s of windows. Please help.

    • Afif Widiyanto Musthofa
      Reply

      You don’t need the HDMI cables. In fact, it won’t work if you connect those two ports as both are Output ports. We only need the Ethernet connection.

  • Danielle
    Reply

    Seriously amazing :) thank you so much for a clear tutorial that Just Works!

  • EM Farih
    Reply

    Thanks…
    You’re so amazing… :D

  • Onur
    Reply

    Can i use it for orange pi pc too?I think that would work for it too.

  • G.Nishanthan
    Reply

    You are so amazing man.. Worked perfectly….

  • el soonfy
    Reply

    hi . Dude please help me , i want you to buy me the latest Raspberry Pi with all the connectors needed to power up pi. And tell me how much it cost you. Then i pay you via paypal or western union. Byd way u wil send it to my country.. You have my email. Just tel me if you can do it..pls i wil be waiting. THANKX

  • bob
    Reply

    Well, My laptop doesn’t have an ethernet port.
    What would I do?

    • bob
      Reply

      never mind, My laptop does have one

      • Leo Edwards
        Reply

        It took you a whole day to figure that out? More coffee my man

  • Ratnakar
    Reply

    Hi, Need help for setting up Raspberry Pi Model B without HDMI port on laptop. I could do step 2 but in step 3 I am not able to connect to board through Putty. Can somebody help me in this.I seeing the below result for command prompt on laptop :
    C:\Users\User>ping 192.168.137.1

    Pinging 192.168.137.1 with 32 bytes of data:
    Reply from 192.168.137.1: bytes=32 time<1ms TTL=128
    Reply from 192.168.137.1: bytes=32 time<1ms TTL=128
    Reply from 192.168.137.1: bytes=32 time<1ms TTL=128
    Reply from 192.168.137.1: bytes=32 timearp -a

    Interface: 192.168.1.103 — 0xb
    Internet Address Physical Address Type
    192.168.1.1 94-fb-b2-b8-db-d0 dynamic
    192.168.1.255 ff-ff-ff-ff-ff-ff static
    224.0.0.22 01-00-5e-00-00-16 static
    224.0.0.252 01-00-5e-00-00-fc static
    239.255.255.250 01-00-5e-7f-ff-fa static
    255.255.255.255 ff-ff-ff-ff-ff-ff static

    Interface: 192.168.137.1 — 0xc
    Internet Address Physical Address Type
    192.168.137.92 b8-27-eb-e7-d8-87 dynamic
    192.168.137.255 ff-ff-ff-ff-ff-ff static
    224.0.0.22 01-00-5e-00-00-16 static
    224.0.0.252 01-00-5e-00-00-fc static
    239.255.255.250 01-00-5e-7f-ff-fa static
    255.255.255.255 ff-ff-ff-ff-ff-ff static

    • Afif Widiyanto Musthofa
      Reply

      Your Raspberry Pi’s address is 192.168.137.92

  • chirag patel
    Reply

    Hello Brother,
    i want to interface ATian 3.5 Inch TFT LCD Monitor. i want some steps required for it.

  • Bhavana
    Reply

    Hello,
    After going to the network and sharing centre –> properties –> sharing i’m not getting that drop down list for networking connection to change it to local area connection. Please help.

  • Mahesh Prasath
    Reply

    My raspberry pi IP 169.254.249.206 got it through (ifconfig) when I try connecting I get error “host computer refused connection”

  • Zainab Husain
    Reply

    I’m trying to set up my Raspberry Pi A+ for the first time using this method.
    However, the A+ model doesn’t come with an Ethernet port so I’m using a USB to ethernet port to connect the Pi to the laptop. However, the ethernet dongle doesn’t light up like it usually does on making a connection.
    So when I ping, I don’t get any replies.
    Can anyone suggest anything?

    PS. I’m working without a HDMI cable/monitor.

  • Vinay
    Reply

    Everything just worked fine but I’am not getting Rpi background instead blank grey screen, where if you right I get pop up menu with terminal, browser options. Is there any method to bring that proper gui?

  • Karthick
    Reply

    hi bro…I need to display contents on display connected to Raspberry Pi..(like laptop)..the contents are coming from a link…

    Like home automation Project…In that only ON/OFF commands only there…But in my idea,Any contents entered in HTML page..Need to be displayed in DISPlay..So please Guide me..How to Do it..

    Thanks in Advance..

  • Oshan Fernando
    Reply

    Great job..! It is working. Thank you.

  • Kaustubh Agarwal
    Reply

    Whenever i try to connect my pi to putty, it says connection refused. Can you tell me how to solve this problem? I am using pi 2

    • J
      Reply

      This method worked really well until the IP address assigned to my laptop was no longer visible and it chose automatically choose IP address. Any ideas how to get round that?

      • Abrar
        Reply

        When i’m sharing my internet over LAN, It gives me error..
        “An error occured while Internet connection was being enables. (null)”

        What to do ? Please help.

    • dalky
      Reply

      I’m a bit late, but SSH is disabled by default in many raspberry pi distros. Unfortunately, this means you actually will need a monitor/keyboard to set up the pi with, which kind of defeats the purpose of that section of this tutorial (there’s no actual way to setup completely “headless”, ie, using only a laptop and no peripherals). You can find more information here:
      https://www.raspberrypi.org/forums/viewtopic.php?t=5167&f=5

  • gautam
    Reply

    in the getting the IP address of pi portion how do i stop the ping after 5 seconds.can anybody please elaborate on that part of the essay.

  • franko
    Reply

    I’m using the default buildroot configuration for the raspberry … I have used an ethernet cable and AngryIpScanner but couldn’t find the pi adress …. I don’t know now how to set up the adress for the pi
    please help

    • Joe
      Reply

      To do this I plugged my pi into my hun via Ethernet and turned it on.. Then I did a network scan and it came up with it? It didn’t change when I plugged into my laptop so that might work? Or plug it into the hub then SSH it and follow some Internet instructions so it is a static ip? Then it won’t change!

  • saurabh
    Reply

    mu web browser is not working at all what to do

  • hariprasad
    Reply

    HI ,

    Its working, but I tried to configure for “autostart”, made the directory and all but once I enter the command “gnome tightvnc.desktop” its showed “Bash: Command not found”
    How can I able to make autostart of VNC server while connecting Rasbi?

  • Abhaya
    Reply

    As i am learning Raspberry Pi, i found that we need to enable SSH in the advanced setting in raspberry pi before. I didnt found nowhere in this tutorial that SSH is enabled; as by default it is disabled in raspberry pi setting. If it isn’t enabled, can we setup the connection between putty and raspberry pi. Please make this edit, otherwise cool tutorial(Might be i am wrong). Grt job, thx Arvind.

  • Rahul
    Reply

    Hi, there i tried the all above steps as specefied in the above, i was successful complete up to step3(server side), but at the client (my laptop) when i try to connect through the vnc it is giving an error as “server refused the connection”.
    Pleas some one help…
    Thank you.

  • Raj
    Reply

    Hi,

    Great summary. It works fine for me. One more question. How can i get Audio thru the VNC connection?

  • benjotitus
    Reply

    could i use xming

  • benjotitus
    Reply

    unable to connect
    showing network error in putty

  • Jose Cueva
    Reply

    Hi
    Your method works fine for me,
    I was using Xming a time ago, it was getting slower and with screen resolution problems, i did not get a solution for this.
    Using VNC seems a good and better alternative,
    Actually i am using a wifi module with my raspberry.

    Thank you

  • Rio Cruz
    Reply

    Hi! I got the rpi 2 and installed ubuntu mate. I was able to view my pi using this tutorial, however I recently found out that each time i connect my rpi2 to my laptop ethernet the IP address changes. how will I know the pi’s IP address so I can connect via putty? Is there any way I can set-up a static ip address? It would be nice to share both internet and display to the rpi2. please help.

  • Sultan
    Reply

    PUTTY shows network error: connection refused

  • Sultan
    Reply

    In step 2 in Wireless network properties window there is no such field as sharing only for LAN.
    How can i fix it?

  • priyank
    Reply

    Thank you dear.it helps a lot.

  • A
    Reply

    No HDMI cable any way to set it up for the first time?

  • Abhiram
    Reply

    I have a Raspberry Pi Model B that I’m trying to connect with my Windows 7 laptop using the above steps.
    I made it to Step 3 and was able to connect to the Pi through Putty.
    After logging in, I tried to install tightvncserver using the following commands-
    sudo apt-get update
    sudo apt-get install tightvncserver

    However, I got error messages for both commands. Screenshot of error messages – https://drive.google.com/file/d/0B-J9rdwFEFl_WHkyMndhNElaNkU/view?usp=sharing

    • Prem
      Reply

      Hi, the error means your Pi is not getting internet connection. It is getting failed to ping the server of Raspberry Pi. Check the internet connection. How you have connected the Pi to internet?

  • A.S
    Reply

    Hi
    I have a raspberry pi model B,and i installed rasbian using NOOBS , hooked it to my TV and it showed the rasberry pi desktop successfully. But when i hook it to my laptop it wont show anything,are there any setting i should do? or any support software i should download?
    Please help!!!!
    Thnakyou.

  • sami
    Reply

    Hi,

    Will you be able to use the laptop normally when you unplug the raspberry or after you have plunged it in you can only use it for the raspberry???????

    • Arvind Sanjeev
      Reply

      Yes, you can use the raspberry pi and the laptop simultaneously. On the laptop, there will be a window through which we access the raspberry pi.

  • Shivam
    Reply

    Thanks a lot Sohil! Seamless tutorial and worked on the first try.

  • keerthana p
    Reply

    can i use a idea net setter as an Ethernet cable?

  • Woodland
    Reply

    Well written blog, Nice layout and interesting to read. Good luck.

    My question:
    Your blog says “Keyboard and mouse” are optional, and step 1 says “connect the Keyboard and Mouse”.

    How do I go about – “without” using keyboard and a mouse to begin with. I am a beginner.

    • Arvind Sanjeev
      Reply

      Initial setup would require using the keyboard and mouse.

  • gouri
    Reply

    how can i share my laps wifi to pi with putty and xming …. i used this to connect to my pi and lap…bt not able to share internet

    • Arvind Sanjeev
      Reply

      Hi Gouri,
      If your lap has wifi, then this method would definitely share internet with the pi too.

  • OBH
    Reply

    I could not find the raspberry pi IP address, I had to found out from the raspberry using the display by typing : hostname -I on the LX Terminal.

  • lethaian
    Reply

    I have stuck in the step 4 but finally i got a solution. You just have simply type “ifconfig” in raspberry to see its IP and then type it to the VNC. It should work ! (sorry for my bad English)

  • rashi
    Reply

    Open command prompt.
    Ping on broadcast address of your IP. (Type) Eg: ping 192.168.137.255

    when i ping 192.168.137.1, it works fine; but any other address such as 192.168.137.255 do not work and say “request timed out”.

  • deependra
    Reply

    How to change network connection to LAN .Tried lot of YouTube. Tutorials but still have a
    problem

  • Tushar Thakur
    Reply

    Why don’t you use simple Remote Desktop client? Windows inbuilt and also having Android app. Very handy. No need of that VNC client.

    • Jeff
      Reply

      Agreed.
      simple to install and much easier to use:
      sudo apt-get install xrdp

      • Robert Schley
        Reply

        Awesome. Thanks! I was able to set this up using the xrdp. It looks like the xrdp uses the tightvnc libraries anyway but is simpler.
        To add to this, I was able to not have to find the the ip address by just putting the name of the device ‘raspberrypi’ into the rdp connection detail window from my windows laptop.
        Even if you do need to find the IP, I recommend “angry IP scanner”.
        thanks again.

        • Arvind Sanjeev
          Reply

          Thanks for the cool feedback Robert :)

          • Abhijeet
            Reply

            Thanks Robert.I was going through the blog, things were not working for me, I came across this comment so I downloaded ‘Angry IP Scanner’ connected r-pi to my lapi found its IP and directly copied it to ‘Putty.exe’ and it worked!! No vcu or any initialization required as mentioned. Thanks People!!!

  • Anand Krishnan
    Reply

    When i tried to connect internet via ethernet cable to Pi.The browser showed couldn’t locate host.The orange and green indication is on in LAN port of pi.When i tried same connection in Laptop it worked fine.But host error is showing in Pi.What is the problem ?

pingbacks / trackbacks

Leave a Comment

+ 79 = 83

Start typing and press Enter to search