Google+ Followers

Thursday, May 16, 2013

21. Using the PC as a Remote Raspberry Pi Terminal

If you don't have a dedicated keyboard, mouse and monitor for your Raspberry Pi, you will have to borrow these from the family PC and TV room.  However, this is only temporary, because you can use your PC (desktop or laptop) to display the RasPi desktop and windows, and run all your RasPi programs this way:

My RasPi's desktop looks like this on a small TV:



and the result on my PC's screen looks like this:




There is a noticeable difference in the shape of the image due to the different aspect ratios of the TV and my PC monitor, but don't let this put you off.

The first thing to do is to enable the Pi to undertake SSH (which means Secure Shell - ie what we're trying to do here), and to do this you need to have the Pi connected to the temporary keyboard/mouse and monitor (TV) and of course, the internet.  Open the Terminal on the Pi and find out what the Pi's internet address is.  We did this before in an earlier post.  Type: 

sudo ifconfig

and a lot of information is printed on the screen.  At the section which starts wlan0, look for 
inet addr: 192.168.1.68 and the four numbers separated by dots, are the Pi's (Dynamic) IP address.

Now type the RasPi command:

sudo raspi-config

and you will be faced with a screen like this:



You can navigate about this screen with the Up-, Down-, Left- and Right-arrows.  

Highlight the line beginning with ssh (see the picture above) and hit Enter.  You then have the opportunity to Enable or Disable.  Highlight Enable and hit Enter.  This enables the Pi to participate in the SSH session.

Now, on your (Windows) PC, it is necessary to download a couple of programs - PuTTY (an open source, free, SSH client, and Xming, an X-window client, also free.  The procedure for PCs running operating systems other than Windows, is slightly different.  A good website to download these from is:

http://www.geo.mtu.edu/geoschem/docs/putty_install.html

This is useful as it shows screen shots for setting up the two programs Xming and PuTTY.  Then when these programs have been installed on your PC (ignore warnings), 

  1. run Xming
  2. run PuTTY
  3. Select SSH as the connection type.
  4. Enter in your Pi’s IP address (see above) as the Host Name
  5. The port should be 22 unless you know better
  6. In PuTTY’s option tree, select Connection/SSH/X11
  7. Check the box labelled Enable X11 forwarding
  8. Go back to Session options (in the option tree)
  9. If you would like to save these settings, type a name in the Saved Sessions box and click Save
  10. Click Open
  11. Once you have logged into the Pi using the login details  - "pi" & "raspberry" (unless you have changed these)
  12. Type startlxde (NB no space!!) and you will see the desktop of your Raspberry Pi in the Xming window.

The  Saved Session in 9 above is very useful for repeating these settings at another time.

And Hey Presto! you have your Pi running on your PC monitor with full control!!  Please note that this system is only working on your local network, and not through the internet, so your PC is the only one that will be able to run your Pi.

Any way - you can now give back the keyboard, mouse and TV to their rightful owners!

For more detailed information on this subject, once again Lady Ada has come up with an excellent  tutorial at:

http://learn.adafruit.com/adafruits-raspberry-pi-lesson-6-using-ssh/overview



No comments:

Post a Comment