Running Raspberry Pi with a USB to Serial (TTL) Adapter

Plugging in a monitor and a keyboard can be a little overkill for a device that only costs $35 USD. In my opinion, two of the greatest Raspberry Pi features are that it’s (1) lightweight and (2) easily portable. Needing a separate external display/keyboard negates both of these qualities.

In this post, I’ll detail how to connect to the Raspberry Pi shell through UART using a USB to Serial adapter. As an added bonus, the Raspberry Pi can be powered via USB, which removes the need for an external power supply!

REQUIRED HARDWARE

  1. USB to Serial (TTL) adapter – There are cheaper options available, but I personally used this model from Amazon.
  2. An SD card with an OS fully initialized on it. Do not try to do a clean install with this process – while it may work with some operating systems, I know that NOOBs for Raspberry Pi does not work unless first booted with a keyboard/display.
  3. Any laptop or computer with a spare USB slot – I’ve personally done this on a Mac with USB 3.0.

INSTALLATION STEPS

Install drivers for USB to serial connection

  1. Install the USB to serial drivers specific to the adapter used! For the hardware above, PL2303 drivers can be found on Prolific’s website.
  2. Reboot the computer!

Connect your hardware

  1. Disconnect the normal power supply from Raspberry Pi! This is imperative, since we’ll be supplying power from the USB port instead. If you simultaneously supply power from your computer’s USB port and from the wall, you will fry your Raspberry Pi!
  2. On the adapter’s USB side, connect the 5v, Tx, Rx, and GND jumpers. Leave the USB end unplugged!
  3. usb to TTL

    USB to TTL Connector

  4. On the Raspberry Pi side, connect P02 (5v), P06 (GND), P08 (Tx and/or GPIO 14), and P10 (Rx and/or GPIO 15) jumpers. It’s very important to note that the Tx from the adapter’s USB side goes to the Rx for the Raspberry Pi side, and the Rx from the adapter’s USB side goes to Tx for the Raspberry Pi side (see below).
  5. Raspberry Pi GPIO pins

    Raspberry Pi GPIO Pins

    Raspberry Pi UART hookup

    GPIO Cables

     

    1. Double check all of your connections before you plug in the USB adapter! Make sure your normal Raspberry Pi power cable is NOT connected. You do not want to supply two power lines, or short power to ground!
    2. Plug in the USB end of the adapter to the laptop or computer.
    3. Wait one minute for Raspberry Pi to boot.

    Talk between your computer and Raspberry Pi

    1. After waiting one minute for Raspberry Pi to boot, launch Terminal application. If Terminal was already open, CLOSE terminal and open it again (this only needs to be done the first time to make sure the hardware was properly recognized).
    2. In Terminal, enter this command

    screen /dev/tty.usbserial 115200

    If everything goes well, the following should appear:

    Raspbian GNU/Linux 7 vspi ttyAMA0
    vspi login: pi
    Password: raspberry
    Last login: Fri Feb 21 06:17:55 UTC 2014 on ttyAMA0
    Linux vspi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    Debian GNU/Linux comes with <em>absolutely no warranty</em>, to the extent
    permitted by applicable law.
    [email protected]:~$ pwd
    /home/pi

    If so, congratulations! You’re up and running on UART. If you have any issues, please see the troubleshooting section below.

    running

    Up and Running!

    TROUBLESHOOTING

    If you’re using a Mac and your TTY command isn’t working, you will get a message like this:

    Cannot exec '/dev/tty.usbserial': No such file or directory
    comp:~$ screen /dev/tty.usbserial 115200
    [screen is terminating]

    It means that the Mac is not seeing the USB to UART connection. It could mean:

    1. The cables are incorrectly wired (double check my images above).
    2. Raspberry Pi wasn’t given enough time to boot before the Terminal window was initially opened (try powering up Raspberry Pi, waiting a couple of minutes, and then re-launching Terminal).
    3. The drivers are not being recognized. Launch the Mac program, System Information, and navigate to Hardware > USB. There should be a UART listed under the USB Device Tree. If not, either:
      • Confirm that Step 2, the system reboot, was completed.
      • Double check the drivers. Sometimes people need to use third party drivers.

    If the SD card was not previously initialized correctly, you may get to the rescue system:

    Welcome to the rescue system
    recovery login: root
    Password: raspberry
    # pwd
    /root

    If this message appears, that means that the SD card was not properly initialized. With NOOBs, the initial installation needs to be completed with a keyboard and mouse. After the initial install, the keyboard or monitor are no longer needed.