I recently bought a Raspberry Pi, type B model. I want to set it up directly to my laptop screen, without any other monitor. I have not set it up yet. How do I connect my laptop's screen as the Raspberry Pi's display?

I do not want to buy an HDMI cable. Instead I want to try from Ethernet or the USB.

12 Answers 12

up vote 44 down vote accepted

This is only for command-line interface, not for the Graphical UI.

The easiest way would be connecting via SSH with a program called PuTTY (Windows), M-remote (Windows) or using the Terminal application in OS X or any Linux (no installation, already available).

  • Terminal: enter the command ssh pi@raspberrypi
  • Putty: select protocol SSH and enter hostname raspberrypi
  • M-Remote: select SSH (2), hostname raspberrypi, username pi, password raspberry

Now connect.

If this FAILS, try finding out what IP address is assigned to the Raspberry Pi. (For example, by using your browser to take a look at your modems website (if you don't know where, you could try
http://192.168.0.1/ or http://192.168.1.1/ or http://192.168.0.254/ or http://192.168.1.254/ or http://192.168.0.138/ or http://10.0.0.1/ or http://10.0.0.138/ or http://10.0.0.254/ or http://10.0.1.1/ or http://10.0.1.254/)

Look up the device named something like raspberrypi and copy the IP address. Paste it into the command you tried from above where it now states raspberrypi and you're good to go!

Now (or after you've entered the password raspberry) you're connected to the command line interface of the Raspberry Pi, and you can do (almost) anything you could when you would be connected with a monitor, mouse and keyboard and NOT booted into the graphical user interface.

There is a blog post, Raspberry Pi Remote Connections – Without A Network!, detailing what you are looking for.

Basically, this involves assigning a static IP address to both the laptop and the Raspberry Pi, then setting up X-server to stream the screen from the Raspberry Pi to your laptop. As this is an extensive walkthrough, please reference the link for detailed instructions.

Another option to explore would be using VNC or a similar remote desktop type application.

  • 1
    Please extend your post to create an answer; an answer should provide more than one linke with links. Perhaps you could copy some steps that are being done in the guide, i.e. to show that it differs from the solution I pointed out. – M. Mimpen Mar 20 '14 at 11:44
  • This is a very long, detailed process and posting the details here or paraphrasing would not suffice. Two links were provided, the first having both a novice and advanced user walkthrough linked from the post. The second link is the more detailed walkthrough. No sense duplicating effort when someone else has written a very thorough walkthrough. – Mike Naylor Mar 20 '14 at 11:50
  • 1
    I don't fully agree. StackExchange answers should be able to stand on itself, but your edit is already lots better. By the way, your novice walkthrough is the same as the more detailed walkthrough... You can remove your second link. – M. Mimpen Mar 20 '14 at 12:00

We (@RPi Awesomeness and @Dam Underscore) resolved this in the chat. None of the tutorials or answers he was trying were working, so we tried to figure it out and we did.

Turns out the OP was using NOOBS and thus couldn't find the cmdline.txt file required for the tutorial he was following. So, I told him to download Raspbian & go with that.

Whether or not that allowed him to set it up headless or not, I don't know yet, but this has him ready to keep going w. the tutorial.

Using a Macbook Pro (any modern laptop/desktop will do), a Pi, and a clean, unbooted SD card with Raspbian on it, here's what I did:

On first boot, the Pi will actually start an SSH server available on the ethernet port. But, it's pretty much inaccessible if the Pi does not have an IP address. By default, it does not. It will activate a DHCP client to contact a router for an IP. Plugging the ethernet from the Pi into the computer will cause the Pi to ask for an IP. By default, consumer computers do not respond to this query. The first step is to activate a DHCP server on the computer. For my setup, I used dnsmasq installed in a Debian virtual machine that I had created for another project. The VM is not required, as dnsmasq will run just fine on a Mac (installable from MacPorts or source) or Linux computer natively. I believe there are some DHCP servers that run on Windows, but I am not sure. You could also plug the Pi into a wireless router with the same effect, except you wouldn't have to set up an DHCP server because almost all consumer wireless routers have this built in (you can probably skip the next paragraph if you are using a router).

Once the DHCP server is running, connect the Pi to the computer's ethernet and power it up. In the log file/console output, you should see something like this:

dnsmasq-dhcp[2358]: DHCPREQUEST(eth2) 10.79.26.137 ac:87:xx:xx:xx:xx
dnsmasq-dhcp[2358]: DHCPACK(eth2) 10.79.26.137 ac:87:xx:xx:xx:xx Maxwell
dnsmasq-dhcp[2358]: DHCPDISCOVER(eth2) b8:27:xx:xx:xx:xx 
dnsmasq-dhcp[2358]: DHCPOFFER(eth2) 10.79.26.148 b8:27:xx:xx:xx:xx 
dnsmasq-dhcp[2358]: DHCPREQUEST(eth2) 10.79.26.148 b8:27:xx:xx:xx:xx 
dnsmasq-dhcp[2358]: DHCPACK(eth2) 10.79.26.148 b8:27:xx:xx:xx:xx raspberrypi 

Explanation and what we're looking for here: The first two lines are my laptop (Maxwell) connecting to the DHCP server. Since the laptop recognizes the DHCP server, it requests an IP that it has had in the past: 10.37.27.137. This can be confirmed by looking at the network settings of your computer (for me, it showed up in System Preferences / Network in OS X). The DHCP server then gives my computer it's requested IP since it's not a conflict (DHCPACK, dhcp-ack[nowledgement]). The next three four are related to the Pi: It first sends a DHCPDISCOVER to find any DHCP servers (if any). Dnsmasq then offers it a new IP. The Pi accepts it (DHCPREQUEST), and then the server confirms the IP in its database and actually gives the IP to the Pi. I know I've found the right entry because the final hostname listed in the DHCPACK is "raspberrypi". Make a note of the IP address that the DHCP server gave the Pi (mine is 10.79.26.148).

If you connected the Pi to a router instead of a computer, look in the router's web interface for a list of DHCP clients, or a list of computers connected to the network. Most routers have this somewhere, even if they don't all call it the same thing. Look for a computer named "raspberrypi", and make a note of its IP address.

Once you have an IP for the Pi, you can connect to it with the SSH client of your choice. For Mac/Linux/UNIX, you can just open a terminal and type ssh pi@IP_ADDRESS where IP_ADDRESS is the IP of your Pi that you found earlier. Windows users can use Cygwin, MobaXterm, or PuTTY. If you got the IP right, you should see something like this:

$ ssh pi@raspberrypi
The authenticity of host 'raspberrypi (10.79.26.148)' can't be established.
ECDSA key fingerprint is 6c:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi,10.79.26.148' (ECDSA) to the list of known hosts.
pi@raspberrypi's password:

Since I had not connected to the Pi before, I had to accept the ECDSA key to continue. The default password, as stated in earlier answers here and in the official documentation, is raspberry. Now, we are logged in to Raspbian over SSH, and can do things. You should see this now on the SSH console:

Linux raspberrypi 3.18.5+ #744 PREEMPT Fri Jan 30 18:19:07 GMT 2015 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'

pi@raspberrypi ~ $ 

Now, as per the MOTD prompt, you need to run sudo raspi-config which brings you to the same configuration window you would see if you had booted it up with HDMI. Among other things here, you should enable the SSH server. After configuring it, you can use this same setup to reconnect to the Pi over ssh again after the reboot.

Sources: my own experience.

  • 1
    PI no longer is running SSH in default install. – bigjosh Apr 1 '17 at 22:19
  • Hmmmmm... I'll have to check that out – computergeek125 Apr 3 '17 at 8:28
  • 3
    You can enable SSH on boot by creating a file called "ssh" (no extention, contents don't matter) in the the root directory on the FAT partition of the SD card. You can do this on another computer and then put the card into the headless PI. raspberrypi.org/blog/a-security-update-for-raspbian-pixel – bigjosh Apr 3 '17 at 12:14

Hardware. This is not gonna work via hardware alone. Your laptop motherboard is hard-wired to output video to the laptop-screen. Most - if not all - laptops do not have a video-in.

//EDIT// Checking the related questions section, showed that it could be done using only hardware: Connect Pi to an old laptop screen

LAN + Software.

  • Copy an operating system to the SD card, e.g. Raspbian.
  • Insert an ethernet cable to give it access to the LAN network.
  • Power up the device, the OS will do the install, possibly downloading updates via LAN.
  • Use X forwarding with a client such as MobaXterm (solution source)
    • Default SSH username: pi
    • Default SSH password: raspberry
  • 3
    I think his question is not how to directly connect the pi to his laptop screen, but rather how to set up a headless pi which he can access (and view its screen) from his laptop. – Stephan Muller Mar 20 '14 at 18:53
  • 1
    I wasn't sure thus I gave both solutions. – M. Mimpen Mar 20 '14 at 20:12

Updated answer

Since this answer is old and you need to install PHP first here is an out-of-the-box solution for macOS and *nix System (and Ubuntu Subsystems on Win10)

sudo nmap -sS -p 22 192.168.100.0/24

After this scan nmap shows every hosts with an open SSH port and also the network chip manufacturer.

Note that for headless setup you need to enable ssh (3. section)


Original answer

I had this problem also. I knew the raspberry got an IP from the local DHCP service. But in my network I could not reach the pi by the hostname.. so I just scanned my network for all clients that have an open SSH port (Port 22)

(PHP Script)

<?php
$ip = '192.168.100.';

for ($i=0; $i < 256; $i++) { 
    $sock = @fsockopen( $ip . $i, 22, $errnr, $errstr, .5);
    if ($sock !== false) {
        echo ">> " . $ip.$i. PHP_EOL;
    }
}

$ php scan.php

So I tried to login with SSH pi@{found ip address} on each found IP address and the 3rd one was it.

Note that this little script is only really usefull in class C-networks :)

Now I just gave my pi a static ip.


Thats the story when you forget to take a HDMI adapter from home to office ;)

Edit:

I just noticed that the question how to connect a laptop screen ... so my answer is only relevant for ssh usage or any other headless setup.

  • Hello, Gabriel. [...] On another note, I've never considered PHP for socket work... Kudos for that. Edit: I reread the OP's question and have redacted the first part of my comment... sorry for the mistake. – Jacobm001 Feb 20 '15 at 23:14
  • Ou. what a fail. But I leave this post here - it's useful for google searches. – CodeBrauer Feb 25 '15 at 10:40
  • Not the best answer, but a damn creative one, so thumbs up anyway. – Shayne Nov 26 '16 at 7:57

It can certainly be done. I mainly use my Pi remotely, using ssh to access the console and VNC to access the GUI. VNC requires the installation of extra software on the Pi (and compatible software on the laptop).

Initial remote setup is possible, provided you know what you are doing, but I would strongly suggest you use a direct keyboard (USB) and monitor for initial setup. HDMI is easier, but you can use the RCA connection to a TV/Monitor. You need to tell us what OS the laptop is using, and how you are networked to the Pi.

  • 2
    Good call about using the RCA connection to a TV since this is often forgotten. – M. Mimpen Mar 20 '14 at 12:01
  • He is was using NOOBS, which is part of why he wasn't able to complete the tutorials he was following. However, we figured that out in chat and he is now attempting it with Raspbian, sans-NOOBS. – RPi Awesomeness Mar 21 '14 at 13:41

There is a great tutorial here which explains how to

  • Find the Raspberry Pi IP address without connecting it to any monitor (by scanning your home network)
  • Connect to the Raspberry Pi using SSH
  • Display the full LXDE desktop through the use of X11 protocol (this is very cool in order to display the full Pi graphical interface)

The only drawback is that this only works from a Windows computer, I have not found any alternative to MobaXterm for Mac OSX.

My personal choice is to use a USB->UART connector. When a virgin Raspbian image is installed, there is an instance of "getty" running against the default serial of the Pi. This means that if we attach a serial terminal to the RX/TX of the Pi UART, we can get a login prompt. Using a USB->UART, I plugin the USB end into my PC and then connect the PC RX to the PI TX and the PC TX to the PI RX and then add a common ground. Now if I run a serial terminal emulator such as Putty, I can login to the Pi. From there, if I need, I can setup any and all network options I may need to get further bootstrapped.

  • This is the "correct" solution IMO. It should work in virtually all the situations where the Pi is imaged for PC-like use. – Nathan Goings May 5 '16 at 2:45
  • As of 2016-05-04 ... there appears to be a "bug" with the Pi 3 and the latest version of Raspbian (as of that date) such that on Pi 3's, the UART speed is interfered with by WiFi operation. – Kolban May 5 '16 at 4:24

So the easiers way would be to...

  • download realvnc and install it
  • ssh to your raspberry pi and run 'startx' command to start the GUI
  • use realvnc to vnc with the default credentials 'username=pi' 'password=raspberry' and you should see the display of the raspberry pi inside a window on your laptop.

best way to install without using monitor is to :

  1. first burn image of rasbian in sd card.
  2. then in sd card, there is commandline.txt file.
  3. open it in notepad++ and add this line at end.
    ip=<ip of rasberry pi>::<ip of lan card,get it by ip config>

after this put memory card in Raspberry Pi and run putty by entering ip. Put default username "pi" and password "raspberry".

VNC step-by-step on Raspberry Pi 2 Raspbian Jessie 2016-05-27, Ubuntu 16.04 host

VNC is a server / client protocol that allows a client to access the desktop of the server.

  1. Find IP of your pi: Prepare for ssh without a screen I recommend either:

  2. SSH into the PI and run:

    sudo apt-get install x11vnc
    sudo x11vnc -xkb -noxrecord -forever -noxfixes -noxdamage \
        -display :0 -auth /var/run/lightdm/root/:0 -nopw
    

    WARNING: we are not setting a password for simplicity, but that is not safe. See: https://askubuntu.com/a/757398/52975 for that.

  3. In host:

    sudo apt-get install vinagre
    vinagre $RPI_IP
    

    Ubuntu also comes with the remmina VNC client by default, but vinagre was easier to setup

Outcome: you get a window in your desktop like:

here showing a yet buggy glxgears running (almost fixed on RPI 3 it seems: https://www.youtube.com/watch?v=WMfgXOHWAnc&feature=youtu.be&t=118 ).

You can then click on it directly with your mouse, and the state of the RPI board updates as well. If you had a display for the PI, both displays would synchronize.

protected by goldilocks Aug 13 '16 at 15:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.