In this how-to series, we show a “headless” Pi setup using the Raspbian OS.
For some projects, use of a dedicated keyboard, mouse and monitor is either unnecessary or impractical. Fortunately, it is not difficult to operate the Pi from a Windows computer.
Steps to connect Windows computer to Raspberry Pi
1. Connect your Pi to your local network via Ethernet. This can be changed to WiFi later if desired.
2. Decide and prepare one of the following ways to us to determine the IP address of the Pi once booted.
- If you know how and can sign into your router, you can display the network IP addresses. Find and note the IP for the Raspberry Pi.
- Initially connect Pi to a keyboard, mouse and monitor and boot to Raspbian. From within command line interface (LXTerminal if booting to GUI desktop), enter the command: hostname -I to display IP.
- To determine IP without monitor, etc., boot Pi. Then use an IP scanner program like the free Advanced IP Scanner from your Windows computer to scan network for the Pi.
3. Boot Pi to Raspbian operating system.
4. Use your chosen method from step 2 to determine IP. Note, the assigned IP may change upon each reboot requiring step 2 to be repeated. A better way is to assign a “static” IP that won’t change – see our how to Configure a Static IP.
5. Use an SSH terminal like PuTTY to connect and sign into the Pi.
- Download PuTTY (putty.exe), place in folder of your choice (there is no installation). To run PuTTY, just double click it.
- Launch PuTTY and enter the Pi’s IP address in the Host Name field. Set the Connection Type to SSH (the default).
- Click Open.
- You may get a PuTTY Security alert, which happens on first connection or if IP address changes on subsequent log ins. If the Pi IP address is correct, there is no security risk. Click Yes to continue.
- A successful connection will open an SSH terminal session to the Pi and display “login as:”.
- Enter Raspbian’s user name and press Enter – unless previously changed, the default is “pi”.
- Enter the password at “password:” prompt. Default is “raspberry”.
6. A successful login will leave you at the command line interface where you have access to the Pi operating system. To close the SSH session, type “exit”.
If all you need is the command line interface, then you are done! You now have access to your Raspberry Pi in a headless mode.
However, if you wish to run the Raspbian GUI desktop screen, then the following additional steps are necessary.
Raspbian GUI Desktop
There are a number of different ways to get a GUI desktop including using X11 forwarding and an application like Ximg. However, one of the easier ways is to use VNC server and viewer applications. We will use TightVNC.
1. Connect and sign into your Raspberry Pi and ensure your Pi has access to the internet for this step.
2. Type sudo apt-get install tightvncserver . Answer y when prompted to continue. This will install the TightVNC server on the Raspberry Pi.
3. From the Windows computer, download the TightVNC for Windows . Double click the downloaded tightvnc- – – – -.msi file to install. Click Next, accept license and Next again. On the Setup Type page, click “Custom”. We do not need the TightVNC server on the Windows computer, only the TightVNC Viewer. Click the drop down next to the TightVNC server. Click the “X Entire feature will be unavailable”. Then finish the installation.
4. From the Raspberry Pi command line, type vncserver :1 and press Enter. The :1 parameter tells vncserver which display number to use – in this case, 1.
5. The initial launch will prompt you to enter a password “to access your desktops”. Enter any password with six to eight characters/numbers in length. When prompted to enter a “view only password”. You can respond with n.
5. Launch the TightVNC viewer on the Windows computer. Enter the Pi’s IP address in the Remote Host field followed with :1. The :1 represents the desktop number. For example: 192.168.0.15:1 . Click connect. Enter the password from step 5.
6. You should now see the Raspbian GUI desktop and can remotely control your Pi!
7. To end the session, type vncserver -kill :1 from the Raspberry Pi command line screen.
- VNCServer has a number of parameters which can be seen by typing vncserver /? . One particularly useful option is -geometry where you can set the GUI screen size, as in vncserver :1 -geometry 1280×800 .
- Some applications, like MineCraft Pi write graphics directly to local screen memory and will not show in the TNCViewer screen.