The new Raspberry Pi 3 offers wireless connectivity over WiFi and BLE. This wiki page is all about setting up your Pi 3 Wi-Fi via GUI and command line, and connecting a Bluetooth speaker to play audio. The same steps will work fine both the previous versions of Pi (Pi 2 and B+), using WiFi/Bluetooth Dongles.
Setting up Wi-Fi via the Graphical Interface
Kindly make sure that you have the latest version of Raspbian OS running on your Pi. You can follow the steps provided in RPi documentation page to complete the installation. if you already have the latest version of the OS then follow the steps, as given here:
Step 1: Scan for available WiFi networks. Goto the top right corner of your RPi home screen (desktop) and click on the network icon to see the list of available Wi-Fi networks.
Step 2: Select your Wi-Fi SSID in the drop down list.
Step 3: You will be prompted to enter your Wi-Fi password into the text box, so go ahead and do so.
Step 4: Finally, click ok and you will be connected to your Wi-Fi. You should now see your signal strength displayed in the upper task bar on the right (Figure 4).
Step 5: You should now be connected to your Wi-Fi successfully; test your connection by opening up the web browser.
Setting up Wi-Fi via the Command Line Interface
This is the method to follow, if you don’t have access to the GUI, if you dont have a display screen and your using serial console cable to command the Pi. No additional software is required; everything is already included on the standard Raspberry Pi image. First thing you need to do is scan for local wireless networks using the command sudo iwlist wlan0 scan . This will list all available Wi-Fi networks including all sorts of other useful information .
Step 1: Locate the name of your Wi-Fi network in the list; this will be listed next to ESSID.
Step 2: Under the ESSID you should also see your authentication method, which could look like the following IEEE 802.11i/WPA2 Version 1. As in this case, the authentication method is WPA2, which is the newer and more secure method; this wiki steps will work with both WPA and WPA2. You will also need the password for your Wi-Fi.
Step 3: Now you need to add your Wi-Fi settings to the wpa-supplicant configuration file. Type the following in the command line to the configuration file: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf. Go to the bottom of the file and add the following Wi-Fi setting, adding your setting in the quotation marks.
Save the file by pressing CTRL+X and then Y on the keyboard and press enter to confirm. At this point, the wpa-supplicant configuration file will normally notice within a few seconds when a change has occurred and it will try to connect to the Wi-Fi network. If the Wi-Fi does not connect then a reboot maybe required with sudo reboot . Once your Wi-Fi has connected successfully you can verify it by typing ifconfig wlan0; if the inet addr field has an IP address in it then it has successfully connected.
Connecting a Bluetooth Keyboard
The best method for connecting a Bluetooth device is using the bluetoothctl command from the command line interface. There is a GUI application called blueman, but this is not stable on the Raspberry Pi and will cause it to crash.
If you are running the latest Raspberry Pi OS, then all the software has already been installed. If not, then you can simply type the following to install the Bluetooth module: sudo apt-get install pi-bluetooth . Once installed, follow these next steps to pair with your Bluetooth keyboard:
- Run the Bluetooth program by typing bluetoothctl.
- Turn on the Bluetooth, if not already on, by typing power on.
- Enter device discovery mode with scan on command if device is not yet listed in devices.
- Turn the agent on with agent on.
- Enter pair MAC Address to do the pairing between devices.
- You maybe prompted to enter a pass code on the Bluetooth keyboard; if so, type this on the keyboard and press enter.
- You will need to add the device to a list of trusted devices with trust MAC Address.
- Finally, connect to your device with connect MAC Address.
Note: For a list of Bluetooth commands type help in the command line.