In the first article of this series, we worked on setting up the Raspberry Pi. Also as discussed, we were connected to Pi using LAN cable which reduces the mobility of Raspberry Pi.
Programming on Raspberry Pi with Python: Raspberry Pi Setup
In this article, we will configure WIFI settings so that we can access the Raspberry Pi over SSH from our laptop.
We are using the Raspberry Pi 3 B+ model.
We need to update the WIFI settings to that every time Raspberry Pi is booted, it connects to the available WIFI network automatically.
- Login to your account on Raspberry Pi. If you haven't changed the password, default username and password is available in the previous post.
- Now open the file
/etc/network/interfaces in nano editor. We need to edit it, open it with root permissions. Use below command.
sudo nano /etc/network/interfaces
- Add below lines in the file.
iface wlan0 inet dhcp
wpa-ssid "WIFI NETWORK NAME HERE"
wpa-psk "WIFI NETWORK PASSWORD HERE"
- Update the localization settings to set the WIFI country. Open the file
/etc/wpa_supplicant/wpa_supplicant.conf and make below entries in it.
country=YOUR COUNTRY CODE HERE
Update your country code. For example, for India, it will be
You can enable SSH using one of the methods below. Try and see which one works for you.
- Open the Raspberry Pi configurations using the command
- Select Interfacing Option and then SSH.
- Enable SSH. Save and Exit.
- Create a file name ssh without extension in
/boot partition of Raspberry Pi.
- Use below commands to enable and start the SSH.
sudo systemctl enable ssh
sudo systemctl start ssh
So now we have WIFI configured and SSH enabled. That means next time when Raspberry Pi boots up it will connect to available WIFI network and you can SSH into it. You will not require a LAN cable to connect to it anymore. But....
How do you know the IP address of your Pi after it restarts?
To know the IP address after you are logged in into Raspberry Pi, use below commands.
Now you can SSH into Raspberry Pi using the command
ssh email@example.com and default password.
In the next article, we will create a python script which will run when Raspberry Pi starts and sends the IP address to you on Telegram channel
so that you can SSH into it without the help of external monitor or LAN cable.
Purchase Raspberry Pi Starter Kit Here.