Skip to content

Instantly share code, notes, and snippets.

@gbaman
Last active October 31, 2024 23:33
Show Gist options
  • Save gbaman/975e2db164b3ca2b51ae11e45e8fd40a to your computer and use it in GitHub Desktop.
Save gbaman/975e2db164b3ca2b51ae11e45e8fd40a to your computer and use it in GitHub Desktop.
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is now disabled so this is required to enable it. Remember - Make sure your file doesn't have an extension (like .txt etc)!
4. Finally, open up the cmdline.txt. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single space (it does not use newlines). Insert modules-load=dwc2,g_ether after rootwait. To compare, an edited version of the cmdline.txt file at the time of writing, can be found here.
5. That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots). It should then appear as a USB Ethernet device. You can SSH into it using raspberrypi.local as the address.

@quincy451
Copy link

quincy451 commented Oct 11, 2022 via email

@freemansoft
Copy link

My Raspberry Pi Zero W was detected as "serial device", not a RNDIS Gadget adapter, got it fixed by installing the

It looks like you can do this now using the windows optional updates which offer up the Acer driver. https://joe.blog.freemansoft.com/2022/11/installing-rndis-driver-on-windows-11.html

@mgmalheiros
Copy link

It is important to note that since the April 2022 update, there is no longer a default user and password on Raspberry Pi images.

So you must define the user and password prior to the first headless boot (either using the imager tool or by editing the boot files). Details on how to do this:

https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022/

@Soily
Copy link

Soily commented Feb 5, 2023

I just tried it with a fresh image from today but for me it doesn't work. The windows host is not recognizing anything on the usb port where I stucked in the raspberrypi. Any ideas or has somebody observed the same issue?

@Soily
Copy link

Soily commented Feb 5, 2023

Hi again.
I found the issue (it's always in front of the PC ;-)).
The housing is not compatible. It has an own usb-c-power connection without datalines on it.

Sorry.

@therandomspoon
Copy link

i am having a error with my raspberry pi zero w where i am using Raspberry Pi OS lite and the pizero usb stem but it is not showing up in my device manager or anything

@greeneggsandmushrooms
Copy link

hit the windows key and type view optional updates. choose that and dropdown the menu and choose the one with RNDIS, install it, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment