How To Setup Raspberry Pi Zero W Headless WiFi

Michael just shared a new tutorial: "How To Setup Raspberry Pi Zero W Headless WiFi"

The following instructions will work anytime, you don’t necessarily have to follow them for the first boot - this is just a very convenient way to get your Raspberry Pi onto a network without using any plug-in peripherals like a keyboard, mouse or mo…

Read more

I have just received the RPi Zero Wireless in the mail today (11/05/2017) and want to get started.
I kind of ‘missed’ it when you using the ‘Putty’ program to communicate between the PC and the RPi.
How was the communication between the PC and the RPi established using ‘Putty’.
(a) Was it between the micro USB of the RPi and the USB of my PC?
(b) Was it between the wireless output between the RPi’s wireless and the PC’s wireless? If so I have a Windows 7 pc. Do I have to first establish a wireless connection between the PC and the RPi before proceeding with running the ‘Putty’ program?
© Was it between a wired network connection (RJ45) between the PC and the RPi. But given that the RPi zero wireless does not have a wired network connection, this question does not apply.
Keen to get started,
Thank you

Hey @Anthony12822, thanks for bringing your question to the forum.
The Pi Zero W connects to the WiFi network (router) that you prescribe with the wpa_supplicant.conf file. This has to be a real network, not just the placeholder ssid and psk that I use in the video.
Your computer also needs to be on this network. How your computer is connected is unimportant (Ethernet or WiFi).

With both machines on the network, and the hostname of the Pi known, we can connect from the computer to the Pi using PuTTY.

I hope that clears things up! Let me know how you go.

Dear Michael thanks for the reply.
I need further clarification now that it is a wireless connection is needed to communicate between the PC and the RPi.
(a) Can I connect between the PC and RPi directly without the Router provided I have the IP address of the RPi?
(b) In my PC, whenever I want to make a wireless connection, I check the ‘wireless icon’ located at the bottom right of the screen, and to make a connection I click the connect button. Then depending on the security level of the wireless communication, it may ask me for a password but without the username.
(i) given the first time use of the RPi, what do I put for the password is it the same as the original one.
(ii) then establish the ‘Putty’ connection as per tutorial.
Or generally, to establish a communication between the PC and the RPi you have to (1) connect between the PC and PRi through the PC’s wireless dialog, then (2) Connect with using ‘Putty’.
Thank you again,

Hi Anthony,

a) that would be bypassing the wireless network that is required to connect to your PC. While I’m sure it’s possible to setup a PuTTY connection over an AdHoc network, perhaps just try following the tutorial verbatim, then experiment with some other options, especially if you’re unfamiliar with the protocol of wireless networking.

b) If you’re setting up a wireless network using the standard Raspbian desktop, then you can of course connect in a fairly similar way as you would on your PC, however, the whole idea of this tutorial is setting up a Raspberry Pi Zero W so that it can function without a monitor, keyboard, or mouse, so editing the files as Michael outlined is the goal of this particular tutorial.

I’d recommend taking a look at some of our other Raspberry Pi tutorials which cover of on some of the other usage.

Thanks for that.
Before I start to ‘play’ with the computer, I want to confirm two things. When I log on to my RPi through my PC using the ‘Putty’, it will automatically connect without having to log onto my PC’s input wireless connection.

The other question which of the micro USB connections is used for the 5V power supply the one on the left or the right?
Thank you again,

This setup did not work for me on Jessie lite 2017-04-10. After a bit of poking around and connecting a monitor I found the following entries were missing from /etc/wpa_supplicant/wpa_supplicant.conf:

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

I have not tested weather adding these to the boot:wpa_supplicant.conf will fix the issue

1 Like

Hmm, good pickup Peter, let us know if that resolves it for you.

Dear Sam or Michael,
I would like to know the power consumption of the RPi Wireless zero. I know you sell a 5V supply with a micro usb which is 2.5A.

Nevertheless, I would like to know the power consumption of the RPi Wireless. It would be definitely less than the power consumption of much bigger Model B.

I happen to have a 1A (1000mA) 5V supply with a micro usb and hope to use that supply with my RPi Wireless Zero.
This is my intention to connect the following peripherals:
Alternative one:

  • A wired usb keyboard with a usb to micro-usb converter.
  • A powered usb hub - provide power and connect many usb devices. Hub is connected to the right most micro usb. Is that 1000mA-2000mA?
  • A monitor (hdmi)

