Windows PC and Raspberry Pi Direct Connection

There are two computers on my desk that are connected to the same wireless network – a Windows laptop and a Raspberry Pi connected to a large LED display. It’s nice to have all these things on one desk but switching computers is not fun. So I set out to find a way to eliminate the problem by being able to connect to the Raspberry Pi through Windows.

One way to go about this is X11 forwarding through SSH. I can run my Python programs just fine and see their GUI but display refresh rate is awful; not to mention making X11 forwarding work is not exactly a walk in the park.

Then I tried VNC. Huge improvement over X11 forwarding but refresh rate on my VNC window is laggy sometimes, probably due to the wireless connection. So I decided to connect the Pi directly to Windows using an Ethernet cable to get better, less laggy connection. The outcome is just what I was looking for. There are tutorials detailing the process – some complicated, some are not – and they mention steps that are not really necessary. The gist of the whole thing is to give the Pi an IP address and make it remember that on every reboot.

Here it is –

  1. Plug one end of the cable to the Ethernet port on the PC, the other end to the Raspberry Pi, then switch both computers on
  2. Wait a few seconds while PC and Raspberry Pi get to know each other
  3. Then figure out the Pi’s IP address. Hover over the networking icon on the taskbar (thing beside speaker icon) and a bubble will appear. If you see “eth0: Configured xxx.xxx.xxx.xxx/xx” then the direct connection is working OK. If not then unplug the cable and repeat steps 1 and 2. Make a note of the IP address because you will need it in the next steps. [Note: the Pi will list all available connections – wired and wireless – so if you see “wlan0: Configured xxx.xxx.xxx.xxx/xx” it means the Pi is connected to a wireless network]
  4. Make the Pi remember its IP address so you don’t have to figure it out everytime you want to connect
    • Open a terminal window and edit a file:
      • sudo nano /etc/network/interfaces
    • Find the line that’s relevant to eth0. It will look something like this:
      • iface eth0 inet manual
    • Change it to:
      • iface eth0 inet static
      • address [insert IP address found in step #3]
      • netmask 255.255.255.0
  5. Save your edit and exit nano – press Ctrl+O, then Enter, and Ctrl+X
  6. Enter sudo reboot to restart the Pi
  7. On Windows, download and install TightVNC – http://www.tightvnc.com/download.php
  8. Open TightVNC and connect to the Pi. In the “Remote Host” text box type the Pi’s IP address, then a colon and a port number, like so
    • 169.254.251.189:5901
  9. Click “Connect” and you will be prompted to input a password. If you have not changed the default password, type in “raspberry”; otherwise, use the new password
  10. Hit Enter or click “OK”

For a headless Pi setup, you can disconnect all connected peripherals except the Ethernet cable and use the display as your PC’s main/external display – because you will certainly appreciate the benefits of having more screen real estate.

Enjoy! :-)

 

Advertisements