Friday, May 10, 2013

Quick hint for Beaglebone Black user

A little while ago we announced the arrival of the BeagleBone Black development board.  It's the Arduino-like board that gives you a full Linux computer for $45.  I've been playing with one in my spare time for the last few days and I have discovered a neat trick.  I hope to have a full review at a later date.

The BeagleBone Black and Raspberry Pi and other such development platforms are very powerful, and it is amazing that they are essentially stand alone computers for under $50.  However, they suffer from being so gosh darn small that just the cables required to connect them up can be overwhelming.  With the BeagleBone  you need to connect power, Ethernet, HDMI for the display, keyboard and mouse (usually via a USB hub) if you want to see the full glory of the graphical user interface on the BeagleBone.  All these wires detract a bit from the beauty of a device that can fit inside an Altoids mint container.  Meanwhile, my much less powerful Arduino just hangs off a single USB connection, beautifully simple in its single umbilical configuration.  Why do these more powerful boards have to come with so much complexity?  There must be a better way.

Too many cables!

One really nice feature of the BeagleBone Black is that when you plug it in to your computer via USB, in addition to getting power from your computer, it also connects as a disk drive and a network connection so that you can load required software from it and communicate with it for control.  That started me thinking.  I use other Linux computers remotely via a protocol called Virtual Networked Computing (VNC).  It allows me to open a remote desktop on the Linux box in a window on my laptop.  Why can't I do the same thing with the BeagleBone so that I don't need all those wires?   It would allow me to get rid HDMI display connector (since I would use my computer's display) as well as the USB keyboard and mouse (for the same reason).   It even frees up the USB port so that I can connect a USB WiFi dongle to get a network connection.  I've certainly used VNC on BeagleBone and Raspberry Pi before over WiFi or Ethernet, but what is different here is using the virtual network connection of the BeagleBone power/USB connection so that I can get rid of wires.  If I can get that working, I'm back to a single cable connecting the BeagleBone to the laptop and I'm good to go with all the graphical power of this beast..  Well, it turns out you can do this and here's how.

First, you'll need to install the VNC server on your BeagleBone Black.  Get all your cables connected so that you can boot it up with a good network connection and type these commands to the terminal:

opkg update
opkg install x11vnc

It should go through a few steps and then eventually tell you that the software has been installed.  Next you'll want to start up the VNC server.  This is the tricky bit because of the way the X Window system works, if you don't open it from within a window session, you need special authorization to connect.  The following line figures that authorization out for the default Ångstrom Linux version that ships with the BeagleBone Black.  Other versions may have a slightly different command.  In Angstrom, type this to the command line:

x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0  -forever

Now all that is left is to go to your computer (that the USB cable is connected to) and run your favorite VNC client.  I use the old standby Chicken of the VNC on the Mac, but there are plenty of others.  Connect to and you should be able to see and control your BeagleBone GUI from your computer.... without all the wires.

The BeagleBone screen shows up in a window on my Mac screen
This is a pretty simple little trick but it can make development much more convenient.  You just need the BeagleBone Black and one cable.  I haven't tried this with other operations systems, the original BeagleBone, but with appropriate drivers, it could be possible there as well.  I don't think this is possible on the Raspberry Pi because their is no USB device side connection.

No comments:

Post a Comment