Skip to content

Headless Raspberry Pi: Using Xojo and your Raspberry Pi without a display

You don’t need to hook up your Pi to a physical display, keyboard and mouse. You can set up VNC on the Pi so you can remotely connect to it.

My Raspberry Pi 2 sits on my desk next to one of my speakers. It’s not hooked up to any display. I use a combination of SSH, SFTP and VNC when I need to work with it.

To connect to the Pi, I just need its IP address, which currently is 10.0.1.11. I leave the Pi on all the time, but if I reboot it then the IP address could change since I have not set it up with a fixed IP address. To identify the IP address, I run the utility LanScan (free on the Mac App Store) which shows me all the IP addresses of everything on my local network. The Raspberry Pi is clearly identified.

LanScan.png

I can then connect to the Pi via ssh:

ssh pi@10.0.1.11

I’m prompted for the password, which I’ve left at the default (“raspberry”).

If I am only going to be running Xojo console apps, then this is all I need. You really only need to set up VNC if you want to access the Desktop so you can run Xojo desktop apps (or use the Pi UI to run other desktop apps).

Personally I do like using the Pi desktop, so I now need to start the VNC server, which I have previously installed. If you need to install it, easy VNC installation steps are at the official Raspberry Pi site.

At the ssh terminal, I start VNC using its defaults with this command:

vncserver

After typing this command, I’m back at the terminal prompt. Use the “exit” command to disconnect from the ssh connection.

Terminal.png

Now I can connect to the Pi using a VNC client. I’m going to use the client that is built into OS X since it is always available and reasonably fast. In Finder, select Go->Connect to Server from the menu. In the window, enter the address and port for the VNC server and click Connect:

vnc://10.0.1.11:5901

VNCViewer.png

You’ll again be prompted for your password. This is the password you set up when you installed TightVNC, not the Raspberry Pi password.

When everything connects you’ll get a window displaying the Raspberry Pi desktop, shown here running the XojoNotes example app:

PiDesktop.png

But how do you get apps to the Pi so you can run them? I use SFTP. There are many SFTP tools available. I primarily use ForkLift and ExpanDrive, but other apps have also been recommended on the Xojo forum. Regardless of the tool you use, create a new SFTP connection and enter the same credentials you used to connect via ssh.

You’ll now have access to the file system on the Pi and you can drag files from your computer to the Pi’s file system, which will copy them across your network to the Pi. With ExpanDrive, I get a drive mounted to the Finder that is connected to the Pi, making access to the Pi always available.

ExpanDrive.png

Want to learn more? Come to XDC to hear me talk about Raspberry Pi: The Ultimate Gadget.