DEV Community

Cover image for Headless Raspberry Pi Zero W Setup

Headless Raspberry Pi Zero W Setup

vorillaz on February 05, 2019

This tutorial was originally posted on my blog. Raspberry Pi Zero W is an affordable and easy to use development board. Since it has limited CPU a...
Collapse
 
herecomeslappy profile image
Lappy

I boot the Pi Zero W but it deletes the ssh file and the wpa_supplicant.conf on boot.

Collapse
 
vorillaz profile image
vorillaz

That's pretty weird, maybe the SD card does not persist the data.

Collapse
 
derickr profile image
Derick Rethans • Edited

Curiously, mine does the same! But only after booting the PI from it. A normal write, unmount, mount, read, works fine!

Thread Thread
 
durikon profile image
Nils

I was facing the same. This worked for me in wpa_supplicant.conf:

country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WLAN SSID"
scan_ssid=1
psk="WLAN PASSWORT"
key_mgmt=WPA-PSK
}

I also made sure, the file has unix line endings. Using vim, write the file using ':w ++ff=unix'.

Collapse
 
razorpi profile image
RazorPi

Same problem as Lappy and Derick. Do you think I should replace the card? I'm using a ScanDisk that came with the kit.

Thread Thread
 
hildende profile image
Dennis Hildenbrand

Probably a little late but the documentation says "When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted.".

It's similar for wpa_supplicant.conf (see documentation) "Put this file in the boot folder, and when the Pi first boots, it will copy that file into the correct location in the Linux root file system and use those settings to start up wireless networking."

Collapse
 
dclowd9901 profile image
David Drew • Edited

This didn't work for me. The unit would never connect to my network and seemed to act like the hardware was malfunctioning. I had to add some additional config to wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid="NETWORK_NAME"
    psk="NETWORK_PASSWORD"
}

And on top of that, I had to edit /etc/network/interfaces to add the lines:

auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

where wlan0 represents the wireless interface.

Collapse
 
theanachronist profile image
TheAnachronist

Total beginner - can you further break down/explain "Using nmap or a network scanner like LanScan you have to obtain the new device connected to your network. The Pi also exposes raspberrypi as a hostname."? I am legit trying to follow a CHILDREN'S RASPBERRY PI TUTORIAL, and I can't - so, explain it like I'm even dumber than a toddler... ::eye roll::

Collapse
 
vorillaz profile image
vorillaz

Hey, apologies for the late reply.
So, in order to make this work, you shall find the IP address of the board. Once the boards get connected with your WiFi you need to find out its IP address.
The official RPI docs have a well-documented set of instructions: raspberrypi.org/documentation/remo...

P.S The is no such thing as a beginner and sometimes when you're digging through uncharted waters things may seem a bit overwhelming, but since you'll get a few bits of information everything will be crystal clear :).

Keep up and let me know if you need any extra help.

Collapse
 
garyqess profile image
Gary Quinn

A piece of advice to anyone trying to connect your WiFi network to Rasp Pi Zero W:

I've just been through the process of setting up a Rasp Pi Zero W for WiFi connection.
I tried quite a few versions of wpa_supplicant.conf before I got it working.

Rather than going thru all the details (lots of notes about this on line), I'll just give one suggestion to anyone trying to set it up:
First check that it is connecting to your WiFi network by logging into your WiFi router and checking that the Pi is connected BEFORE you try and use putty. You should see "raspberrypi" in the list of connected devices.
Unless you see this, no point in trying to figure out why putty wasn't working.
The reason I'm saying this is my putty session never connected using "raspberrypi" as the host name as is should have according to many app notes.- I had to use the IP address.

So it's possible several of my earlier versions of wpa_supplicant.conf I may have actually been OK, but I never knew it.
Hope that's of use to someone.

Collapse
 
whaduu profile image
whaduu

Thanks for this. I used the additional config info from the thread - worked first time. Had to use sudo for the apt-get commands, but otherwise perfect step-by-step instructions.