Interacting with three OSs simultaneously, using one keyboard and mouse
I’m about to build a computer vision project on a Raspberry Pi 4, and it’s my first time using a Pi. I found the setup instructions on raspberrypi.org to be excellent (much easier than finding the SD card and HDMI adapter my husband had h̶i̶d̶d̶e̶n̶ put away!), though the card that came in the box was bemusing.
Pretty much the second I finished setting it up, I was totally over having an extra monitor, keyboard, and mouse cluttering up my space. So I Googled to see if I could use my Windows laptop as a monitor for the Pi, and found these instructions on using SSH to log in to my Pi from my laptop. Result! But those instructions assumed I would be setting up the Pi from scratch, and wanted me to enable SSH by adding a file to the OS installer. I was already done with the OS installation, so I searched again to see if I could enable SSH post-installation.
The internet came through for me, and I used these instructions to enable SSH on the Pi. Then I went back to the first set of instructions, starting at Step 4: Finding Raspberry Pi’s IP address. This involved installing PuTTY, an SSH client, and VNC Viewer, which allows the user to view a desktop remotely.
All of that went smoothly, and it worked! My laptop displayed the Pi screen, just as the monitor connected to the Pi did, and I could use the laptop’s trackpad and keyboard to interact with the Pi.
Until I unplugged the Pi. When I plugged it in again, PuTTY gave a “Network error: Connection timed out” error when I tried to connect to the Pi through my laptop.
I went back to the original instructions, and decided that the Step 3 I thought I’d worked around — Add Additional File to Enable SSH and Connect to Wifi on Boot — was probably better not skipped. I knew I’d enabled SSH, but I hadn’t considered that the Pi might not connect to Wifi automatically. So I popped the Pi’s SD card back into my laptop to add the files described in the article: “wpa_supplicant.conf” and a blank file named “SSH.”
I didn’t know what my “country code” was in this context, but a Google search yielded this article on setting up Wifi manually on the Pi, and it said the United States country code was “US.” But it also said it was important to make sure to use the Unix line breaks, and it suggested using Notepad++ to do that formatting. So I installed Notepad++, created the two files according to the instructions of the two articles combined, saved these alongside the installer files, then put the SD card back in the Pi. I went through the setup process again from Step 4, crossing my fingers.
It worked! Now I could display the Pi’s screen in the VNC window on my laptop, with no need for the extra peripherals.
Screenshot of Pi screen displayed through VNC Viewer on Windows laptop
But I mainly use a Mac these days, and use the laptop as sort of a secondary display, or to run the odd program that’s better on Windows than Mac OS. I’m still stingy about allocating space for peripherals, though, and I put the laptop on a stand that keeps it at better viewing angle, but makes using the keyboard and trackpad pretty annoying.
So I use Synergy, which allows me to use one keyboard and mouse to interact with both the Mac and the Windows laptop (and now also the Pi!). I have it set to start when I boot both machines, and it works seamlessly. To move its attention from one machine to the other, I just move my cursor to the right edge of my Mac, and it appears on the left edge of the laptop. The keyboard talks to whichever machine the cursor is on, and even the clipboard persists across both devices, so I can copy on one device and paste on the other.
Here they are all together:
Photo of Mac, laptop, and Pi, with keyboard and mouse
Can you spot the Pi? Look closer:
A closeup of the Pi between the Mac and the laptop
I’ll have to move the Pi sometimes when I’m gathering image data for my computer vision project, but I’ll still only need one keyboard and mouse!
Connect with me on LinkedIn, or say hi on Twitter! You can also find me at lauralangdon.io.