Connecting Raspberry Pi to a Wireless LAN
--
Second part in my series of posts about my current Raspberry Pi Project
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 —
- You need to install wpa_supplicant software.
sudo apt install wpasupplicant
- Now find your wireless interface with
iwconfig
You should be able to see something likewlan0
- Turn on the interface using
sudo inconfig wlan0 up
- Scan for available SSIDs
sudo iwlist wlan0 scan | grep ESSID
This should print available WLAN to connect to in your network. - Check the desired WLAN you want to connect and type in this command
wpa_passphrase <SSID> <password> | sudo tee /etc/wpa_supplicant.conf
sudo wpa_supplicant -c /etc/wpa_supplicant.conf -c wlan0 -B
This will connect your Pi to the WLAN.- To check if it’s connected to WLAN and get the IP use
ifconfig
- 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. - 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!