Overview

In this lesson you will learn how to remote control your Raspberry Pi with a console cable.

The great advantage of connecting this way is that it can even supply the power for your Pi and you do not need keyboard, mouse or display attached to the Pi to log into it.

You will need to install terminal emulation software (Putty) if you are using Windows and also USB drivers for the Console Lead. The Mac Terminal comes with its own software.

The Raspberry Pi uses its built-in serial port to allow devices to connect to its console and issue commands just as if you were logged in.

In the next lesson, we will look at another way of doing much the same thing but over a local network using something called SSH.

You Will Need

To follow this lesson, you will need:

Raspberry Pi computer (any!) with headers

USB console cable. We have one that is known to work with Windows 8+ but some older/cheaper console cables do not.

Enabling Serial Console

As of Jessie Raspbian, you may need to enable the serial console.

You can enable/disable the serial console with either editing /boot/config.txt or raspi-config (which will edit /boot/config.txt for you)

Option 1. Enabling in /boot/config.txt

You can pop your SD card into a computer and edit config.txt with a text editor like SimpleText, WordPad or whatnot. You can also edit on a pi with sudo nano /boot/config.txt

At the bottom, last line, add enable_uart=1 on it's own line

Option 2. Enabling via Raspi-Config

Using a monitor and keyboard, log into the shell and run

sudo raspi-config

go down to Advanced Options

Hit enter and then go down to Serial

Select Yes

It should now be enabled

Hit return then select Finish

When it asks you to reboot, go to Yes and hit return

OK the serial console is now enabled!

Software Installation (Mac)

OSX includes terminal emulation software that you can use from the command line, so we only need to install the USB drivers for the cable.

(If using Lion or Mountain Lion or later OS X, you can also try this driver here http://changux.co/osx-installer-to-pl2303-serial-usb-on-osx-lio but try the official one first!)

Both downloads are standard Mac installers. Accept all defaults when prompted.

Software Installation (Windows)

Download and install Putty from here: http://www.putty.org/

From the list of downloads select the binary called just putty.exe from the section For Windows on Intel x86. This will prompt you to save the file. Save it onto the Desktop for now.

Note that this actually saves the Program itself not an installer. Simply double click putty.exe to run putty!

Next, install the latest drivers for the cable chipset:

This will save a zip file called PL2303_Prolific_DriverInstaller_v1_7_0.zip (or similar). Unzip this onto the desktop and within the folder run the installer called PL2303_Prolific_DriverInstaller_v1.7.0.exe

The driver is installed in such a way that when you later plug in the USB console lead, it will still launch the “Found New Hardware” wizard. If you allow the Wizard to search the Internet and install it should work.

When it has finished installing the driver, you should get this message:

Software Installation (Linux)

Linux Kernels 2.4.31 and above already have the PL2303 USB driver for the Console Lead built-in, so you should not need to install that.

Some distributions such as Ubuntu 12.10 do not include the "screen" command. Try running the command "screen" and if you get an error message, you can install it by typing the following command:
sudo apt-get install screen

Connect the Lead

The Console lead has four female connections that can be plugged directly onto the GPIO header of the Raspberry Pi.

The Adafruit USB console cable has 3.3V logic, so its safe to use with your Pi.

Attach the leads as shown below:

The connections are to the outside pin connections of the GPIO header. See Lesson 4, for more information about the header: http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/the-gpio-connector

  • The red lead should be connected to 5V if you want to power via the cable, see below for details
  • The black lead to GND (3rd pin down)
  • The white lead to TXD on the Pi (4th pin down)
  • The green lead to RXD on the pI (5th pin down)

Powering Via Cable

Here's a photo showing an older Pi and also powering it via USB. Pi 2 or later are not suggested for this technique as they draw over 500mA

The important thing here is to only power it from one source, the USB power adaptor or the Console Lead BUT NOT BOTH. Unless you have a Pi A+ or Pi Zero, don't connect the red wire!

If you do decide to power the Pi from the console cable, DO NOT attach the Pi's USB power adapter. If you would rather power the Pi from your USB power adapter then leave the Red lead from the Serial lead un attached.

OK now power up your Raspberry Pi!

Test & Configure

Mac OS X

If you are using a Mac, then all you need to do is open a Terminal window and issue the command:

screen /dev/cu.PL2303-00001004 115200

The device will have a slightly different name to mine. So, type the line above as far as "cu.PL" then press the TAB key to auto-complete to whatever your device is called, before adding 115200 (which is the baud rate) to the end.

You can also try screen /dev/cu.PL2303* 115200or screen /dev/cu.usbserial 115200 To have the shell complete the file name for you

You may need to disable system integrity protection (according to feedback from a tutorial-reader)

Linux

If you are using Linux then use the command:

sudo screen /dev/ttyUSB0 115200

To start communication with the Pi, press ENTER and you should see the login prompt from the Pi.

Here it is running on a Mac.

and here is what it looks like in Ubuntu.

Windows

If you are using a PC, then before you start Putty, you need to know which com port is being used for the cable. You can find this by looking in the Ports section of the Windows Device Manager.

The Device Manager is accessible from the Control Panel under System.

In this case it is COM7 that is in use.

Now start Putty and you will see a connection window.

Select a connection type of "Serial" from the radio buttons, then set the speed to 115200 and the serial line to COM7

Finally click 'Open' to connect. Remember to press ENTER to start communications.

For a new installation of Raspbian, the default username is pi and the default password is raspberry

Thats it! You are connected and can use the command line to navigate around your Pi.

In the next session we will look at using SSH as another means of connecting to your Pi over your local network.