There seems to be conflicting info out there for how to accomplish this. Compounded with the Zero’s different micro ports, it’s easier if you can set it up as a headless device. Unfortunately, I found that if you try to do this locally, with a monitor and keyboard, the order of operations causes the ssh keys to be faulty. So, let’s make it easy and just do it all from the start. Download Raspbian Jessie Lite. I believe the version I got is 03.02. In Windows I’m using Rufus to write the disk image. Select the disk image from the folder icon in the lower right. You need to search for all file types, as it’s not an ISO. Once you select it, Rufus will automatically determine that it needs to be a DD write for the file. Fire it off on your micro SD card and let it finish. It will take a few minutes.
When it’s done you’ll have a single partition viewable in Windows for the SD card. Right click and create a Notepad file called ssh.txt in the root of that partition. Just create it. Don’t edit it. Create another Notepad file and call it wpa_supplicant.conf. Open that in Notepad and add the following:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="Your SSID Here" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP psk="YourPresharedKeyHere" }
Modify the SSID and PSK to match your WiFi settings and save it. Pop the SD card out, pop it into your Zero W and boot it up. Wait a few minutes, and then you’ll need to find the dhcp address the Zero W received. For me, I checked the dhcp scope on my firewall and found a new dhcp lease for a device named “raspberrypi”. Open up Putty and ssh to that IP. You should be connected at that point. Probably a good idea to run raspi-config and update the password and host name.
I believe the ‘ssh’ file needs to be saved without a .txt extension.
Actually, it doesn’t matter if it has that.
What could go wrong?
Mine just doesn’t get connected with the wifi router. And I cannot see the ip address of my raspberry pi on my ip scanner. I’ve placed exactly the same of my wifi ssid and password. But also it doesn’t work.
Have made ssh (.txt) file. And have edited on config.txt with # Enable UART
enable_uart=1 .
what could possible go wrong?
Prakash, not sure with that. The UART wasn’t a part of what I edited, so I’m not sure why you would need to adjust it.
Hi there Scott,
Thanks for the post, just trying to follow this, but I have a different setup with my wifi being “WPA2-PSK”, with AES security. I also couldn’t create the files on the SD Card as I was doing it through a tablet, so I copied and pasted it via micro-usb connection, in case that affects anything.
“`
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=Khare2.5
proto=RSN
key_mgmt=WPA2-PSK
pairwise=CCMP AES
group=CCMP AES
psk=xxxxxxxxx
}
“`
I got the correct working version from raspeberrypi.org and weworkweplay.com (http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/)
Notes: Keep the quotes for ssid and psk, don’t change key_mgmt and keep pairwise as CCMP
Hope this helps someone else in future, cheers!
Worked for me with one shot, thanks for the post!
Works for WPA2 too!
Alternative wpa_supplicant.conf: https://pastebin.com/raw/FUz6h0Jt
SSH credentials:
user: pi
password: raspberry
+info: https://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/