Connect a Raspberry Pi Zero over USB

This is a manual for connecting a Raspberry Pi Zero to your computer via USB. After burning the image on your SD card one has to add the USB driver on startup.

Enable SSH on the Raspberry Pi in:

$ sudo raspi-config

or create a new file named “ssh” in the boot folder

To change the DesignWare Core to 2 write in /boot/config.txt at the end of the text:

  dtoverlay=dwc2

and in /boot/cmdline.txt add after rootwait (leaving only one space):

  modules-load=dwc2,g_ether

Connect the Pi Zero with an USB cable or an USB dongle to your computer and log in with SSH

  $ ssh pi@raspberrypi.local

The password is: raspberry


on Arch Linux

Avahi on Arch
To get local hostname resolution using a “hostname.local” naming scheme install avahi and the nss-mdns package:

 $ sudo pacman -S avahi nss-mdns

Start the avahi-daemon.service

 $ sudo systemctl enable avahi-daemon.service
 $ sudo systemctl start avahi-daemon.service

Edit the edit the file /etc/nsswitch.conf and include mdns_minimal [NOTFOUND=return] before resolve:

 $ sudo nano /etc/nsswitch.conf

It should looks like that:

 hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns

To enable the avahi-daemon.service at startup:

 $ sudo enable avahi-daemon.service


On the host computer one might configure the network connection, too. Open the system network setup and for the “raspi network” change:

 in IPv4: "method" to "Link Local only"
 in IPv6: "method" to "Ignore"


Activate the network connection:

 your_network_name (enp0s20u1)

VNC

For a VNC connection install the Real VNC on your host computer, then enable VNC on the Raspberry Pi Zero in the raspi-config

 $ sudo raspi-config

and log in from the host computer with raspberrypi.local


Set the Desktop Resolution

For a HDMI size desktop one can uncomment in:

  $ sudo nano /boot/config.txt

that line:

  hdmi_force_hotplug=1

Then force the Raspberry for example into that mode:

  hdmi_group=2
  hdmi_mode=85

Group 2 is for the DMT mode that is intended for computer monitors.
The hdmi mode defines the resolution, for example:
hdmi_mode=16 1024×768 60 Hz
hdmi_mode=23 1280×768 60 Hz
hdmi_mode=85 720p 60 Hz
All the possible modes one find on:https://elinux.org/RPiconfig