Pages

Saturday, 15 November 2014

C3Pi - Fun and Frustration at the Elephant and Castle

C3Pi from above

I went along this morning to the Elephant and Castle Mini Maker Faire to introduce C3Pi to some of my fellow makers.

The event was extremely well organised and I had no problem finding my desk and setting up. Before long C3Pi was running through his paces - fairly limited at the moment, as he still has no sensors and is controlled by a very simple command line interface.

That's about to change, thanks to Joe Walnes' brilliant websocketd - more details below.

In spite of his limited repertoire C3Pi soon made new friends and performed admirably. It's always a little nerve-wracking when he runs on a desktop. He has been known to get over-excited and career off in unexpected directions, but this morning he behaved himself...

Power problems

... until just before lunchtime, that is.

I'm still not certain what happened, but I think C3Pi's batteries ran low. What I know is that the ssh session connecting my laptop to the Pi suddenly started behaving strangely, and C3Pi's file system was completely corrupted.

There's quite a lot of work needed to recreate the file system and I had to take C3Pi home to repair the damage. Next time I'll prepare and take a backup SD card! I'll also trying out the Pi UPS which is designed to avoid just this sort of problem. By then C3Pi should aslo have a proper web interface.

A web interface using websocketd

I've wanted to provide a web interface to C3Pi for a while, but never got around to it. I am currently experimenting with a browser interface using websockets, based around Joe Walnes' websocketd interface.

websocketd makes it incredibly easy to web-socket enable any program that reads from standard input and/or writes to standard output.

There's an easy-to-follow example in the 10 second tutorial, with more detail in the 10 minute tutorial.

The software is really easy to install. It's a single, small stand-alone executable, with versions available for WIndows, OSX and Linux. The Linux versions include one for ARM processors and websocketd runs well on the Pi.

If you want a really simple way to control or observe stuff via a web browser, take a look at websocketd. Recommended.