How to Setup Raspberry Pi Headless – WiFi
The headless setup using WiFi makes easier to access your Pi than Ethernet setup. It needs an SD card and power supply only. It provides access to your laptop Keyboard, Mouse and Screen to your Raspberry Pi without the need for an external setup.
If you want to access the Pi using Ethernet check this tutorial.
Components Required:
Hardware:
Software:
Steps for Headless Raspberry Pi setup using WiFi:
Step 1:
Flash the Raspbian Image file using Win32 Disk Imager.
Step 2: After flashing open SD Card and Create ‘wpa_supplicant.conf’ file and empty ‘ssh’ file.
Step 3: Now open ‘wpa_supplicant.conf’ file using any text editor and paste the following code.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB network={ ssid="SSID" psk="password" key_mgmt=WPA-PSK }
Modify the “SSID” and “Password” with your WiFi Credentials.
Note: Make sure the “Double Quotes (“”)” are in default notepad fonts. If not sure delete and replace it by yourself manually. Use any text editors like notepad, notepad++ or Sublime Text.
Example:
SSID= "FactoryForward" psk="PiFactory"
Sample Files for Easy Access:
I have attached those 2 files for easier way. Download those files copy and paste it into the SD Card (not inside any folders, paste in home itself).
After the two files are placed, eject the SD Card and insert into the Raspberry Pi.
Set up a Portable Hotspot in your mobile phone with the Network Credentials below
SSID Name – FactoryForward
Password – PiFactory
Now Power ON the Raspberry Pi, wait for few seconds until it boots. In some mobiles you can see the number of devices connected to the Hotspot. If any device is connected then Raspberry Pi is booted successfully and connected to the WiFi.
Important Note: The Laptop and Raspberry Pi Should be connected to the Same WiFi Network (mobile hotspot in our case) for SSH.
Step 4: Wait for 30 seconds until Pi boots up and connects to your WiFi Network. Then open Advanced IP scanner software that you installed on your Laptop. Before that open command prompt and type ‘ipconfig’ to get your IP address range.
Here my router assigned is ‘192.168.43.1’. So the IP address ranges from 192.168.43.0 to 255. So in the search tab put your IP address and remove the last digit range from 0 to 255. See the image below.
Example: 192.168.43.0-255
Then click Scan. This will show up all the devices connected to the router in this range. You can Identify the Pi’s IP by the Manufacturer name. Note down the Pi’s IP address.
Step 5: Now open putty and log in to Pi using Raspberry Pi IP address we found using Advanced IP Scanner. In my case, it is ‘192.168.43.164’
Now the terminal window will open (Click yes on security warning) then enter Pi username and password. The default username and password is
Username: pi
Password: raspberry
After Successful Login type the below command,
vncserver
It will give you the IP address for the VNC Viewer access. You can enter that IP in VNC Viewer to access the GUI Screen.
Another Method without using IP Address (Using Bonjour):
In this method, you need to have Apple Bonjour service software on your computer. If you have iTunes, then Bonjour is installed already. If not, you can download and install it here.
What is Bonjour?
Bonjour is a print service plugin used to search printers on it’s network made by Apple. It is used to map the Pi’s IP address with a hostname called ‘raspberrypi.local’. You can use this on Putty and VNC Viewer instead of IP Address. This eliminates the IP address finding step here.
Step 6: After logging in type ‘sudo raspi-config’ and hit enter.
Step 7: In the GUI navigate to ‘Interfacing options’.
Then navigate to ‘VNC’ and enable it. Click Finish and exit the wizard.
After finishing, type ‘vncserver‘ on the terminal window and hit enter.
Step 8: Now, Open Real VNC Software that you installed and type Pi’s IP address or hostname (if bonjour installed) then click enter.
Example: 192.168.43.164
or
raspberrypi.local
In some cases you might need to add a ‘:1’ at the end of IP or hostname.
Example: 192.168.43.164:1 (or) raspberrypi.local:1
Login with Pi username and password. The default username is ‘pi’ and password is ‘raspberry’.
Accept the security warning. Now the Pi Desktop window will show up. That’s it now you can access your pi over WiFi without cables. Just a power supply is enough.
Comments (4)
Thanks for the tutorial, very useful!
Just a small FYI, there’s a typo just after step 3 where it says “wpa_supplicat.conf”. I copied and pasted this as my file name and got confused when it didn’t work. I added the ‘n’ to my filename and it is working now!
Best regards, Norm
Hey Norm, Thanks for informing the typo. Updated now :)
while connecting the vnc server in raspberry OS, you have to type vncserver then wait for a while. It will display the vnc server details with ip:number. You have to give this info in the vnc viewer as ip:number otherwise it won’t connect to raspberry pi remote screen.
Thank you selvam_e2002, it saved me a lot of time.