2.Headless Setup - NaimFuad/RaspberryPiWithOpenCV GitHub Wiki
If you dont have an external display to be connected to the Raspberry Pi, you can simply use this headless setup in order to setup your Wifi credential and get connected to the Raspberry Pi desktop environment through SSH connection or VNC for desktop.
Prerequisite
- Text Editor - Notepad++
- VNC Viewer - Real VNC
- SSH Client - Putty
- IP Scanner - Advanced IP Scanner
Steps
- Download and install Notepad++
- Plug in SD Card to PC
- On SD card create a blank file and name it as wpa_supplicant.conf
Right click > New > Text Document > delete name including .txt extension > rename it as wpa_supplicant.conf
- Open the file using Notepad++
- Copy the following into file and rename the ssid and psk
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>
network={
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
}
- Create a blank file and name it as ssh (without any extension)
- Remove SD Card from PC, plug it to Raspberry Pi and boot your Raspberry Pi
- Find the IP adress of your Raspberry Pi.
IP address will change every time the device is rebooted. You can set a fixed IP address, but this will be out of scope for this guide.
If you are using Android Device Hotspot, make sure you check the ‘Number of Connections Allowed’ is set to 2 or more. Once Raspberry Pi connected to your hotspot, click on the device connected named as ‘raspberrypi’ and copy the IP address.
If using home network Wi-Fi or tethered using Ethernet cable download, install, and launch Advance IP Scanner, scan network IP range and find Raspberry Pi named as ‘raspberrypi’ and copy the IP Address.
- Create SSH connection. Download and launch Putty. Paste the IP Address on Host Name blank, set port to 22 and choose SSH connection and open the connection. Instead of putting IP Address you can also type raspberrypi. Login as pi and password as raspberry
10.Install VNC Server
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt install realvnc-vnc-server realvnc-vnc-viewer
- Enable VNC on Raspberry Pi
$ sudo raspi-config
Navigate to Interfacing Options. On VNC option choose Yes
12.Connect to Raspberry Pi from PC to Raspberry Pi Using VNC Viewer. Download, install, and launch VNC Viewer on Laptop. Insert the IP Address on VNC Viewer and login as pi and password as raspberry
IP address will change every time the device is rebooted. You can set a fixed IP address, but this will be out of scope for this guide. Instead, create an account for VNC and link all your devices.
If you are in campus, remote access using VNC will only work if both devices are connected in the same network. i.e Laptop and Raspberry Pi to your hotspot. If your laptop connected to eduroam but your Raspberry Pi are connected to your hotspot, it will not work.