Help! My Raspberry Pi Won’t Connect to WiFi!
One of the most common problems you might encounter with your Raspberry Pi is it not connecting to the WiFi. There are new posts on the Raspberry Pi forums every day looking to resolve these issues.
Here, we are compiling all the answers (along with some of our own) into one ultimate guide to fix WiFi on your Raspberry Pi!
So, you’ve plugged in your Raspberry Pi and it has booted up. So why won’t it connect?
Let’s first run through a quick checklist to make sure everything’s in order. Ensure the following:
- the router is on ✓
- the Pi is close enough to the router to catch a signal ✓
- the password is correct ✓
- seriously, the password is correct ✓
- the router and Pi have rebooted and there’s still no connection ✓
If you’ve double-checked and made sure that you’ve taken care of these points, then it’s time to look at what else could be the problem.
Your Operating System Configuration
In this picture, you can see that you need to configure the wireless LAN (Local Area Network, a.k.a. WiFi) with a name and password. SSID, or Service Set Identifier, is just a fancy way of saying “the name of the network”.
But you also need to configure the country.
For example, GB for Great Britain, JP for Japan, US for the United States, and DE for Germany.
This is extremely important, because WiFi channels have different specifications in different countries.
Did you know that using WiFi channel 14 is actually illegal in most of the world, but allowed in Japan?
Therefore, double-check and make sure that you’ve set your Raspberry Pi OS to the correct country!
Your WiFi Configuration
There are a bajillion ways to troubleshoot your configuration. But I want to go through a couple that are particularly useful.
Open up a terminal and run:
iwconfig
The terminal will spit out a bunch of information, but you need to look primarily at wlan0.
It should tell you things like the SSID, the frequency, the bit rate, etc. All of this stuff will be useful in solving the issue.
You can also run:
rfkill list all
The radio frequency kill list will tell you if any of your wireless connections are blocked either by software or hardware. If, for some reason, something is blocked and you want to unblock it, then you can run:
rfkill unblock all
If your WiFi was blocked, it should now be working!
If not, then let’s continue on.
Your WPA Supplicant
The WPA supplicant is a software utility that comes with the Raspberry Pi OS to manage your WiFi connection. And, indeed, it may be the WPA supplicant that’s causing your woes.
What you want to do for this is to open up the terminal and run:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
This will give you an output that looks like this:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=" The name of your network "
psk= the password to the network
}
Double check and make sure everything is in order. If not, then edit either the name or the password (or something in the text description) and hit Ctrl + x followed by y and then hit Enter.
So that’s that for your WPA Supplicant.
If it’s still not working, then you might have a power management problem.
Your Power Management
If your problem is that your Raspberry Pi is connecting properly and THEN losing connection, it might have to do with the power management.
Power management is a utility designed to help the Raspberry Pi maintain energy efficiency. However, this also leads it to weaken the Pi’s WiFi connection.
The solution here is to run:
iwconfig | grep "Power Management"
And if it says Power Management:on, then you’ll need to run
sudo iw wlan0 set power_save off
This will temporarily turn off Power Management. However, if you reboot your Raspberry Pi, then Power Management will return.
So, in order to make this permanent, you need to go to the terminal and type in:
sudo nano /etc/rc.local
Scroll to the bottom and, above “exit 0”, type in the command from earlier:
sudo iw wlan0 set power_save off
Now your Power Management is permanently off and your WiFi connection will be stable.
Your Ethernet Connection
If your WiFi goes out whenever you plug in an Ethernet cable, then the solution is to turn off the background process known as “ifplugd”.
The quickest solution is to just remove “ifplugd” from the Raspberry Pi altogether by running:
sudo apt-get purge ifplugd
Now your Pi should have no problem connecting to internet through both WiFi and Ethernet.
However, you might also have a problem with Bluetooth.
Your Bluetooth Connection
WiFi typically runs at two different frequencies: 2.4 GHz and 5 GHz.
Bluetooth typically runs at one frequency: 2.4 GHz.
So, if you have 2.4 GHz WiFi and Bluetooth running in the same space, you might accidentally cause some interference between the two.
You’ll know what frequency your WiFi is running at if you, as I suggested above, ran:
iwconfig
If it is the case that your Bluetooth and WiFi are causing interference than there are a couple of options.
The easiest would be to move them farther apart.
Another option would be to switch your WiFi frequency to 5 GHz, but that will shrink the range of your WiFi network. So, you’ll need to do that with caution.
There’s always one more place to turn to fix WiFi on your Raspberry Pi.
Your Heat
As with everything on the Raspberry Pi, heat can also affect the WiFi connection.
Indeed, if your Pi is consistently breaking 50° Celsius (122° Fahrenheit), then that could very well lead to problems.
Now, you won’t be surprised to know that we’ve already written a number of articles on ways to keep your Pi cool:
- A Raspberry Pi case that acts as a heat sink
- Raspberry Pi fan pins
- How to check Raspberry Pi CPU temperature
And so you should definitely check those out if you’re looking to cool your Pi down. And that will definitely ensure that your Pi won’t be overheating, destabilizing the WiFi connection.
Conclusion
So there you have it, the ultimate guide to fix all the things that could be keeping your Raspberry Pi from connecting to WiFi:
- Your OS configuration
- Your WiFi configuration
- Your WPA supplicant
- Your Power Management
- Your Ethernet connection
- Your Bluetooth connection
- Your heat
Let us know in the comments below if you have a WiFi issue that we didn’t solve with any of these solutions – this is an ever-expanding list to cover all the possible WiFi issues!
“Проще всего было бы раздвинуть их на большее расстояние друг от друга.”
Кого “их”?
“Всегда есть еще одно место, куда можно обратиться, чтобы починить WiFi на Raspberry Pi.”
А это что за ребус?
Извини! Mне кажется, что это проблема перевода с английского.
1. их = разные устройства, использующие Bluetooth и WiFi
2. одно место = еще одна причина (другими словами, тепло)
Спасибо, я потом и сам понял, что это перевод)
初めまして。
Raspberry PI 4です。買って64Bit版を入れて3日目につながらなくなりました。不思議なのは32BIT版をインストールしても最初からつながりませんでした。基盤(Wifi)チップが焼けたのかもしれないです。
上記どれを試してもダメでした。eth0はつながりますので、有線でやってます。
Salve ho eseguito tutti i comandi e anche se inizialmente la connessione wifi ha funzionato dopo che ho fatto il refresh di Firefox ha smesso da funzionare . potreste aiutarmi ?
Hi I ran all the commands and even if initially the wifi connection worked after I refreshed Firefox it stopped working. Could you help me?
Ich habe alles gemacht und verliere die WLAN Verbindung trotzdem nach etwa einem Tag spätestens.