Alternative two:

  • A wired wired usb keyboard connected to a usb hub - connect many other devices.
  • A 5V 1000mA supply connected to the right-most usb hub,.
  • A monitor (hdmi).

Alternative three:

  • A wired usb keyboard connected to a usb hub - connected many other dievies eg a usb camera
  • A GPIO board such as the PIFACE PIFACE DIGITAL 2 I/O Expansion Board for Raspberry Pi B+. I hope that you can connect this board to the RPi Zero Wireless
  • A monitor (hdmi)
  • A 5V 2.5A (2500mA) supply sold by you.

Thank you,
Anthony of Sydney

Hi Anthony,

There isn’t a huge amount of difference between the various options that you’ve presented, from a technical perspective. The power consumption on the Pi Zero W is indeed lower than the Pi 3, a 1000mA power supply should do the job, but I wouldn’t recommend going lower than that if you’re connecting something to the USB port. The USB port on the Pi draws it’s power from your Power Supply, so it can’t output 1000mA-2000mA if your power supply is only 1000mA.

The general rule is that if you’re connecting lots of USB devices up, use a powered hub, if it’s only 1 or two (provided they’re not big harddrives or something like that), then go direct, or use a passive hub.

Pi Zero doesn’t have any power limiting circuits - however - it’s best not to exceed 1A with all things USB.

If you are using high powered USB devices then it would be best to use a Powered Hub (nothing you have described is high powered though). If you are using a Powered Hub, then ensure the Pi Zero is never in a configuration where the PWR microUSB and OTG are powered from different sources. Only have one power source connected at a time. Use the data-only lead on the Powered Hub if an independent supply is used on The RPI’s PWR connector.

If you are powering the Pi Zero from only the Powered Hub, then it’s fine to connect both the PWR and OTG to the hub.

As for just Pi Zero power usage - it will vary between 80-120 mA depending on how you are using it / what is enabled. So your 1000mA Power Supply will work just fine.

1 Like

Dear Sam, Michael and Graham,
Thank you for your kind reply and assurances about the power supply requirements. I have two further questions.

Related to the power supply requirement, I wish to ask particularly about the GPIO board such as the PIFACE DIGITAL 2 I/O Expansion Board for Raspberry Pi B+. I have this board but wish to use it on the RPi Zero Wireless (‘RPIZW’).
(a) Given the RPIZW uses 120mA, would the PIFACE Digital 2 I/O Expansion Board for the RPi B+ use maximum 880mA?
(b) Given that the RPIZW and the Model B+ have a 40-pin GPIO port and I want to use the PIFACE GPIO board, I want to be sure about the orientation of the pins such that I don’t ‘fry’ either the RPIZW and/or the PIFACE GPIO board, when I look at the board of both the RPIZW and the Model B+ is there a comparative photo as to the orientation of the pins so one can solder a shrouded header such as the product advertised at

Related to headless WiFi, the ‘Putty’ program and internet connections. Partially inspired by your colleague Michael’s article at subsection “BASIC INSTALLATION” which refers to this original tutorial, the sentence above the subsection.

I have never done headless operation of an RPi whether the RPIZW or Model B+.
I have never done connecting two different wireless connections - the RPIZW and the internet on my laptop.

Suppose I connect the RPi wirelessly to my laptop (Windows), my laptop is connected to the internet. Can you have two simultaneous wireless connections - one for the RPIZW and the other for the internet connection. In other words, The RPiZW can be connected to the internet via my laptop. Is this correct?

Please excuse my naivity. My laptop with a Windows 7 64-bit OS and I want to use my Uni’s super fast WiFi. Will my laptop allow the use of two inbuilt wireless connections, one for the RPIZW and the other the laptop’s connection to the internet = Uni’s WiFi?

Thank you
Anthony of Sydney

Our pleasure @Anthony12822! This is what we’re all about.

I’ll jump first to my thoughts on point 2, then backpedal.
It feels like we may be getting a bit of an XY problem here. If I understand correctly, we can break your requirements into two problems.
You want to control your PiZW from your laptop.
You want to get your Pi on your uni network so it can access internet.

