Content Creation

How to Connect Your Raspberry Pi to a Display and Use SSH to Remotely Connect to Your Raspberry Pi

120 views
1 Comment

One of the first steps in setting up your Raspberry Pi is connecting it to a screen. This allows you to view the Raspberry Pi OS desktop environment and to enable remote connection. Remote connection with Secure SHell (SSH) is a convenient way to access your Raspberry Pi without connecting it to a monitor. This is easiest to do if you’ve already set up your display, although it is possible to enable SSH without it. Sections 2 and 3 will outline connecting via SSH both with and without a display. 

This article assumes that you have already installed Raspberry Pi OS onto your Pi. The easiest way to do this is with the graphical SD card writing tool developed by Raspberry Pi called Raspberry Pi Imager. You will also need to connect your Raspberry Pi to WiFi. While two options for this (ethernet and wireless) are briefly discussed in this tutorial, it is not the main focus. 

NOTE: All of these sections involve making changes to Raspberry Pi Settings. Make sure you save your changes before you remove your SD card! 

Section 1: Connecting to a display

Section 2: Connecting With SSH Using a Monitor

Section 3: Connecting With SSH Without a Monitor

Section 1: Connecting to a Display 

What you’ll need: 

  • HDMI connection cables*
  • A display 
  • A keyboard and mouse

*For newer Raspberry Pis, you’ll need to connect a micro HDMI to the receiving port of your display. This can be an HDMI, DVI, or VGA port. You might need to use an adapter. If you have an older Raspberry Pi, you’ll need to use HDMI instead of micro HDMI for the output.  

NOTE: Depending on the OS that you’re using, you might be able to skip steps 1 and 2, and just power on the Raspberry Pi with the SD card and HDMI setup to immediately connect to the display. 

  1. First, you’ll need to insert the Raspberry Pi’s SD card into the computer so that you can make some changes to the config.text file used at the time of booting. 
  2. Open the config.text file and remove the # symbols on the two lines of code containing “#hdmi_force_hotplug=1” and “#hdmi_drive=2.” This enables the code, which allows output and sets the screen resolution. Save the changes before removing the SD card. 
    1. You can also change the screen resolution by editing the lines “#hdmi_group=1” and “#hdmi_mode=4.” Replace them with 2 and 16, respectively.
  3. Prior to connecting to a display, you’ll need to insert the SD card and turn on the power supply of your Raspberry Pi. 
  4. Then, you’ll connect whichever HDMI cables you chose above. You should see the interface on your monitor!

Section 2: Connecting With SSH Using a Monitor 
  1. Connect your Raspberry Pi to the same WiFi network as your remote computer. You can do this by connecting an ethernet cable to your router, or wirelessly: 
    1. Use Raspberry Pi Imager to set up the WiFi. Navigate to Advanced Options from the Imager’s home screen via CMD + Shift + x (or Ctrl + Shift for Windows). Check the “Configure WiFi” box and enter the credentials. 
  2. Open a command line. This is the terminal in Mac, and can be found under Utilities or by Spotlight searching with command+spacebar and searching “terminal.” In Windows, this is called Command Prompt, and can be found under Start → Command Prompt. 
  3. Enable SSH on your Raspberry Pi. Click on the Raspberry Pi Menu on your monitor and navigate to Preferences → Raspberry Pi Configuration → Interfaces → Switch to Enable SSH. Save and restart your Raspberry Pi. You can also use the Advanced Options section (discussed in Step 1) to check the Enable SSH box and enter the corresponding authentication information. This process is the main difference between connecting with a monitor and connecting without, as it can also be done using the command line, which will be discussed in Section 3. 
  4. In the command line, connect using the ssh command. If you’re using Raspbian, you’ll type in “ssh pi@raspberrypi” because raspberrypi is the default hostname. You can also replace “raspberrypi” with the IP address or whatever hostname you are using. 
  5. Enter your password when prompted. The default is “username: pi and password: raspberry.” If you receive any host warnings about authenticity, just click yes to continue connecting. It will not happen after connecting for the first time. 

Section 3: Connecting With SSH Without a Monitor 

The main difference with this method is that you will not be able to enable SSH using the interface. You will also have to insert the Pi SD card directly into your computer if you don’t have the capabilities to connect the Pi to the monitor. 

  1. Insert the Pi SD card into your computer. 
  2. Enable SSH. If the ssh file already exists, then it means ssh is already enabled upon booting the Pi. Otherwise, complete the following steps:
    1. Open a command line. This is the terminal in Mac, and can be found under Utilities or by Spotlight searching with command+spacebar and searching “terminal.” In Windows, this is called Command Prompt, and can be found under Start → Command Prompt.
    2. Find the boot directory. Use bash command “cd” to navigate into /Volumes/boot. 
    3. Create an ssh file using “touch ssh”
  3. Switch the SD card back into the Pi. 
  4. Once you boot your Pi, you will be able to connect via SSH as long as the Pi is connected to WiFi! (See step 1 in section 2 if you need assistance with WiFi connection.) 

If you have questions about any of these processes, feel free to comment on this post!

Ad Below Helps Fund This Site

Share:

Author

YouTube
Discord
Twitch
Instagram

More Similar Posts

1 Comment. Leave new

You must be logged in to post a comment.
How To Add J Cuts And L Cuts To Your Filmmaking Toolkit?
How To Start Streaming On Youtube Using OBS Studio
Most Viewed Posts
Share This Post
Ad Below Helps Fund This Site
Menu