My son has been using a Raspberry Pi 3 Model B+, and whilst the WiFi seemed to be working fine upon initial setup, it appears that the WiFi is no longer working.
He has tried several troubleshooting steps, including the following:
• Logged in to our router at home to find connected wireless devices, and it could not see the device
• Pinging the device
• Plugged in to the router via Ethernet, but the router still couldn’t see it
• Used an IP address finder to find the IP of the raspberry pi, but it couldn’t be found
• Flashed the SSH to an SD card, formatted to FAT32
None of the above steps were working for us. Is there an easy solution? Or do we need to send it back to be looked at?
Many thanks in advance for your assistance!
I found much the same thing with a RasPi Zero W; and since confirmed with other models. The default seems to be for the RasPi OS to allow its wi-fi to sleep when not used for a while, to conserve power. This is reasonable if the RasPi will be initiating communications - but decidedly bad otherwise.
My own research was not especially conclusive As you can imagine many solutions have been suggested over the years, and at the same time the RasPi OS and software has been evolving.
First step is to disable the Wi-Fi’s sleep mode. The ip, iw and iwconfig commands have been deprecated, so to check you should instead enter at the console:
iw dev wlan0 get power_save
and to turn the power saving off:
sudo iw dev wlan0 set power_save off
This has worked for me, with only an occasional lapse in the wi-fi connection.
Some people setup a script to ping the router every 5 minutes or so, to keep the connection active. Personally this seems to me like a waste of CPU and Wi-Fi resources.
I have seen suggestions that in some cased the routers’ ARP cache may be timing out, before the RasPi’s DHCP lease is renewed.
Ian, you didn’t say whether your son’s RasPi is still running while disconnected. Does he have a monitor connected to it ? Does it come back on the Wi-Fi from time to time ?
Just to check,
- Have you set your region in
rf-kill will stop all WiFi until this is done.
- does running
ifconfig -a show anything interesting (missing devices etc?)
- Have you got it in any kind of metal case that would act as a bit of a faraday cage?
- Have you tried setting up wifi in the advanced options (Ctrl + Shift + X from memory) in the Pi Imager?
Although Ethernet should be much more reliable and eliminate all the above options. Could it be a networking issue external to the Pi, i.e. your router isn’t giving it an IP address?
Keen to get to the bottom of this one!
We’re going to try the above suggestions, thanks!
He also mentioned that he’s running OctoPi at the moment for the 3D printer, if that affects anything.
Will let you know how we go.
He doesn’t have a monitor connected to it, but we’ll plug it into one and see how it goes. It’s generally connected to a 3D printer.
And no, the connection wasn’t coming back from time to time, sadly.
Update: Connected RasPi to monitor, flashed Raspbian to SD card, was able to get an output but it wasn’t taking a keyboard or mouse input so we couldn’t access the console.
We’re stuck in a loop because we can’t input any commands via the keyboard as it won’t detect it, nor can we connect over WiFi because it’s not working.
USB OTG hub or if you have the micro USB to USB connector, try a powered USB hub.
Try lsusb command to see if the hub is recognized using SSH or connect the keyboard and mouse to the hub and see if it works.
If the hub is not recognized, [try this thread](Making RPi Zero recognize USB Hub: Raspberry pi zero refuses to detect USB hub - tried multiple hubs - Raspberry Pi Stack Exchange).
TLDR for the above thread and looking for solutions:
Connect the hub and run lsusb to see if the hub is recognized
Then add the following to /etc/rc.local at the end
lsusb &> /home/pi/lsusb.txt