Headless raspberry pi zero 2 w won’t connect to wifi

Hi there,

I have a headless pi zero 2 w and I am trying to set it up. Using the pi imager, I have tried everything, editing config, editing the settings in the imager, etc. but the pi just will not connect. Can anyone help me?

May be worth checking you don’t have a Zero W rather than a Zero w 2 if you’re trying to connect to a 5GHz network, easiest way to check is the W 2 has a silver cover to the right of the main chip, where the W doesn’t

I’ve tried both 2.4 and 5g.

Some more details might help, what is it you are trying to connect to, what where the settings you changed.

This guide will get Headless going with SSH, not exactly what you want. But a start, small steps.
Connect to the Pi from a PC using SSH and you can check what WiFi is setup and maybe enable it. The guide assumes a certain level of knowledge.

Headless is just used to make an image to get a Pi going when it has no mouse or keyboard.

Regards
Jim

Hi,

The problem is it won’t connect via ssh because it isn’t connecting to the network.

Presume you are downloading Raspberry Pi OS Lite 32 or 64 bit version.

In the Raspberry Pi Imager double check that the WiFi SSID and password are correct. It is easy to miss a character. Also check that the WiFi network is 2.4GHz, the board will not operate on 5GHz.

Also in the Imager tick the SSH box for headless operation.

When the board boots for the first time it takes ages which gives the illusion that it has failed. When it boots does the led flash solidly for a few minutes? This would indicate it has found a network and is doing an update.

Do you know to use the router to check if the board has connected to the WiFi?

There are many reasons why the Pi Zero will not connect to a network. It is hard to figure it out from the information you have provided.

If you have tried everything suggest connecting a keyboard and screen to see exactly what the Pi is reporting when it boots. It can be hard to see exactly as the text moves fast, but the log is recorded, a bit hard to find though if you don’t know the right folder or file.

Checking the router, as @Fractal said is an excellent idea too.

I once set my modem router to only accept certain MAC addresses and then forgot I had done it till I wanted to connect a new device and it would not. Was annoying till I remembered. I needed a group of IPs that could be dynamically assigned. Checking the router log confirmed it was being rejected. Depends on your type of router, mine does has an OK log but not what I would really like.

Cheers
JIm

UPDATE: I was able to install mainsail and control my printer but I had to use a mobile hotspot. Can connect via ssh but it is less than ideal to be using mobile data. Is there a way to fix this?

This proves your method is correct because you get SSH via hotspot. So Pi working, SD card ok, OS working, and wireless interface working. It will be a configuration of the WiFi problem.

In the SSH terminal screen run ‘sudo raspi-config’. Check that ‘Raspberry Pi Connect’ is enabled.
Run ‘iwconfig’ to check wireless. wlan0 (might have different name), it should be there if the Pi OS thinks it has a wireless connection.
You can use ‘iwconfig’ to set wlan0 parameters.
Another command is ‘iwlist’, it provides information about connects etc

Regards
Jim

Hi James,

I couldn’t find the raspberry pi connect option in the config tool

I tried to follow the other instructions but the hotspot is pretty unreliable - my computer doesn’t like to join it when the pi is on it. I used ChatGPT earlier and I tried most of those things. Here’s what happened: the pi can detect the network but just can’t join it. The log has no errors for some reason. But it does show that it can’t connect.

The OS I am using is full 64 bit with GUI on Pi 5.

Opened a terminal window,
The Wireless Lan setup is in System Settings,
Set my SSID and Password,
Checked ‘iwconfig’ and the SSID was in wlan0,
Checked my router and the Pi had connected and had an IP address,
Checked ‘ifconfig’ and wlan showed up with the IP and packets sent and received.

I can try this on a Pi Zero W (don’t have a 2 version) with the OS you are using.
Can you let me know which OS you are using.

Router logs can be very vague, depends on how much control the ISP wants to give you, often they cut it back so people wont stuff things up.

Cheers
Jim

Hi,

I’m using mainsail os

OK.
When you mentioned Mainsail before I had no idea what it was and I didn’t look for it.
I assumed you were using the Raspberry Pi OS. Have you been using Mainsail all along ??
As mentioned before, more details in your original post would help and been appreciated.

People who respond to these posts usually have vast experience and can figure out problems and provide solutions. But they need the details of what exactly the OP is dealing with. What device, what software, what situation, what will the device to be used for, etc …

Otherwise they are guessing and working in the dark so to speak. Most problems posted here can be solved with the right information.

I have no experience with mainsail so I don’t think I can be any help.

Cheers
Jim

Hi,

Mainsail is based on pi is so I think it is pretty similar. I think the problem may be with the router, even though I have tried changing the settings. The frustration has caused me to just apply for the pi to be returned.

Thank you for trying to help!!

Hi Taran,

If you haven’t already, using something like Angry IP scanner can help with issues like this. From personal experience when trying to connect to a Klipper device via SSH for whatever reason using the hostname can cause issues, but using the IP address for the device has worked, (also making sure that you’re using port 22)