4. Using SSH
note
If you didn't start with the preconfigured micro SD card image and already have SSH enabled on your Pi, you can skip to connecting your RVR+/RVR to Pi.
What is SSH?
SSH, or Secure Shell Protocol, is a way of securely accessing the terminal (where you enter commands) of another computer remotely over a network. (That's a simplification - for more details, check out the wikipedia article)
Why use it?
While carrying an extra keyboard, mouse and monitor around with you can make you look cool and important 👩🔬, one of the great things about the Raspberry Pi computer is that it can be accessed remotely from another device on the same network (via SSH). This means that you can drive your RVR+/RVR around in style with an entirely wireless setup (aside from the cables connecting your RVR+/RVR to your Raspberry Pi)! 😎
Since RVR+/RVR is primarily a mobility platform for your projects, we strongly recommend setting this up to avoid the hassle of extra cables.
Why wouldn't I use it?
In some cases, SSH will not be a useful and/or available option for you to use:
- If your network administrator has blocked SSH. (This can be an issue in schools)
- If you prefer to do all your development directly on the Raspberry Pi without a separate computer.
How do I set it up?
SSH is disabled by default in the Raspberry Pi OS. You have two options for enabling it.
Option 1: Use the Raspberry Pi Configuration Menu
- Open the Raspberry Pi Configuration from the Preferences menu in the upper left corner of the screen.
- Select the Interface tab.
- Toggle the SSH radio button to Enabled.
- Click OK.
Option 2: Use the raspi-config command.
- In the terminal, enter
sudo raspi-config
. - Select Interfacing Options.
- Select SSH.
- Select Yes.
- Select Ok.
- Select Finish.
note
Enabling SSH requires you to reboot your Raspberry Pi. Go ahead and do that now if you haven't already.
For more information on SSH, review the official Raspberry Pi Secure Shell access tutorial.
Once SSH is configured, you just need to send a few commands for the connection to go through and you'll be able to control your Raspberry Pi-controlled-RVR+ or RVR from your laptop, desktop, or other device!
Getting your Raspberry Pi IP Address
You'll need the IP address of the Raspberry Pi to SSH into it, so the next thing we'll need to do is gather that information. Get the IP address of the Pi by jumping into its terminal and entering:
hostname -I
Your IP address is often the same, especially as long as you stay on the same wifi network, but it can change, so, if you are having issues connecting, you can run the above command again (from the Raspberry Pi, with a monitor/mouse/keyboard plugged in) to check if there have been any changes.
Try out an SSH connection
tip
It's a good idea to test the SSH connection (in the terminal on your desktop/laptop) and make sure that it works before completely abandoning your Raspberry Pi's monitor/mouse/keyboard setup.
On Remote Computer
The device you want to use to control the RVR+/RVR must be on the same wifi network as your Raspberry Pi. On your laptop/desktop/etc., open the the terminal and use this command to access your Raspberry Pi. Make sure to replace "ipaddress" with the IP Address of your Pi.
ssh pi@ipaddress
Once you run this command, you'll be prompted for the password to your Raspberry Pi. For security, you'll get no indication that your password is being typed as you type it.
note
If you have installed a new Raspberry Pi OS and have previously used SSH you may encounter an error at this step. Try regenerating your SSH keys with this command.
ssh-keygen -R ipAddressOfYourPiHere
You should now get a success message and be able to work in the terminal to control your Raspberry Pi the same way you could when you had a monitor plugged into it.
Type the following command to shutdown your Raspberry Pi and get ready to connect it to RVR+/RVR in the next step.
sudo shutdown now
warning
You should try to always shut down your Raspberry Pi properly before removing power (unplugging it or turning off a RVR+/RVR that is powering it). SD card corruption may occur if your Pi is not shut down properly.
Next!
Now that you've set up SSH on your Pi, let's make sure your Pi and your RVR+/RVR are properly connected and working together.