How To Setup Raspberry Pi Zero W Headless WiFi

Hey good sleuthing, @Joseph47436. Would you mind linking the article? Given your success and that a few people have encountered problems similar to yours I’d like to investigate further and roll this information into the Troubleshooting section of the article.


The article was in the forum section of site, specifically,

The specific section of the forum where I got the code from was here,

Perhaps changing the country in the code to:


I have not tested this though


1 Like

@Joseph Can confirm I tried your exact instructions.

Indeed adding country=AU made all the difference in my case.

Thanks for your comments.



First time purchasing your website, so first time posting also. Postage prices are too high! Regardless:

Getting this pi setup was a pain. For anyone running into that “host not found” problem with Putty:

  1. Make sure you have bonjour print services installed.

THEN go through these steps:

Worked for me. Everything else was hopeless, this finally did it!

Absolute legends you guys.
After reinstalling HASSbian about 4 times and being unable to connect over ssh, your direction of opening CMD and running ipconfig/flushdns


Hi guys,
Following the video, couldn’t get a wireless connect… but adding the extras about country code, and file location for the boot:wpa_supplicant file, did fix the issue for me. Seems to be mandatory.

1 Like

A post was split to a new topic: Raspberry Pi Zero Setup

I am hoping someone here may be able to help me.

This problem has/IS driving me crazy and I have asked so many times at so many different places I have lost track of what is what, so please forgive me if I don’t mention something obvious here/now.

I have a RPZ(W) I bought from Core a while back.
It works connected to my WAP.

But needs must and I need to CONTROLLABLY switch it from that WAP to another.
Sounds easy but isn’t.

I was nearly up to speed with Jessie then Stretch came along and I’m back to knowing nothing.

It became so difficult I had to connect the monitor etc to try - and even then it failed.

It connects to the WAP.

I go up to the top right and click on the wifi Icon. I see the list of SSIDs available.
I select my second wifi SSID. Enter the password and the icon changes from the wifi (little dot with the arcs rising above it) to the two “ethernet” arrows (one up one down) with a red cross through them. Network disconnected.

Moving my mouse over the icon I get a message like:
wlan0 stopped.

I give up.

What I am ultimately wanting to do is switch between SSIDs from the CLI/TERMINAL.

I’d better stop here as to not spook you too much of the problems I have been through.

Help appreciated.

Hi Andrew,

I found a couple things you should try. Check out these discussions about this problem:

Here is a script to change between wifi networks using the CLI:

Here is a tool for command line managing network connections:

If you are having phantom network problems then I would consider doing a clean install of Raspbian.

I hope that helps! Let me know how everything works out!

Hi there,
I just read the tutorial on “How To Setup Raspberry Pi Zero W Headless WiFi”:

For my project, I am concerned about the plain-text visibility of my WiFi SSID and PSK existing in the file ‘wpa_supplicant.conf’.

Is there a more secure way to achieve headless wifi connection that does not require PSK to be plain-text visible?


1 Like

I am not sure you can hide the Wifi SSID in the “wpa_supplicant.conf” file, however I have had success storing a non-plaintext password.

You can use the “wpa_passphrase” utility to generate a encrypted psk, for example: wpa_passphrase "testing" "testingPassword", as in the following links.

In my experience, I’ve had issues using a encrypted psk with a enterprise network (e.g. WPA-EAP), however I’ve had it work fine with standard WPA network (e.g. a home network).


Have just written to the site re setting up RPI0W headless with stretch lite and Window 10 . The basic setup did not work. No wireless communication and no SSH config. Fixed these by inserting etc/wpa_supplicant/wpa_supplicant.conf from a working RPI0W and a new ssh file from gedit into the sd boot directory.
At the time of previous writing used only Linux terminal which did not work and had not tried putty - PUTTy works -user name pi and password raspberry.
What a procedure!!?



Sorry for the long delay in replying.

I shall look at them soon. Much appreciated.

1 Like

HI,Following the audio, couldn’t get a wireless connect… but adding the extras about country code, and file location for the boot:wpa_supplicant file, did fix the issue for me. Seems to be mandatory.

1 Like

I put the file in the boot partition and it was copied to /etc/wpa_supplicant/wpa_supplicant.conf by the system as it booted for the first time. Both ifconfig and iwconfig still show no IP address and indicate that the pi is not associated with an access point.

This is a very well tested method, so it’s likely something within your user config options. The example config file text we provided is:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

And these are the variables.

  • country=AU (define for your part of the world)
  • ssid=“MyWiFiNetwork” (network as listed on your iPhone etc)
  • psk=“aVeryStrongPassword” (as setup on the WiFi host)
  • key_mgmt=WPA-PSK (as setup on the WiFi host)

This works perfectly fine on both Raspbian Stretch with desktop, and the lite version. If you’ve made non-standard changes to the operating system, for debugging purposes you could create a fresh uSD card with a fresh install of Raspbian to test the config file operation. If it works on the fresh uSD, then there are factors involved on your original uSD beyond the scope of this guide.

Great tutorial, saved hunting for a HDMI converter and USB OTG cable. Thanks!

1 Like

Awesome tutorial, man!
Thanks a lot for your time and desire to help :slight_smile:

1 Like

I have a raspberry pi zero w and i am hoping to connect a camera and two motors. My hope would be able to remotely connect and control it in some fashion and stream from the camera is this a plausibly possible project?

Definitely possible. Have a look at Jim’s Mini Robot Cart for some inspiration: