Raspberry (Banana) Pi to PC using a Serial Connection

USB-to-serial Console Cable
PDF24    Send article as PDF   
Using a Connection via a Serial Port is a low-level way to send data between the Raspberry (Banana) Pi and another computer system. There are two main ways in which it can be used:
  • Connecting to a PC to allow access to the Linux console. This can help to fix problems during boot, or to log in to the Pi if the video and network are not available.
  • serial interface. This can be useful if you want the Pi to control another device.

RPi Serial Connection - 01

The Raspberry Pi serial port consists of two signals (a ‘transmit’ signal, TxD and a ‘receive’ signal RxD) made available on the GPIO header. To connect to another serial device, you connect the ‘transmit’ of one to the ‘receive’ of the other, and vice versa. You will also need to connect the Ground pins of the two devices together.

USB-to-serial Console Cable

If you wish to connect your Pi to a PC with a USB port, the simplest option is to use a USB-to-serial TTL Console Cable which uses 3.3V logic levels (e.g. the Adafruit 954 or a a quick search of eBay for USB to Serial TTL Console Cable reveals a suitable one for around $5). These can be simply plugged in directly to the GPIO header (see illustration).

RPi Serial Connection - 02

When using the Adafruit 954 USB cable on Windows 7 the Prolific driver seems already be installed, so you could skip this step. Simply connect the USB cable. You will see a device Prolific USB-to-Serial Comm Port; verify via Control Panel → System → Device Manager to get the port number. 

Device Manager

You can connect the Pi to a PC using a USB-to-serial TTL Console Cable as per the details below. When this is done, you will need to set up a terminal emulator program on your PC.

USB-to-serial Console Cable Connections

NOTE: The ‘Red’ +5 Volt wire on the USB-to-serial TTL Console Cable can be used to power the Pi provided you don’t have to many current hungry peripherals attached. Importantly DO NOT connect any other power source to the Pi as you will most probably kill your Pi!

Now its time to set up a Secure Shell (SSH). A Secure Shell (SSH) is a Unix/Linux client/server network protocol you can leverage with the Raspberry Pi to support secure command-line remote access. Raspbian includes an SSH server and enables it by default. You can verify the SSH server status by opening Raspi-Config and checking the ssh (Enable or disable ssh server) option.

So the Pi is already set up as an SSH server. Now to establish a remote connection to the headless RPi, you need to use an SSH client. Unfortunately, Microsoft has never included SSH software in their operating systems.

Most people use PuTTY for Windows (http://is.gd/ResYA2), which you can check out in the Figure below. PuTTY is really simple to use; just fire up the tool, pop in the Pi’s IP address or Host Name, in the Host Name field, and click Open.

Putty Configuration

The following parameters are needed to connect to the Pi console, and applies on both Linux and Windows based PCs.

  • Speed (baud rate): 115200
  • Bits: 8
  • Parity: None
  • Stop Bits: 1
  • Flow Control: None
  1. Assuming you are using the default user credentials of pi/raspberry and (in this example) the Pi is located at 192.168.1.11, you can issue the following command from the OS X or Linux terminal: ssh pi@192.168.1.111. The previous command, when translated into conversational English, says that you want to use the SSH protocol to establish a remote connection to the SSH server listening at 192.168.1.11 and that you want to connect using the user account called pi. 
  2. Authenticate by providing the password for your local OS X or Linux account. You’ll then be asked to verify the authenticity of the Pi. Because we know that this is the correct box, you can type yes and then press Enter to add the SSH server’s public key to your system and automatically add the RSA thumbprint of the Pi to your /etc/.ssh/known_hosts configuration file.
  3. Issue any RPi-specific commands (such as sudo raspi-config) to convince yourself that you are in fact remotely connected to your Pi. The entire SSH connection workflow from the perspective of window7 is shown in below. In the figure I highlighted the commands I used.

SSH Session

The chief advantages to SSH-based remote access to the Pi are

  • The client-side setup is quick and easy.
  • You have full Terminal access to your Pi up to any restrictions that might be set on your connecting user account.
  • All data transmitted between your remote workstation and the Pi is encrypted.

On the other hand, SSH remote connections to the Pi have one chief downfall—no GUI access. If you need to display an X Server desktop remotely, you need to turn your attention to setting up VNC.

Previous Post

The Banana Pi: Upgraded Alternative to the Raspberry Pi

As the name implies, the Banana Pi is a clone of the Raspberry Pi. Just like its predecessor it has 2 USB ports, 26 GPIO pins and draws a tiny ... Read more

Next Post

Using a PS2 Dualshock Controller with Raspberry Pi

I have spent the weekend experimenting with my Raspberry Pi's. One challenge I set myself was to get a Sony PS2 Dualshock Controller working with Raspberry Pi. The main reason ... Read more

Short URL: http://tinyurl.com/j5bfuet

Leave a Reply

Your email address will not be published. Required fields are marked *



Do NOT follow this link or you will be banned from the site!
error: Content is protected !!