if you have a raspberry pi 3, wifi is built into the pi, if you have a pi2 or earlier then you will need a wifi dongle. you can check if your wifi dongle is compatible here. you may want to use wifi usb dongle, then check here.
note: to use wifi on the raspberry pi, you will first need to set the wlan country via raspi-config. it’s in the 5 localization options menu in raspi-config. you can start raspi-config from the retropie menu in emulationstation or from the command line with sudo raspi-config.
there are 5 main methods to configure wifi:
- wifi module
- connect to wifi without keyboard
- manual configuration (interfaces)
- manual configuration (wpa_supplicant)
you can access this from the retropie menu in emulationstation (you can also access it from option 3 in the retropie config script):
will open in this menu:
choose your ssid from a list:
Type your Wi-Fi password (you may have to wait a bit after you’re done for the settings to save)
after you’re done configuring, you should see your wifi information in the original menu:
connect to wifi without keyboard
if you want to connect to wifi without the need for an additional keyboard, you can add a file to the boot partition of the sd card called wifikeyfile.txt
put your network details here (note only works on wpa networks)
You can then access the wifi module and select the option to “import wifi credentials from /boot/wifikeyfile.txt”
connect to wifi without keyboard
starting with raspbian stretch, there is no need to load the wifikey file from the installation script.
Create a file called wpa_supplicant.conf on the boot partition using the following template. (this will be moved on boot to the /etc/wpa_supplicant directory).
make sure to include the retropie config… lines as shown to ensure that the retropie-setup wifi configuration module can cleanly edit/remove your configuration if you want to change it later.
wifi will not start if you have a wired ethernet connection. after unplugging the ethernet cable, you will need to reboot for wifi to start.
If you want ssh to be enabled by default as well, you can also create a blank file called ssh on the boot partition. this is a ‘flag’ file and will be removed on boot after ssh is enabled.
manual configuration (interfaces)
sudo nano /etc/network/interfaces
You can also add wireless shutdown at the end if you’re having trouble turning your wifi dongle on and off and can’t maintain a connection.
the following only applies to raspbian jessie
you can use the default /etc/network/interfaces, then you’ll need to edit /etc/dhcpcd.conf and add it to the top modifying it for your own router and ip address:
if you want a static ip with ethernet, change it to:
restart sudo for the changes to take effect.
upon reboot (if configured correctly), your wifi will be working.
manual configuration (wpa_supplicant)
taken from the raspberry pi foundation here:
This method is suitable if you don’t have access to the graphical user interface normally used to configure wifi on the raspberry pi. It’s especially suitable for use with a serial console cable if you don’t have access to a wired ethernet network or display. Also note that no additional software is required; everything you need is already included in the raspberry pi.
getting network details
To scan for Wi-Fi networks, use the command sudo iwlist wlan0 scan. this will list all available wifi networks along with other useful information. watch out for:
essid:”test”. this is the name of the wifi network.
ie: ieee 802.11i/wpa2 version 1. this is the authentication used; in this case it is wpa2, the newest and most secure wireless standard that replaces wpa1. this guide should work for wpa or wpa2, but may not work for wpa2 enterprise; for wep hex keys, see the last example here. you will also need the password for the wifi network. for most home routers, it’s on a label on the back of the router. the essid (ssid) for the network in this case is testing and the password (psk) testingpassword.
add network details to raspberry pi
You’ll first need to modify /etc/network/interfaces to point to wpa-supplicant if it isn’t already:
We’ve changed it to wpa-roam so it will reconnect if the connection is dropped.
open the wpa-supplicant configuration file in nano:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
go to the end of the file and add the following:
the following are different ways to configure your network depending on the encryption your router is configured with.
now save the file by pressing ctrl+x then y, and finally press enter.
at this point, wpa-supplicant will typically notice a change has occurred within a few seconds and attempt to connect to the network. if not, manually reboot the interface with sudo ifdown wlan0 and sudo ifup wlan0, or reboot your raspberry pi with sudo reboot.
you can check if it has connected correctly using ifconfig wlan0. if the inet addr field has an address next to it, the pi has connected to the network. if not, check that your password and essid are correct.
Note that this may cause a small amount of cpu usage in the background, which may prevent the cpu from scaling to the lower frequency.
You must first install it with sudo apt install wicd wicd-curses and then type wicd-curses in the terminal to open it.
(of course you will need to be connected via ethernet to install)
navigate to your wireless network and press the right arrow to configure your wifi
check automatically connect to this network (by pressing enter) and type your wifi password where it says “key” press f10 to save then press shift+c to connect and press q to return to terminal.
There are some issues noted with the daemon using some cpu and preventing pi from scaling to the lower frequency, so if that’s the case you can remove wicd-curses by typing sudo apt remove wicd-curses and proceed to configure your wifi using method 2 or 3.
you might want to use an external wifi dongle – maybe your pi case is blocking or slowing down the signal (with a metal case it’s quite common) for example.
The easiest way is to first configure wifi with the internal driver, using one of the methods above. plug in your dongle, reboot and make sure it’s connected using ifconfig – it should show up as wlan1 and have an ip address. then disable built-in wifi by editing /boot/config.txt and adding dtoverlay=pi3-disable-wifi. that’s all 🙂