Category: Linux
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.

Apr 15, 2015
Update: The Sendy Invoicing add-on has now been added to Sendy’s API docs as a third party resource! View this add-on and other great supporting software at https://sendy.co/api.

Our organization has needed a more user-accessible mass email solution for some time, so when we saw Sendy it was a no-brainer to pick up the dead cheap $59 license and spin up an instance. The whole thing has a minimal, functional, easy-to-explain feel to it and allows the creation of as many “Brands” as needed, each with their own logins, custom templates, custom lists, etc. The sole hangup was that it only supported billing for campaigns through PayPal, and we simply aren’t allowed to accept payment that way.

Internal payments here work through an in-house system and are issued with invoices, which I’ve heard are pieces of paper that people hand to each other and put in things called “filing cabinets.” I needed to figure out a way to do invoicing with Sendy, and I’m happy to say it wasn’t all that difficult.

The resulting Sendy Invoicing add-on, available on GitHub, allows an admin to check a new box labeled “Charge via invoice” under a brand’s payment settings. Users are then shown a customizable, printable invoice when they’d normally be sent to Paypal. Upon accepting an invoice, a copy is emailed to the payee for record-keeping.

A sample Sendy invoice

The whole project plugs right into the Sendy server, and after running an install script that uses a few broad regular expressions to insert two small blocks of code into Sendy’s files, it’s ready to run. Admittedly, it’s not an ideal integration. There isn’t really any plugin architecture or hooks that I could find, so it relies on modifying a couple of the core files, but I tried to make it as minimally invasive, straightforward, and well-documented as possible so that version updates don’t necessarily put it out of commission.

View the project on GitHub and transport your own Sendy server back to the 80s!

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...
Apr 15, 2014

At work I use a Dell Optiplex 7010 with a Radeon HD 7470, which seems to be a very common configuration these days due to volume purchasing discounts.  Lately I’ve been attempting to switch it over to running just Linux instead of Windows 7 with Linux on half the screens in a VM.  The […]

Continue reading...
Fork me on GitHub