These requirements are easy to solve individually, but together they may be pretty tricky. I think the most bulletproof is to connect your Pi direct to the Uni WiFi network. Getting a terminal running between your Pi and laptop can then be done over UART with a serial adapter. This would isolate the terminal connection between your Pi and laptop from the university network, but mean you’re tethered to your Pi by the serial cable.

(2) In general, a laptop cannot connect to two different WiFi networks at the same time, but that isn’t really what your problem is going to be anyway. To roll things back, there are very few reasons that you’d want to use your laptop as a bridge between a raspberry pi and the internet. Sadly, working on a university network might be one of them. As discussed earlier in this thread, the traditional topology would look like a central access point like a router, which hosts a network that both your laptop and the Pi connect to. The Pi and the laptop can communicate across the network which the router provides. For a university network though, things get interesting. You probably can connect your Pi to the network, like any other laptop perhaps, but you’d probably have a hard time connecting to it via SSH (enterprise networks like universities would lock that down for security reasons). Likewise, you can connect direct to your pi using USB which is definitely on the cards for one of our own tutorials in the future. Here’s some from another site.
This sets up a virtual ethernet connection between your Pi and laptop, from there you could look at bridging to the internet. I won’t repeat the steps in this post because I haven’t tested it, and we’re getting a bit off the original topic of the thread.

Have a chat to your Uni’s IT people to see if it’s even possible for you to set up an SSH connection on their network. I suspect the answer will be no, sadly

(1). a) Short answer is “it depends”. The digital outputs are open-collector transistors meaning that they sink current. That current will be provided by whatever is powering the load. So if you’re powering the load from the Pi’s own 5V supply then yes, I’d aim for a maximum 750mA load. If the current is being supplied by an external supply (eg. 12V for relays, 12V led strips) then the maximum is whatever each transistor is rated to which is probably 50-250mA. You’d have to look in the documentation to be sure.

b) The orientation is intuitively the same. The row of pins closest to the edge of the board is the same for both the Pi 3 B and the PiZW. These two boards are aligned in the same direction. There’s not much use having a shrouded header on your Pi if there is not a keyed connector on the hardware you want to plug into it. Without a keyed connector you’re still free to plug things in the wrong way. Shrouded headers are most suitable for IDC ribbon cable connectors, but having one on won’t stop you from being able to plug in unpolarised (unkeyed) connectors. Still, its not a bad feature to have, and its backwards-compatible with unkeyed connectors.

Dear Michael,
Thank you for reply. I hope this forum will help others as well gain the confidence to connect the RPIZW to the laptop and internet with the aim of the RPIZW being connected ‘indirectly’ to the internet via the laptop which is connected to the internet.

The aim is to connect the RPiWZ to do a headless WiFi directly - to use the very product you sell and me being very keen to use. Especially where I don’t have a router

Based on your second reply, I have three questions on connecting the RPIWZ to the laptop which is connected to the internet.

In your reply, you mentioned about the SSH protocol possibly not permitted (or utilized?) on a Uni network.
The reason for mentioning using my Uni’s computers is that it is very fast while my home’s internet is prepaid and slow.I will address the SSH issue later.

(1) Thank you for pointing me to the computer’s s wifi’s device only being allowed to connect to one network. I realised from my experience of of being able to connect to two wireless networks was based on my computer having two wireless devices, the wifi device in the laptop and the wireless 3G usb dongle for my internet connection.

This leads to the following lightning moment :zap:

Why not have two wifi network devices, one consisting of the laptop’s internal wifi device and a USB wireless device. Use one for the RPiWZ and the other for the WiFi internet. You sell a USB wireless device. I have been able to connect a wireless USB device and do a separate login. The reason for using the wireless USB because it was faster at 150MBs compared to the internal WiFi at 54MBs. There was no problem or hardware conflicts. So I can use one wifi device for the RPiZ and another for the WiFi connection.

After ticking the wireless connections in the computer to allow sharing of WiFi connection I may be able to have the RPiZ have access to my computer with access to the WiFi

In sum Michael, you are right that you cannot use two wireless networks at the same time on one WiFi device. To get around that I could connect another WiFI usb device and effectively have two WiFi connections and tick the box in the wireless network section for sharing.

Thank you for making me reflect on this matter.

