Despite having four full sized USB ports and one micro USB port (for power), you can’t connect to your Raspberry Pi from your computer via USB (without additional hardware).
You can however connect to your Raspberry Pi via a “USB to TTL Serial Cable”, also sometimes called a Console Cable. This cable allows you to access the command line of your Raspberry Pi, by plugging the USB end into your computer and the other end into specific serial GPIOs on the Raspberry Pi.
For the most current information on Connecting with the Console look here. http://elinux.org/RPi_Serial_Connection
Note for RaspberryPi 3: Add the following two lines in config.txt file on your RPi SD Card: dtoverlay=pi3-disable-bt enable_uart=1
What you’ll need
For this exercise you’ll need a console cable:
Caveat: Make sure your computer delivers at least 500 mA (milliamps) at 5 V (Volts). This will assure you that your RPi will receive the power it needs otherwise there’s a chance you’ll fry your Pi!
Software Installation (Mac)
Mac OS X includes a Terminal (inside /Applications/Utilities/), so the only other software you need to install is the drivers for the cable.
You can download the Mac drivers here.
Software Installation (Windows)
Windows does not include a Terminal application that you can use to connect over serial.
For this workshop we’ll use Putty. You can get the “putty.exe” app from the puttywebsite.
Download the one called “PuTTY” under For Windows on Intel x86 (direct link).
Putty downloads as an uncompressed binary.
Now that you’ve got Putty, you’ll also need to install the cable drivers here.
Software Installation (Linux)
Assuming you’re running a v2.6 kernel or later you shouldn’t need to install drivers for the cable. If you find that your distribution doesn’t have the drivers installed you can download the drivers from the FTDI website.
You may also need to install screen. The
screen command (some Linux distributions such as Ubuntu 12.10 don’t include the screen software). To see if you’ve got screen installed type
screen and if you get an error install screen by running:
sudo apt-get install screen.
Connecting the cable
The console cable handily provides the name of the line on the side of the terminal header.
Connect the console cable to the following pins:
- DC → RPi Pin 02 (DC Power 5V)
- GND → RPi Pin 06 (Ground)
- RXD → RPi Pin 08 (Data Transmit)
- TXD → RPi Pin 10 (Data Receive)
Connecting via the Shell
Bringing up the Shell On Mac / Linux
If you’re running Mac OS X all you need to do is open a Terminal window and run screen in the command line using the command:
screen -L /dev/tty.usbserial 115200
screen is the command.
/dev/cu.usbserial is the path to your serial device and
115200 is the baud rate (the speed at which we send data across the serial interface).
If you’re on Linux you’ll need to escalate your privileges by putting
sudo in front of the command.
sudo screen /dev/cu.usbserial 115200
Bringing up the Shell on Windows
If you’re running Windows, you’ll need to find out what com port the console cable is using.
- Search for Device Manager
- Expand the Ports (COM & LPT) section
You now need to open putty
- Select Serial as the connection type
- Enter the name of the COM port you’ve found
- Set the speed to 115200
- Click Open and you should see the terminal
Once you’ve brought up the shell, you’ll be faced with a login prompt. You can log into your Raspberry Pi with the following credentials:
- username: pi
- password: raspberry
Ok we’re in! Let’s have a look around in the next tutorial.