This guide shows you how to use your laptop to control your Raspberry Pi. You can skip buying extra display, keyboard, and mouse. I built my own setup and I know it works well. In this post, you will learn how to use SSH, VNC, Ethernet, and USB links.
What You’ll Learn
- How to link via SSH for text control.
- How to view the desktop with VNC.
- How to establish a direct link with an Ethernet cable.
- How to use a USB cable for Pi Zero models.
What You’ll Need
Hardware:
- A Raspberry Pi (any model such as Pi Zero, Pi 3, Pi 4)
- A laptop with internet
- A microSD card (8GB minimum; 16GB is better)
- A power supply for your Pi
- An Ethernet cable (optional)
- A USB cable (for Pi Zero)
Software:
- Raspberry Pi OS installed on the SD card
- SSH client (built into macOS and Linux, or PuTTY on Windows)
- A VNC viewer (e.g. RealVNC Viewer)
- An SD card formatting tool if needed
Basic Knowledge:
- Use of command line tools
- Understanding of IP addresses
Pro Tip: If you are new to this, get the Raspberry Pi Imager from the official site to load the OS onto your SD card.
Method 1: Link Raspberry Pi and Laptop via SSH
This method gives you text control over your Pi. It is simple and fast.
Step 1: Prepare Your SD Card
- Insert the microSD card into your laptop.
- Create a file named
sshin the boot folder. Do not add any extension. - To set up Wi‑Fi, create a file called
wpa_supplicant.confin the boot folder with these lines:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="YOUR_WIFI_NAME"
psk="YOUR_WIFI_PASSWORD"
scan_ssid=1
}
Step 2: Boot Your Raspberry Pi
- Insert the SD card into your Pi.
- Plug in the power.
- Wait about 60–90 seconds for the system to start.
Step 3: Find the Pi’s IP Address
- Make sure your laptop is on the same Wi‑Fi.
- Open Terminal (on macOS/Linux) or Command Prompt (on Windows).
- Run
arp -aor typeping raspberrypi.localto get the IP address.
Step 4: Link via SSH
- In your terminal, type:
ssh pi@<IP_ADDRESS>
Replace <IP_ADDRESS> with your Pi’s address.
- When prompted, use the default password
raspberry. - You will then see a prompt for the Pi.
Step 5: Secure Your Link
- Change the default password by typing:
passwd
- Follow the prompts to set a new password.
Method 2: Link Raspberry Pi and Laptop Using VNC
This method lets you see the Pi’s desktop on your laptop screen.
Step 1: Enable VNC on the Pi
- Use SSH to reach the Pi (follow Method 1).
- Type:
sudo raspi-config
- Select “Interface Options” then “VNC” and turn it on.
- Exit and reboot if requested.
Step 2: Install VNC Viewer on Your Laptop
- Download and install a VNC viewer (e.g., RealVNC Viewer).
- Launch the viewer and prepare to connect.
Step 3: Connect to the Pi
- Open the VNC viewer.
- Enter the Pi’s IP address and connect.
Step 4: Adjust the Pi’s Display Settings (Optional)
- Edit the boot configuration file:
sudo nano /boot/config.txt
Add or modify the following lines to set a virtual display size:
framebuffer_width=1280
framebuffer_height=720
After saving, reboot the Pi:
sudo reboot
Method 3: Ethernet Connection
Step 1: Connect the Ethernet Cable
Plug one end of the Ethernet cable into the Pi and the other end into your laptop or router.
Step 2: Configure the Network (Windows)
For Windows:
- Open the Network and Sharing Center.
- Click your Ethernet adapter and then Properties.
- Choose “Internet Protocol Version 4 (TCP/IP)” and set:
- IP address: 192.168.1.100
- Subnet mask: 255.255.255.0
For macOS:
- Go to System Preferences > Network.
- Select the Ethernet connection.
- Change “Configure IPv4” to “Manually”.
- Set:
- IP address: 192.168.1.100
- Subnet mask: 255.255.255.0
- Click Apply.
Step 3: Test the Connection
- Open a terminal on your laptop.
- Ping the Pi’s IP address to verify connectivity.
Step 4: Share Your Laptop’s Internet (Optional)
For Windows:
- Open Network Connections.
- Right‑click your Wi‑Fi connection and choose Properties.
- Click the Sharing tab.
- Tick “Allow other network users to use this computer’s internet”.
- Choose the Ethernet connection.
For macOS:
- Open System Preferences > Sharing.
- Tick “Internet Sharing”.
- Share from Wi‑Fi to Ethernet.
- Click Start.
Step 5: Connect via SSH (Optional)
- In your terminal, type:
ssh [email protected]
Replace the IP address with the one you configured for your Pi.
Method 4: USB Link (Headless Setup)
Step 1: Prepare the SD Card
- Insert the SD card into your computer.
- Open the
config.txtfile on the boot partition and add the following line:
dtoverlay=dwc2
- Save and close the file.
- Create a file named
ssh(no extension) in the boot partition.
Step 2: Enable USB Gadget Mode
- Edit
config.txtagain and add:
modules-load=dwc2,g_ether
Step 3: Boot the Pi
- Insert the SD card into the Pi and power it on.
- The Pi will appear as a network device on your laptop.
Step 4: Connect via SSH
- On your laptop, open a terminal and type:
ssh [email protected]
raspberry when prompted.Advanced Configuration
Startup Tasks
Create a folder for autostart entries:
mkdir -p ~/.config/autostart
Create a new desktop entry file:
nano ~/.config/autostart/myapp.desktop
[Desktop Entry]
Type=Application
Name=MyApp
Exec=/usr/bin/myapp
Icon=application-default-icon
Terminal=false
Fixed IP Setup
View the current network configuration:
ip addr show
Edit the DHCP configuration file to set a static address:
sudo nano /etc/dhcpcd.conf
Advanced Topics
Startup Tasks
- Create a folder for autostart entries:
mkdir -p ~/.config/autostart
- Create a new desktop entry file:
nano ~/.config/autostart/myapp.desktop
[Desktop Entry]
Type=Application
Name=MyApp
Exec=/usr/bin/myapp
Icon=application-default-icon
Terminal=false
Fixed IP Setup
- Check the current IP configuration:
ip addr show
- Edit the DHCP configuration file:
sudo nano /etc/dhcpcd.conf
FAQs
- Can I use Wi‑Fi instead of Ethernet? Yes, configure
wpa_supplicant.confas shown in Method 1. - Do I need a separate VNC server? No, the built‑in VNC server in Raspberry Pi OS is sufficient.
- What if my Pi doesn’t appear in the network list? Ensure SSH is enabled and the Pi is powered on.