Most Raspberry Pi models now ship with on-board connectivity options. The Raspberry Pi 3, 3B+, Raspberry Pi Zero W, and Raspberry Pi 4 all feature built-in Bluetooth and Wi-Fi.
This inclusion extends the possibilities for your projects, saving you from relying on USB dongles and hubs. But just how do you set up Wi-Fi on a Raspberry Pi 3 or later? How does Bluetooth connect?
Here’s what you need to know about setting up wireless networking via Wi-Fi and Bluetooth on Raspberry Pi.
Wi-Fi and Bluetooth on the Raspberry Pi 3 and 4
The Raspberry Pi 3 The Raspberry Pi 3: Faster, Better, with Wi-Fi and Bluetooth The Raspberry Pi 3: Faster, Better, with Wi-Fi and Bluetooth Today, the Raspberry Pi foundation announced the release of the Raspberry Pi 3. It's the most significant update to the popular line of low-cost computers yet. Read More is the first version of the computer to have on-board wireless and Bluetooth. Subsequent version with these features include the Raspberry Pi Zero W, the Raspberry Pi 3 B+, and the Raspberry Pi 4.
With Wi-Fi built-in, the Raspberry Pi can be easily connected to wireless networks. This enhances connectivity considerably. Meanwhile, including a Bluetooth radio on the Raspberry Pi (the Pi 3 has Bluetooth 4.1 BLE, the Pi 3 B+ 4.2 BLE, and the Pi 4 Bluetooth 5.0) means you can add any device, such as a smartphone, a TV, or an Xbox One controller
Set Up Wi-Fi on the Raspberry Pi via Desktop PC
The easiest way to connect your Raspberry Pi to a wireless network is to use the desktop tool. However, this means that you will need to set it up with a keyboard, mouse, and display. The alternative is to first hook up an Ethernet cable, then connect via VNC or RDP How to Run a Remote Desktop on Raspberry Pi with VNC How to Run a Remote Desktop on Raspberry Pi with VNC What if you need access to the Raspberry Pi desktop from your PC or laptop, without having to plug in a keyboard, mouse and monitor? This is where VNC comes in. Read More . Just remember to disconnect Ethernet when the Pi is connected wirelessly!
To connect to your router, right-click the grayed-out wireless networking icon in the right corner of the panel. Select the option to Turn on Wi-Fi, then select the desired network from the menu.
Input the Pre Shared Key when prompted, then wait for the connection to be established.
You should now be online.
Configure Wireless Networking to Connect the Raspberry Pi to Wi-Fi
Alternatively, you can set up wireless networking in the command line. This is a good option if you’re accessing your Raspberry Pi using SSH (initially over Ethernet).
sudo apt update
sudo apt upgrade
You have two options for setting up a wireless connection. It might seem easier to boot into the GUI, but it’s more straightforward to do it in the command line. You should already have your SSID name, but if not, use
sudo iwlist wlan0 scan
This will reveal the SSID in the line “ESSID”. Next, open wpa_supplicant.conf:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
You’ll need to add or edit the following:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="SSID"
psk="PASSWORD"
key_mgmt=WPA-PSK
}
Take the time to change the value for country as appropriate and add the SSID and password for your network.
Use Ctrl + X to exit and save, pressing Y and Enter to confirm. Wireless connectivity should start immediately. If not, use this command to restart wireless:
sudo ifdown wlan0
sudo ifup wlan0
You could also simply enter sudo reboot
.
Set Up Wi-Fi on Raspberry Pi 3 Before Booting
Another option for Wi-Fi on the Raspberry Pi 3 and later is to configure it before the first boot. This is possible by inserting the microSD card in your PC’s card reader and browsing to the /boot/ directory. Here, create a text file called wpa_supplicant.conf then open it and add the details as you did above.
Save this, close the file, then safely eject the microSD card. Note that the success of this method will depend on your Raspberry Pi operating system. It works with pre-Raspbian Buster OSs, as well as various other operating systems. Raspbian Buster has a Wi-Fi driver that prevents the use of a wpa_supplicant.conf file in this way.
Configure Bluetooth on the Raspberry Pi 3 and 4
As with Wi-Fi, the software to configure and connect Bluetooth is built into Raspbian Buster. For older versions, run update and upgrade, then
sudo apt install bluetooth-pi
You can now activate Bluetooth from the command line with:
bluetoothctl
A host of options are available with this. Type “help” to see them.
For Bluetooth to work, it needs to be enabled, discoverable and capable of discovering devices.
We use three commands to do this:
power on
agent on
scan on
In this screen, you can see the Raspberry Pi has detected my Ubuntu phone. A connection can be made by entering connect, followed by the MAC address. If a passcode is required on the remote device, enter this when prompted.
Moments later, your Bluetooth connection will be established.
Connect to Bluetooth on the Raspberry Pi Desktop
If you prefer to setup your Raspberry Pi Bluetooth connections on the desktop, click the Bluetooth icon in the panel. In the menu, select Add Device to find discoverable devices, select the one you want, then Pair to begin the pairing/trust process.
Bluetooth is up and running!
Connect an Older Raspberry Pi to Wi-Fi and Bluetooth
If you own a Raspberry Pi 2 or earlier, or a standard Raspberry Pi Zero, Wi-Fi is not an option. Indeed, in the case of the Raspberry Pi Zero, Ethernet is not an option either. The solution is USB dongles that add Wi-Fi and Bluetooth capability to the Pi.
Top USB Wi-Fi Dongle for Raspberry Pi
Need to connect your older Raspberry Pi to a wireless network? You’ll need a USB Wi-Fi dongle, but with limited USB ports on the original models, this can be frustrating. Ethernet might be preferable.
Raspberry Pi USB Wi-Fi dongle Raspberry Pi USB Wi-Fi dongle Buy Now On Amazon $7.99
Get a USB Bluetooth Dongle for Raspberry Pi
USB Bluetooth dongles are also available for the Raspberry Pi. However, you may find that you won’t enjoy the functionality from a dongle that can be enjoyed with integrated Bluetooth
USB Bluetooth dongle USB Bluetooth dongle Buy Now On Amazon $13.95
For Raspberry Pi Zero-based projects requiring Wi-Fi and Bluetooth, you have two options. The first is to switch to a Raspberry Pi Zero W, which is incredible value for a computer.
Raspberry Pi Zero W Raspberry Pi Zero W Buy Now On Amazon $21.99
Otherwise, you’ll need to connect standard USB dongles to your Pi Zero using a USB hub with a micro-USB cable. The dongles above will work on the Pi Zero with this USB hub.
Pi Zero USB hub Pi Zero USB hub Buy Now On Amazon $6.99
Wi-Fi on the Raspberry Pi 3 and 4 Is Enabled!
You should now be up and running with wireless and Bluetooth on the Raspberry Pi 3 and 4. As with any computer, it is straightforward to set up; with some operating systems, you can configure it before booting.
Meanwhile, Bluetooth is just as simple, and allows remote controls to be connected, as well as audio devices. The hardware is reliable and the software uncomplicated. And if you’re using an older Raspberry Pi, these features are also available via USB dongles.
If you haven’t already, here’s why you should try the new Raspberry Pi 4 Why Everyone Should Try the Raspberry Pi 4: New Features and Impressive Specs Why Everyone Should Try the Raspberry Pi 4: New Features and Impressive Specs Interested in buying the Raspberry Pi 4? Here's what's new, as well as why three versions of the Raspberry Pi 4 are available. Read More .
Explore more about: Bluetooth, DIY Project Tutorials, Raspberry Pi, Wi-Fi.
Just nudging this thread awake again...
I've been bouncing around from site to site trying to get this working. Not sure if I have a damaged pi or what the problem is. Pretty much every one (obviously) has the same basic instructions and I've followed them to a T. Rechecked my steps. Rechecked everything again, (rinse & repeat)...but I still can't connect.
Wireless says it's working on the pi after setup but when I unplug the ethernet cable, I get nothing and my wired connection in my network list goes dark with no replacing wireless connection.
I appear to have the same problem with Bluetooth, although it did say it was connected to my PC at the end of the setup but then the connection disappeared.
I now get this in my service status:
Mar 04 03:17:08 octopi bluetoothd[680]: Starting SDP server
Mar 04 03:17:08 octopi bluetoothd[680]: Bluetooth management interface 1.14 initialized
Mar 04 03:17:08 octopi bluetoothd[680]: Sap driver initialization failed.
Mar 04 03:17:08 octopi bluetoothd[680]: sap-server: Operation not permitted (1)
Mar 04 03:56:11 octopi bluetoothd[680]: a2dp-sink profile connect failed for "MyPC": Protocol not available
Mar 04 03:56:11 octopi bluetoothd[680]: a2dp-source profile connect failed for "MyPC": Protocol not available
Mar 04 03:56:36 octopi bluetoothd[680]: a2dp-sink profile connect failed for "MyPC": Protocol not available
Mar 04 03:56:36 octopi bluetoothd[680]: a2dp-source profile connect failed for "MyPC": Protocol not available
Mar 04 04:03:02 octopi bluetoothd[680]: a2dp-sink profile connect failed for "MyPC": Protocol not available
Mar 04 04:03:02 octopi bluetoothd[680]: a2dp-source profile connect failed for "MyPC": Protocol not available
I don't even know what this means and probably says the answer right there but I don't know how to fix it. I'm now drinking copious amounts of rum (medicinally-for my nerves from dealing with this issue of course) and this is just getting harder so I'm calling it quits for tonight. Maybe tomorrow I can look at this again through hangover fogged eyeballs and it will become clear (doubt it), or some kind soul will have the answer for me and become my brand new favoritest person in the whole world.
I'm using a Pi3 and have installed both bluetooth and Wifi. Wifi works fine and bluetooth works 100% with BUT ONLY if wifi is switched off. With wifi on bluetooth disconnects from the keyboard sporadically - bluetooth keboard is pure frustration unless wifi is off.
That sounds very annoying. Is yours a recent device or an older Pi3?
The Pi3 was purchased 11/2016. The bluetooth keyboard works fine as long as wifi is off. wifi on results in frequent and random disconnects that require the keyboard to be switched on/off to reestablish connection. Others have reported this problem as well.
Yeah, I've heard of others having the issue, wondered if it was a batch problem.
R-pi3b, trying to access wirelessly via a Mac computer.
Ran through the setup instructions as described above to try to access the pi , but I'm not showing the Pi connected to my router unless I plug the ethernet cable in. No Wifi.
If I connect the ethernet cable, the pi does seem to see my network: when I try "ssh pi@octopi.local" i am connected to the pi. Issuing the "sudo iwlist wlan0 scan" command does show my network, with info on signal strength.
When I disconnect the Ethernet cable, I can no longer connect to my pi, and checking the router DHCP list there is no connection from my pi (it shows up as octopi.local when the Ethernet cable is connected).
Any thoughts?
Have you tried a full update, or a fresh install? Possible the Wi-Fi driver isn't installed.
I finally figured it out. I had edited the SSID and password using the Mac's TextEdit program. It turns out this program substitutes a different kind of quotation mark than the ones the Pi is looking for if you type the quotes in by hand, or even if you edit the text right next to them (the wrong quotation marks appeared "curly"). I could not figure out how to get my Mac to type the correct kind of quotes. I ended up copying the correct type of quotation marks from an unedited part of the file and pasting them in around the SSID and password in place of the curly quotation marks that had appeared.
I've since found out you can turn off this annoying behavior in TextEdit: Go to the TextEdit menu and choose Preferences. Select "Plain Text", and turn off "Smart Quotes" & "Smart Dashes"
Good advice, great to see you've sorted it out!
Tried using a 'Microsoft Designer Mouse' - this will pair but a message we get is there are no services for this device. Bluetooth BLE devices have a problem connecting. Tried with Ubuntu Mate, Windows 10 IOT and Jessie. Not much use contacting Microsoft - they are not interested, their BB is full of people with this problem even with Windows 10 grrrrrrrrrrrrrrrrr
Ahh, that's sad to hear -- always seems the way with the Microsoft support forums.
I just went through the process for setting up the Wi-Fi and all went well. It took a few seconds for the Wi-Fi connection to show up but then I was immediately able to disconnect the ethernet cable. I didn't try the Bluetooth set up because I don't have a Bluetooth device but will bookmark this for later.
Thank you for the easy to follow instructions!
Gary
Happy to help Gary, thanks!
Every time I try to connect my phone, the terminal says "Failed to connect: org.bluez.Error.Failed" and on my pi is says that I have "no usable services" on my device
I cant connect to any wifi on rpi3b using ubuntu mate. Simply the SOs dont detect any wifi networks, while my cellphone detects 18.
How does it fair with Raspbian? Checking that will determine whether you've got a suspect wireless radio.
That sounds like a BT driver issue, *or* the BT hardware has failed. My first Pi3 had working BT and Wi-Fi for about a day before it stopped working. You should probably contact the vendor to arrange a replacement.