Most Raspberry Pi models now come with built-in connectivity options. Raspberry Pi 3, 3B+, Raspberry Pi Zero W, and Raspberry Pi 4 have built-in Bluetooth and Wi-Fi.

This inclusion empowers your projects by eliminating the need for USB dongles and hubs. But how do you set up Wi-Fi on a Raspberry Pi 3 or later? How is Bluetooth connected?

Here’s what you need to know about setting up a wireless network via Wi-Fi and Bluetooth on your Raspberry Pi.

Wi-Fi and Bluetooth on Raspberry Pi 3 and 4

Raspberry Pi 3 is the first version of a computer with a wireless interface and Bluetooth. The next version with these features includes the Raspberry Pi Zero W, Raspberry Pi 3 B+ and Raspberry Pi 4.

With built-in Wi-Fi, Raspberry Pi can easily connect to wireless networks. This greatly expands the connectivity options. Meanwhile, the inclusion of a Bluetooth radio in the Raspberry Pi (Pi 3 has Bluetooth 4.1 BLE, Pi 3 B+4.2 BLE, and Pi 4 Bluetooth 5.0) means you can add any device like a smartphone, TV, or Xbox One controller

Set Up Wi-Fi on Raspberry Pi via Desktop PC

The easiest way to connect your Raspberry Pi to a wireless network is to use a desktop tool. However, this means that you will need to set it up with your keyboard, mouse, and display. An alternative is to first connect an ethernet cable and then connect via VNC or RDP. . Just remember to disable Ethernet when the Pi is connected wirelessly!

To connect to the router, right-click the gray wireless network icon in the right corner of the panel. Choose an option Enable WiFi then select the desired network from the menu.

Enable WiFi on Raspberry Pi

When prompted, enter Pre Shared Key then wait until the connection is established.

Enter the password for your wireless network

You should now be online.

Setting up a wireless network to connect your Raspberry Pi to Wi-Fi

In addition, you can set up a wireless network from the command line. This is a good option if you are accessing your Raspberry Pi over SSH (initially over Ethernet).

sudo apt update sudo apt upgrade 

You have two options for setting up a wireless connection. It may seem that loading in the GUI is easier, but it’s easier to do it on the command line. You should already have an SSID, but if not, use

 sudo iwlist wlan0 scan 

This will show the SSID in the «ESSID» line. Then open wpa_supplicant.conf:

 sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

You will 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 country value accordingly and add the SSID and password for your network.

Use Ctrl + X to exit and save, press Y and Enter for confirmation. Wireless communication should start immediately. If not, use this command to restart the wireless network:

 sudo ifdown wlan0 sudo ifup wlan0 

You can also just log in sudo reboot .

Set up Wi-Fi on Raspberry Pi 3 before downloading

Another option for Wi-Fi on Raspberry Pi 3 and later is to set it up before the first boot. This is possible by inserting a microSD card into your PC’s card reader and navigating to the directory /boot/ . Here create a text file named wpa_supplicant.conf then open it up and add details like you did above.

Save this, close the file, then safely remove the microSD card. Note that the success of this method will depend on your Raspberry Pi operating system. It works with pre-Raspbian Buster operating systems as well as other operating systems. Raspbian Buster has a Wi-Fi driver that prevents the wpa_supplicant.conf file from being used in this way.

Set up Bluetooth on Raspberry Pi 3 and 4

As with Wi-Fi, the software for setting up and connecting Bluetooth is built into Raspbian Buster. For older versions run update and upgrade then

 sudo apt install bluetooth-pi 

Now you can activate Bluetooth from the command line:

 bluetoothctl 

Plenty of options are available with this. Type «help» to see them.

Raspberry Pi Bluetooth Help Commands

For Bluetooth to work, it must be turned on, discovered, and able to discover devices.

To do this, we use three commands:

  1. power on
  2. agent on
  3. scan on

Enable Bluetooth on the command line

On this screen, you can see that the Raspberry Pi has detected my Ubuntu phone. A connection can be established by typing connect followed by the MAC address. If the remote device requires a password, enter it when prompted.

After a few minutes, your Bluetooth connection will be established.

Connect to Bluetooth on your Raspberry Pi desktop

If you prefer to set up Raspberry Pi Bluetooth connections on the desktop, click the Bluetooth icon on the panel. From the menu select » Add Device», to find discoverable devices, select what you want, then » Conjugation», to start the pairing/trust process.

Raspberry Pi Bluetooth Selection Menu

Bluetooth is on and working!

Connect your old Raspberry Pi to Wi-Fi and Bluetooth

If you have a Raspberry Pi 2 or earlier or a standard Raspberry Pi Zero, Wi-Fi is not suitable. Indeed, in the case of the Raspberry Pi Zero, Ethernet is also not suitable. The solution is USB dongles that add Wi-Fi and Bluetooth to the Pi.

Top Wi-Fi USB Adapter for Raspberry Pi

Need to connect your old Raspberry Pi to a wireless network? You’ll need a USB Wi-Fi adapter, but with the limited USB ports on the original models, this can be frustrating. Ethernet may be preferable.

Get a Bluetooth USB Dongle for Raspberry Pi

Bluetooth USB dongles are also available for the Raspberry Pi. However, you may find that you don’t like the functionality of the dongle that you can use with the built-in Bluetooth.

For Raspberry Pi Zero based projects that require Wi-Fi and Bluetooth, you have two options. First, switch to a Raspberry Pi Zero W, which is an incredible value for a computer.

Otherwise, you’ll need to connect standard USB dongles to your Pi Zero using a USB hub with a micro-USB cable. The keys above will work on the Pi Zero with this USB hub.

Wi-Fi on Raspberry Pi 3 and 4 is on!

You should now be working with wireless and Bluetooth on your Raspberry Pi 3 and 4. As with any computer, it’s easy to set up; with some operating systems, you may want to set it up before booting.

Meanwhile, Bluetooth is just as simple and allows you to connect remote controls as well as audio devices. The hardware is solid and the software is 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.

Похожие записи