How To Setup WiFi on Raspberry Pi 3, Setting up a good WiFi network connection on your Raspberry Pi is tricky, especially for beginners. You may need guidance to overcome this connection hurdle like on any new project.
And that's where we at OurPCB come in. Today's article presents five methods to configure your Pi OS or Raspbian boards to a WiFi connection.
First, open a text editor on your computer and paste the following code into it.
Second, replace the <country code>, "YOURSSID," and "YOUR PASSWORD" with your country name, WiFi network name, and password, respectively.
Third, save the file name as wpa_supplicant.conf. Note that the file name should appear exactly as shown.
Fourth, mount your SD into your computer and copy the wpa_supplicant.conf file to the boot partition.
Fifth, if you need to enable SSH automatically, create a blank file named ssh in the same boot partition. SSH is an acronym for secure shell. It enables you to run terminal commands on a Raspberry Pi 2 or 3 from an internet-connected computer.
Set up WiFi on Raspbian Desktop
Fig 2: Robotics using a Raspberry Pi board
Method 2: Configure WiFi using Welcome Wizard
The above method requires a Raspbian desktop connection to set up WiFi wireless on Raspberry Pi 2 or 3. You'll automatically get a welcome wizard message like "Welcome to Raspberry Pi" if you boot after flashing your SD card.
Furthermore, booting will take you to a window that gives you the following options.
First, Select WiFi Network
Second, Select WiFi network from the list.
The process is simple here as you'll select your WiFi network name (SSID) from the list of available networks. Additionally, you'll then wait for some time as the system connects to the network. And that's all it takes to configure WiFi using a welcome wizard.
Method 3: Connecting from the Taskbar
Connecting from the taskbar is effective if it's not your first boot or you missed the welcome wizard. For this method:
First, locate the menu, clock, and shortcuts panel on the top of the display.
Next, locate the network icon at the panel's top close to the clock.
Click on the network symbol, and you'll see a list of available networks.
Finally, select your preferred network and key in your password.
Setting up WiFi on Raspbian Lite
Fig 3: A close-up image of the Raspberry Pi ports
Method 4: Using the raspi-config Tool
A raspi-config tool is suitable for setting up WiFi on the Raspberry Pi OS Lite or Raspbian Lite. The tool is available by default on all Raspberry Pi OS Lite; hence no need to worry if you’ve one.
Here are the steps you'll follow:
First, open the terminal and run the following command.
You’ll see a page with options such as Change User Password, Network Options, Boot Options, etc. Go to Network Options and select WiFi.
Finally, key in your SSID and password and exit the tool after a successful connection.
Method 5: Manual Configuration
Manual configuration is tedious and suitable for connecting to bigger networks that require secure authentication.
In this method, we’ll edit the wpa_supplicant.conf as we did in the first method. You can access the file at /etc/wpa_supplicant/ and edit it using the Nano editor.
Here’s the command you’ll use in the Nano editor.
The command opens the file, and you can access the same content as we’ve seen in the first method. Additionally, if you prefer setting a static IP on your network, perform the configuration in a dhcpcd. Conf file.
Here’s the command to use in opening the file.
Next, you’ll scroll down, locate the “Example static IP configuration” line, and uncomment every line of code you require. Also, change the values and save them.
Finally, reboot your Pi using the following command to reflect the changes.
Test Your WiFi Connection
Check IP Address
Checking the IP address is important to ensure you’ve set up your network connection correctly. First, unplug your ethernet cable to allow and check the IP address using the following WiFi setup command line.
Next to the “inet” text, you’ll see your IP address.
Ping a Website
Afterward, we can check for a successful WiFi connection by pinging a website. To do this, type pingwww.google.com on the command prompt and see if you can get to it.
Raspberry Pi is an excellent board for learners and professionals alike. Hence, I hope you're now familiar with the five methods to establish a WiFi connection. Furthermore, if you're a beginner, use the desktop methods as they're easier.
Besides that, you're good to work on your Raspberry Pi project with WiFi connectivity. Finally, contact us for assistance, clarification, or comments. We'll get back to you as soon as we can.