Setting for OTG mode for pi zero
Instruction
add the following text to
/boot/config.txt# Enable OTG mode dtoverlay=dwc2Save the config.txt file as plain text and then open up cmdline.txt After
rootwait(the last word on the first line) add a space and thenmodules-load=dwc2,g_etherCreate an empty file named as
ssh.txtin/bootconnect to your pi through ssh
# default password is raspberry ssh pi@raspberrypi.localSetup for locale, add following text in
/etc/default/localeLC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8Change password, Setup localization, interface option, network naming …
- using command
sudo raspi-configto setup raspberry pi zero.
- using command
Setup wifi sharing, copy the following code to
/etc/network/interfacesauto lo usb0 allow-hotplug usb0 iface usb0 inet manual- Ethernet Tweaks | Turning your Raspberry PI Zero into a USB Gadget | Adafruit Learning System
- Enable internet sharing to pi
Connect wifi without using
sudo raspi-configcommand Since the/bootpartition is accessible by any computer with an SD card reader, wifi configuration is now much simpler.
A typical wpa_supplicant.conf file is:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=«your_ISO-3166-1_two-letter_country_code»
network={
ssid="«your_SSID»"
psk="«your_PSK»"
key_mgmt=WPA-PSK
}
Add ssh public key
mkdir ~/.ssh & cd ~/.ssh & touch authorized_keys- create
authorized_keysfile - paste the ssh public key to
authorized_keys(mostly the key store in~/.ssh/id_rsa.pub)