Category: Raspberry Pi
May 14, 2015

Sometimes you really want to play with a Raspberry Pi, but don’t have a display, keyboard, or mouse handy, and the wifi isn’t configured correctly to just be able to SSH in. Invariably you spend an hour digging around for a keyboard or refreshing a wireless clients list, but this doesn’t have to be the case. After a quick one-time setup, everything you need to use a Raspberry Pi will already be in your pocket.

Android Raspberry Pi display over USBThe idea

Once configured, if you have an Android phone with USB tethering and a cable, you should be well-equipped to use your Pi. Bonus points if you have a bluetooth mouse and keyboard. We’ll be setting up a USB network interface on the Pi and installing a VNC server to pass a session over that interface, thus making your phone a Raspberry Pi display. By the end you should be able to just power up your Pi, plug in your phone, turn on USB tethering, and open up a full desktop.

Setting up the network

Log into your Pi via SSH or open up a terminal in its GUI and pull up your network interfaces.

sudo nano /etc/network/interfaces

Paste the following onto the bottom of the file, then save and exit (ctrl-X, Y):

On your next restart, you should have a new interface when you type ifconfig. We’ve set this interface to have a static IP address, always 192.168.42.42, which you will later use to start your VNC session or connect via SSH on your phone.

Configuring VNC

VNC, or Virtual Network Computing, is a way of sharing a graphical desktop environment over a network, which in this case happens to be your phone’s USB cable. First, we need to install a VNC server onto the Raspberry Pi. We’ll be using TightVNC since raspberrypi.org has a tutorial for it and it’s easy to find help on forums.

sudo apt-get install tightvncserver

Next, use the command tightvncserver to configure VNC for your Pi. It should ask you for a password–be aware that TightVNC will truncate your password to eight characters. It does tell you this in the terminal, but it can be easy to miss and lead to many failed login attempts.

Lastly, we need the VNC server to start up every time the Pi starts so that you really do only need your phone. First, change into your /etc/init.d directory.

cd /etc/init.d

Create a new file called vncboot. You’ll need root privileges to change anything in this directory.

sudo nano vncboot

Paste the following into the file (change export USER=’pi’ to your username if not pi, and edit the screen resolution in the start) block if necessary):

Save this file, then update its permissions:

sudo chmod 755 vncboot

Finally, run the following command to add it to your startup:

sudo update-rc.d vncboot defaults

Reboot your Pi and it should be ready to rock.

Getting connected

Now that one side of your setup is complete, you’ll need a VNC client on your phone. VNC Viewer seems plenty quick for this purpose and you can’t argue with the price. Optionally, you may also download an SSH client like JuiceSSH for those times when a GUI just isn’t necessary.

With your app downloaded, power up your Pi and connect your phone via a data USB cable. As your Pi boots up, you should get a notification that the phone is now connected as a media device. Go into your phone’s settings and turn on USB tethering.

Assuming you’ve given the Pi enough time to boot, you should now be ready to pull up your desktop. Open your VNC viewer app, connect to 192.168.42.42:1 (the :1 is important here), and provide your password. If you just need to SSH, open up your SSH app and connect to 192.168.42.42.

Congratulations! You now have a Raspberry Pi display, keyboard, and mouse even when you don’t physically have those items available.

Feb 14, 2015

Raspberry Pi Kitchen DashboardMy kitchen was missing something. I’d looked at clocks and artwork, but none of the options were simultaneously affordable and nerdy enough for my liking. What I needed was a way to incorporate my love of thrift store finds and coding into something functional, attractive, and unique that would cause my visitors to be delighted and ask questions. As such, the Raspberry Pi Kitchen Dashboard was born.

The dashboard is a $5 monitor from back when 1024×768 was acceptable plus a spare Raspberry Pi. Once the desktop is loaded it opens Chromium in kiosk mode and shows a webpage containing time and weather information. It’s a pretty simple project, but with some very pleasant results–plus, the codebase is documented to hell and back to make it easy for others to add new skins and make some very pretty displays with only HTML and CSS knowledge.

Hop over to GitHub and spice up your kitchen a bit.

Dec 3, 2014

One point that became immediately clear upon running my Raspberry Pi remote control car was that any decent control system needed a way to accommodate new hardware and improved scripting without requiring significant, irreversable modifications to the program. The bot needed a way to accept easily upgradeable bite-size plugins to control things like moving forward […]

Continue reading...
Nov 23, 2014

As part of an ongoing series of improvements to a remote control car I bought at a thrift store, I needed a stream of GPS data from a Sierra Wireless Overdrive Pro 3G/4G hotspot (which, coincidentally, I also picked up at a thrift store). After registering the device with my carrier, logging into the admin […]

Continue reading...
Fork me on GitHub