Access the Raspberry Pi via USB and SSH (OTG)

Since the Raspberry Pi Zero is a very handy small device which you can take everywhere you want.
A big HDMI screen, a mouse and a keyboard on the other hand not. But even without a screen or any other peripherals it is possible to access and manage the Raspberry Pi Zero… And even with Windows…

All in all it is a quite simple process, originally described here: gbaman/HowToOTGFast.md (GitHUB)

  1. Install Raspbian
    Acquire the OS on the official Raspberry Pi website, here and install the Linux distribution on your Raspberry Pi.
    A detailed instruction, how to do so, you will be able to find here: Install Raspberry System Images on Windows
  2. Modify boot files
    Plug in the SD-card with your Raspbian system image to your computer and open the boot partition in explorer. You should now see some *.txt, *.dat files and so on.
    Find the config.txt file, open it with an editor of your choice and add

    dtoverlay=dwc2

    on a new line at the end of your file:

    Save and close the file.

    Now there is one more file to edit: the cmdline.txt.
    Here you have to add

    modules-load=dwc2,g_ether

    right after rootwait, like in the picture:

    Also save and close the file.

    As the last step, you just need to create an empty file, called ssh.
    Attention, the file does not have a filename extension!

  3. Connect the Raspberry to you computer
    The next thing to do is to connect the Raspberry Pi Zero to your computer. Use a data USB cable for that (some phone charger cabels do not have data transfer wires in them).
    Be sure to plug the Micro USB cable into the USB and not the PWR slot:
  4. Install the necessary RNDIS network drivers on Windows
    On Linux that would be usually it. You could already access the Raspberry Pi via SSH, but on Windows there seem to be some drivers missing, at least in my case. The raspberry is being recognized as a USB device, but not as a virtual ethernet adapter.
    To fix that we need to install the proper drivers. That would be the RNDIS driver.

    Open Windows 10’s Device Manager utility and observe, if the Raspberry was recognized as a USB device or a COM Port device. In my case it was recognized as a COM7 USB device.
    When you found the Raspberry, do a right click on the entry and then Update Driver Software:

    A new window should have opened. Here you just select to automatically search for the drivers on the intenet.

    It should take a couple minutes for the drivers to be downloaded and installed.

    This accomplished you technically should be ready to continue with the next step and connect to the Raspberry Pi Zero!

  5. Install SSH client for Windows
  6. Connect to your Raspberry via SSH!