Throughout the course of the Microship project, one of the recurring themes has been the choice of a software platform that would allow integration of widely scattered, non-homogenous resources into a comfortable user interface that can manifest itself wherever I happen to be. Over the past decade, this has included a custom multidrop network of 68HC11 boards running multitasking FORTH under a HyperCard front end, NewtonScript talking to Macs via Digital Ocean wireless tools, Perl on a Linux board atop distributed PIC chips, an all-Squeak system with a distributed object model spanning Big Iron and handhelds, and even the dangerously alluring SBNC approach (Simple Boat, No Computers!). All have presented one problem of another, ranging from imminent obsolescence to daunting learning curves.
I know better than to call anything in the software realm a panacea, but I am getting more and more intrigued by VNOS from Singlestep Technologies. From what I’m seeing, it excels at doing what we need to do most often: string disparate resources together, bringing them all into some kind of cohesive front panel (presumably, one that may be echoed on a network-connected device). Of course, any programmer will tell you that you can do anything you need in his or her language of choice, and this is probably true… but I have found that some of the more provocative or popular tools would require me to drop everything and invest the time to become an expert, just to do something simple like inhale a serial port, parse it, and present the results on a meter. Complicating matters, I have good friends who are guru-level practitioners of Smalltalk, Perl, Python, Ruby, Java, C, C++, and FORTH… so most discussions about how to solve Microship design problems end up on religious turf.
What’s cool about VNOS is that it seems to have been intended right from the beginning as a very playful yet powerful form of glue. It comes with “widgets” that know how to do lots of useful things, and you drag them into a window, string them together, and tweak a few options… all while watching the results live. On those occasions when prefab widgets won’t quite do the trick, you can customize your own with regular expressions, math functions, and blocks of Perl or FORTH. What’s really magical is that it’s also very TCP-aware, so it really doesn’t matter if something you’re playing with is elsewhere in the LAN. The whole environment feels like making an animated block diagram of your problem.
Dave Warman, one of the architects of all this, dropped by Sunday night for dinner, homemade wine, and a bit of frolic with an unreleased alpha of the new VNOS version. We decided to solve a typical toy problem in the Microship domain… extracting compass heading from a continuous NMEA stream and turning it into a graphic. The compass is a gimballed flux-gate donated about 10 years ago by Ritchie.
I gave the dusty sensor 12 volts and cobbled together some ancient RS-232 adapters to make it fit a USB-Serial interface, whereupon it immediately appeared as a live serial port on the iBook. I had a moment of deja vu, recalling what it took to take it from there back when I was using the FORTH boards: an extra serial channel with all its configuration and handshaking, interrupt-driven capture into a circular buffer, pointer manipulation, and logic to extract the appropriate stuff between comma (n) and comma (n+1)… with another task grabbing the resulting global variable and handing it off as a string to the console port whenever polled by the hub in response to some distant HyperTalk XFCN. Dave chuckled at this, dragged a few little widgets into a window, and had it working with a live digital readout in about 10 minutes…
You can see the serial port at the left in the screen capture, with an LED to indicate whether or not it is connected in response to the buttons below. That’s piped to a widget that turns the stream of characters into a series of “events.”
NMEA stuff (like what comes out of a GPS) is a succession of sentences at 4800 baud, each beginning with a $ and device identifier, continuing with some variable data according to the sentence type, and ending with a return. In this simple case, all we want is to extract the compass heading, so when it sees a typical incoming sentence like
$HCHDM,147.6,M*2F it needs to pull out the 147 (integral degrees are adequate for now). The trick is a regular expression in the next widget:
\,([0-9]*)\., which returns the numeric value between the comma and the period.
If all we want is a digital readout, then we’re already done. But Dave, with an impish grin, went off to the website of my ex-pal Julie, where he remembered seeing a cute animated GIF of a compass.
While I conjured a pork curry, he deconstructed the GIF with Graphic Converter, named the component images, and whipped up a quick fxthat passes a number from 0 to 31 into a neighboring “LED” widget that’s set to display whichever one of 32 images corresponds to the received value. Voila! Instant animated compass… I wiped the garlic off my hands, walked over, and twisted the sensor around on the table while watching the needle track in real time. Net time investment from soldering on the connector: about an hour.
After dinner, we played a bit with the next level… using a few lines of Perl and the web server built into VNOS to allow a visiting browser to see the current snapshot of the compass heading. That part was easy, although for it to become an animated display without resorting to crude page reloads, there would have to be some browser extension (a Java sandbox, flash player, or separate media stream to a helper app). Still, it only took a few minutes to stitch this into a webbish interface that could be viewed by any computer on the network.
Extrapolating to the full set of Microship interface projects, this is very encouraging… I’m not yet sure that HTML is the ideal UI framework, but it’s certainly a well-understood and standardized set of tools. There is something alluring about the idea of using an off-the-shelf component like a PDA to perform the entire suite of monitoring, control, and communication tasks… I don’t have to build any custom hardware anywhere except at the I/O level!