Transfer File From Computer to Raspberry Pi Using USB-Serial Cable


Introduction: Transfer File From Computer to Raspberry Pi Using USB-Serial Cable

About: Systems Administrator and Software Programmer.


This short tutorial extends on Adafruit's excellent tutorial on using Serial Cable (also known as Serial Console) to remote control the Raspberry Pi (RPi). Adafruit's tutorial demonstrates how to connect the correct USB-Serial cable to the correct GPIO pins. However, the tutorial ended with no examples of what useful tasks you can do after login to RPi.


My contribution is to demonstrate a useful task that you can do after login to RPi:

How to transfer file from computer running Linux to a Headless, Keyboardless and Mouseless Raspberry Pi disconnected from the network.

Headless mean the RPi device has NO TV or computer display connected to it.

Keyboardless and Mouseless mean the RPi device has NO keyboard and mouse


You need to purchase a USB-Serial cablesuitable for RPi because RPi's RX and TX pins operate at 3.3V and NOT 5V. Using 5V logic level will damage the RPi device.


Computer running Centos 6

Raspberry Pi running Raspbian

Step 1: Preparing an SD Card for Your Raspberry Pi

Complete the steps as demonstrated in Adafruit's tutorial but adhere to the following modifications:

  1. Choose Raspbian Distribution
  2. Skip Test and Configure
  3. Do NOT remove SD Card from SD Card Reader/Writer
  4. Do NOT connect power cable to RPi's microUSB jack
  5. Do NOT connect any network cable into RPi's ethernet jack
  6. Do NOT connect any USB device to RPi's USB jacks

Step 2: Download a Unix Communication Package Onto SD Card

The following steps are Linux commands. You have to adapt them for Mac or Windows.

Complete the following steps:

  1. Download lrzsz package
  2. Save the lrzsz package using its original name: lrzsz_0.12.21-7_armhf.deb
  3. As root user, copy the package file to the SD card you prepared:

    # cp path/to/lrzsz_0.12.21-7_armhf /path/to/your_sd_card/

  4. Unmount the SD Card:
    #umount /path/to/your_sd_card
  5. Remove the SD Card from the SD Card Reader/Writer
  6. Insert SD Card into Raspberry Pi

Step 3: Install Minicom Package Onto PC

Note that minicom is needed to be installed on PC and NOT RPi.

minicom package has a dependency on lrzsz package. Usually, the package manager(yum, apt-get) will install the dependencies automatically

The following command is based on Redhat EnterpriseLinux/Fedora/Centos:

#yum install minicom

Step 4: Using a Serial Cable

Complete the following steps:

  1. Connect the USB-Serial Cable leads as shown in Adafruit's tutorial but do not connect the red wire(power supply) to the GPIO of RPi
  2. Plug in the USB connector to the PC if you have NOT
  3. Configure minicom installed on PC by following the steps on this page
  4. Type minicom.
  5. Check that minicom display port as /dev/ttyUSB0. Different USB number is acceptable.
  6. The PC will display the above first image
  7. Plug in the red wire to the GPIO pin as shown in Adafruit's tutorial to power the RPi
  8. Observe minicom's screen
  9. The minicom will display kernel and boot messages sent from RPi over the serial cable as shown in the second picture
  10. Finally minicom will display login prompt

Step 5: Install Lrzsz in RPi

Complete the following steps:

  1. In minicom, login to RPi as pi user if you have NOT.
  2. Install the lrzsz package that was previously copied:
    #sudo dpkg -i /path/to/lrzsz_package

Step 6: Send File From PC to RPi

Complete the following steps:

  1. Type rz and the minicom display status message as shown in picture
  2. Press these 2 buttons together: CTLR and A
  3. Press S
  4. Choose ZMODEM
  5. Choose file that you want to transfer in the dialog box by pressing space bar when minicom display File Dialog Box
  6. Press Enter

  7. Observe Minicom displaying progress bar as show in the picture

You have successfully completed file transfer over serial cable



    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest