Tuesday, May 24

Pi Zero - Programming and Internet over OTG

The Source

Andrew Mulholland posted a wonderful article on his blog titled "RASPBERRY PI ZERO – PROGRAMMING OVER USB! (PART 2)". Explaining how, with very little effort, you can have your Raspberry Pi Zero act as a USB Ethernet device for your desktop. It is a wonderful article, and I thoroughly enjoyed reading it.

I am going to be documenting my experiences setting up one of my Raspberry Pi Zeros this way.

update: You can also watch the YouTube video

The Setup
  1. Download 2016-05-10 release of Raspbian, either:
  2. Flash your preferred choice of Rasbian to an SD Card

  3. View the boot partition
  4. Edit config.txt
    1. add "dtoverlay=dwc2" on a new line at the bottom
  5. Edit cmdline.txt
    1. add "modules-load=dwc2,g_ether" after "rootwait"
  6. Plug in your Raspberry Pi Zero into your computers USB port.
    1. It should then appear as a "USB Ethernet device". or "RNDIS/Ethernet Gadget"
    2. You can SSH into it using raspberrypi.local as the address.
    3. Accept new SSH keys
      Click "Yes"

Windows ICS "Internet Connection Sharing"

If you have Windows, the easiest way to share internet with your Raspberry Pi Zero, when it is configured as a USB Ethernet device is Windows ICS. These are the steps required to setup Windows ICS.

Please note you have to have the Raspberry Pi Zero plugged into the computer and already setup as an "USB Ethernet device" before you can continue with these steps:
  1. Open Control Panel\Network and Internet\Network Connections
    1. Click "Start Button"
    2. Click "Control Panel"
    3. Click "Network and Internet"
    4. Click "Network and Sharing Center"
    5. Click "Change adapter settings"
  2. Add sharing to your internet adapter
    1. Select your network adapter
      It will be the one that does not show as "USB Ethernet/RNDIS Gadget"
    2. Right Click "Properties"
    3. Click "Sharing" tab
    4. Make sure there is a check mark in "Allow other network users to connect through this computer's Internet connection"
    5. Click "OK" button to close this window
    6. After a few moments your Internet Adapter should display "Network, Shared"
  3. Reboot the Raspberry Pi Zero
After the Raspberry Pi Zero has reboot, it should be able to connect up to the internet through the computer that it is plugged into.

If you don't see a RNDIS Network Adapter...
  1. Open Windows Device Manager
  2. Click "Other devices"
  3. Click "RNDIS/Ethernet Gadget"
  4. Click "Update Driver"
  5. Click "Let me pick from a list of device drivers on my computer"
  6. Uncheck "Show compatible hardware"
  7. Select "Acer Incorporated." for Manufacture
  8. Select "USB Ethernet/RNDIS Gadget" for Network Adapter
  9. Click Next
  10.  You should now see your Raspberry Pi Zero


  1. How would you be able to complete this with another raspberry pi(model b) acting as the host instead of windows? Cool Tutorial!

  2. As soon as my capture card arrives, I will be making several videos, including using a Raspberry Pi B, Raspberry Pi 2B, as hosts for single and multiple Pi Zeros.