The Easy Way to Connect Your Raspberry Pi to WiFi

Learn how to connect your Raspberry Pi to a wireless network in just a few simple steps! This article will show you everything you need to know about setting up WiFi on your Raspberry Pi. …


Updated October 4, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to connect your Raspberry Pi to a wireless network in just a few simple steps! This article will show you everything you need to know about setting up WiFi on your Raspberry Pi.

To connect a Raspberry Pi to WiFi, follow these easy steps:

  1. Requirements Before we begin, make sure that you have the following items:
  • A Raspberry Pi (any model will do)
  • An SD card with a working Raspbian OS installed (you can download Raspbian from here)
  • A WiFi adapter or built-in WiFi (for newer models of the Pi)
  • A wireless network with an internet connection
  • A monitor, keyboard, and mouse (if you want to use a desktop environment)
  1. Boot up your Raspberry Pi Insert the SD card into your Raspberry Pi and connect it to power. If you’re using a desktop environment, plug in your monitor, keyboard, and mouse.

  2. Open the terminal Open the terminal application on your Raspberry Pi (for desktop environments) or use ssh to access the command line from another computer.

  3. Update your system Run the following commands to update your system:

sudo apt-get update
sudo apt-get upgrade
  1. Install WiFi tools Install the necessary packages for connecting to WiFi:
sudo apt-get install -y wpasupplicant wireless-tools
  1. Find your WiFi network’s SSID and security type First, use the following command to scan for available networks:
sudo iwlist wlan0 scan

Look for your network’s SSID (the name of your wireless network) in the output. Note down the ESSID value and the security type (WPA2, WEP, etc.).

  1. Configure WiFi settings Create a new file called wpa_supplicant.conf using your favorite text editor (e.g., nano):
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following content to the file, replacing <SSID> with your network’s SSID and <PASSWORD> with your WiFi password:

network={
    ssid="<SSID>"
    psk="<PASSWORD>"
    key_mgmt=WPA-PSK
}

Save the file and exit the text editor.

  1. Enable WiFi at startup Edit the dhcpcd.conf file to enable WiFi at startup:
sudo nano /etc/dhcpcd.conf

Add the following line to the end of the file:

interface wlan0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Save the file and exit the text editor.

  1. Reboot your Raspberry Pi Reboot your Raspberry Pi with the following command:
sudo reboot now

After the reboot, your Raspberry Pi should be connected to the WiFi network! You can verify the connection by running ifconfig and checking for an IP address under wlan0.