Now for the issue addressing the SSH protocol
(2) Ideally I would like to use the Uni’s computer because it is faster. Without telling you my Uni, my Uni supports the SSH protocol and it has a page on using the ‘putty’ program. So now I can use two separate wireless connections with 2 wifi devices. One wifi device connected to the RPi and the other to the Uni’s WiFi.

On the other hand I may not need to do this: I also thank you for pointing to the article on various ways for the RPiWZ to connect to the internet. The first answer allows connection by allowing one to share the laptop’s wire connection with the RPiWZ. So if I can do that, then I don’t need to use two separate wireless connections.

The aim is to use the RPiZW and do a headless WiFi.

(3a) Using a UART. Thank you for the answer regarding the [orientation of the pins of the GPIO being the same for RPiZW as well as the RPi 3 and B.

The UART then is on pins 8 and 10. Is that 3.3V or 5V (TTL). And do I have to do anything to the config.txt file to have UART communications via the laptop through a USB/UART adapter to do a headless WiFi with my RPiWZ such as for example this article headed “Option 1” on modifying config.txt to say enable_uart = 1,

(3b) Thank you for providing a link to IP communication via USB, It reminds me of an experiment I did about 16 years ago where I could do IP communication between a 486 and a 286 via a parallel cable.

In sum the aim is to return to the theme of the original posting “How To Setup Raspberry Pi Zero W Headless WiFi” trying all the methods especially where my Uni’s WiFi allows SSH.

Thank you,
Anthony of Sydney

Hi there!

I am trying to do a headless setup with the raspberry pi zero w from the tutorial here. When I follow the steps on your website it all seems fine. But when I try I only get error’s through PuTTy and when I then reopen the Boot directory it turns out the ssh file I created before is gone?

Funny enough the same would happen before to my wpa_supplicant.conf file, when I would not actually fill out the ssid and psk.

Doesn’t seem quite right to me, any advise or tips?

Thank you!

Hey, @Evie42548. The ssh and wpa_supplicant.conf files will be removed from the boot directory - this is normal. When you power-on, Raspbian looks in that directory and uses the information from the files, then cleans them up.

Have you tried the troubleshooting section? You may just have to try connecting to raspberrypi.local.

Best of luck! Let us know how it goes.

1 Like

@Evie42548 On second boot ssh had disappeared for me as well, and access was denied. I fixed by changing permissions on ssh to read only for all users

Hi everyone,

Will this work with Raspian Stretch, which is what is now available on

Just need to clarify that the onboard wireless is 2.4GHz and when specifying an SSID, it should be one on that frequency? Also the key I use is WPA2, does this make a difference to the supplicant code.

Lastly, after reboot the supplicant config and ssh get removed from the boot partition. What happens in subsequent reboots, how does the Pi Zero know how to connect?

Apologies if these questions seem simplistic but i am trying to troubleshoot why my device does not connect to my wireless.


Hey, @Joseph47436. These steps should work with stretch just fine.
Since the Pi’s WiFi is 2.4GHz, of course the credentials should match that of a 2.4GHz network. WPA2 is fine.

The ssh and wpa_supplicant.conf files will be removed from the boot partition on the first boot - this is normal because these files are just a way for you to inject information into Raspbian. The information is copied to the relevant directory/file and then the source files in boot are removed. For instance, if you connects to a monitor and execute sudo cat /etc/wpa_supplicant/wpa_supplicant.conf you should see the credentials you entered into the boot partition copied to this location.

If your device is not connecting, make sure that port 22 is not blocked within your network and try connecting to pi@raspberrypi.local instead.

Sometimes connecting via hostname does not work for your network, and you’ll need a way to identify the IP of the Pi and connect directly to the IP. Generally you can connect via the hostname after connecting via IP the first time.

I hope this helps, let us know how you travel.

1 Like


Thanks for your response. This did not work, so I plugged in a monitor and keyboard. I located the wpa_supplicant.conf file in /etc/wpa_supplicant and noted that the details were as I entered in my wpa_supplicant.conf file in the boot partition (as per your video)

I noticed in ifconfig for wlan0, there was no IP address. I located an article that had added lines in the wpa_supplicant.conf file. The article indicated that it was required for v1.1 of the Zero.

I followed your video tutorial but added the following text for the wpa_supplicant.conf file

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

I rebooted and it worked instantly, so don’t know why the extra code made it work?



1 Like