Connecting Raspberry Pi to a Wireless LAN

Akshul Goyal
2 min readFeb 20, 2021


Second part in my series of posts about my current Raspberry Pi Project

Photo by Gavin Allanwood on Unsplash

Now that you are connected to your Pi using USB Hot-spot, you can do all sorts of things without relying on setting up a dedicated desk including monitor and other accessories.

But using your phone to access Pi and work on it is still not that interactive. Typing in your phone is not a preferable task when it comes to programming.

Let’s setup your Pi to your Wireless LAN so that you can easily do ssh from your already owned Laptop/PC, so that your experience will be hassle-free.

For that you have to connect to your Pi using USB Hot-spot for one last time. Bear it with me —

  1. You need to install wpa_supplicant software.
    sudo apt install wpasupplicant
  2. Now find your wireless interface with
    You should be able to see something likewlan0
  3. Turn on the interface using
    sudo inconfig wlan0 up
  4. Scan for available SSIDs
    sudo iwlist wlan0 scan | grep ESSID
    This should print available WLAN to connect to in your network.
  5. Check the desired WLAN you want to connect and type in this command
    wpa_passphrase <SSID> <password> | sudo tee /etc/wpa_supplicant.conf
  6. sudo wpa_supplicant -c /etc/wpa_supplicant.conf -c wlan0 -B
    This will connect your Pi to the WLAN.
  7. To check if it’s connected to WLAN and get the IP use ifconfig
  8. But if you restart the Pi then you would need to type in the command in step 6. For that type in this command in rc.local
    sudo nano /etc/rc.local
    Add the command at the end. Save and exit. Restart Pi to check the setup.
  9. Now all you need is to open up your laptop.
    Ubuntu — ssh pi@<IP> and type in password
    Windows — Use Putty software to connect via ssh

Next up, we will install a SMTP server in Pi.
Stay tuned!



Akshul Goyal

Hacking the Physical World | Senior Embedded Systems Engineer @ PiRhoAlpha Research (ActiveBuildings) | I write posts about AVR and Raspberry Pi.