How To Setup Raspberry Pi Zero W Headless WiFi
This version of Raspberry Pi Zero, its main feature is the wifi connection, so you can control it remotely by stablishing an SSH connection without the need to use monitor/keyboard (Headless).
Command Line
To connect to a Wi-Fi network, you have to configure the wpa_supplicant.conf fiile using the following command line.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Then you have to add a new wifi network.
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MyWiFiNetwork"
psk="aVeryStrongPassword"
key_mgmt=WPA-PSK
}
After this you have to reboot your raspberry.
sudo reboot
Software Configuration
Another way to configure your raspberry is through the use configuration menu using the following command:
sudo raspi-config
After this, the following menu will appear as show in the image.
Then you have to choose the firts option (1), then select the option (S1) Wireless LAN.
Next you have to enter the name and password of your Wi-Fi network. Reboot your raspberry.
ENABLE SSH
By default, the current version of Raspbian has SSH disabled, so lets enable it. Make use of the following command to enable it:
sudo service ssh restart
Your Pi is now ready to have an SSH connection.