Adafruit Bluefruit LE Micro into Wowwee Robosapien

I bought an Arduino Micro for a project a little while ago, found it easy to develop with and wondered where else I could use one. There are two Robosapiens in our house, so one of them went under the knife for a brain transplant. I chose an Adafruit Bluefruit LE Micro this time, so I could disconnect the USB cable and control the Robosapien over Bluetooth.

The Robosapien’s getting on in years and resources explaining what’s inside it are disappearing from the WWW. Markcra’s Robosapien pages are an invaluable starting point, though I never did find a complete list of pinouts for the U2 controller IC. Here’s the list I used while adding the wire extensions for the prototyping board:

U2 pin Connected to
P10 IR
P11 Finger/toe/heel switches left
P12 Grip switch left
P13 Shoulder switch left
P14 Finger/toe/heel switches right
P15 Grip switch right
P16 Shoulder switch right
P17 Microphone
P30 Grip motor open left
P31 Grip motor close left
V01 Speaker
V02 ?
P32 Shoulder motor left
P33 Shoulder motor leftexpecting to be able to
P34 Grip motor open right
P35 Grip motor open right
P36 Shoulder motor right
P37 Shoulder motor right
P40 Waist left
P41 Waist right
P42 Leg motor left
P43 Leg motor left
P44 Leg motor right
P45 Leg motor right
P46 ?
P47 ?

“Left” and “right” are from the Robosapien’s point of view. With 31 lines of I/O before any enhancements might be considered, I had to add some extra I/O in the form of 2 MCP23S17 SPI I/O Expanders. The Bluefruit LE Micro uses SPI to communicate with its Bluetooth module, so adding the MCP23S17s was straightforward. I failed to get a single CS (Chip Select) line to work with HAEN (Hardware Address ENable) set on the MCP23S17s, but one CS pin on the master per MCP23S17 works a treat.

Prototyping board close up

Prototyping board close up

The Arduino code is very simple – it reads a character from either the USB serial port or the Bluetooth UART into a command buffer. ‘Commands’ on the modified Robosapien are trivial – motors and LEDs can be turned on and off,  delays of 0-999ms can be inserted and triggers for low/high on the switches can be waited for. For example, “s+” is “left shoulder up”, “S-” (lower/upper case for left/right!) is “right shoulder down”, “w0” is “waist motor off”. “L=” is right leg motor ‘brake’ (high signal to both sides of motor driver, though the brake effect is very weak). “e000” is all LEDs on. “e255” is all LEDs off. There are 8 LEDs. “W500” inserts a delay of 500ms before the next command is executed. “tb1” is “trigger when left button signal is high”. “q” turns off all motors.

Behaviour Send text string
Funky walk w+W300s+S-l-L+w-W360s-S+l+L-w+W360s+S-l-L+w-W360s-S+l+L-w+W360s+S-l-L+w-W360s-S+l+L-w+W360s+S-l-L+w-W360s-S+l+L-w+W360s+S-l-L+w-W360s-S+l+L-w+W360s+S-l-L+w-W360s-S+l+L-w+W360l0L0s0S0W500q
Turn in place w+l+L-W075l-L+W075w-W075l+L-W150l-L+W075w+W075l+L-W150l-L+W075w-W075l+L-W150l-L+W075w+W075l+L-W150l-L+W075w-W075l+L-W150l-L+W075w+W075l+L-W150l-L+W075w-W075l+L-W150l-L+W075w+W075l+L-W150l-L+W075q
‘High’ kick w+h+H-s+S+W999W600qS-tS1S=l-W999W150L+W150L-W150L+W150L-W150L+W150L-W150L+W150L-W150L+W150q

Source code for Arduino IDE is here: robosapienarduino.tar.gz

While the brain transplant is a success, losing the behavioural repertoire and vocalisations means there’s plenty still to do to return the Robosapien to full health. It being an old (nearly ten years?) toy, I’m wary of physically modding it further – such as adding contact sensors to its feet – and using it more in case I break its mechanisms.

The Robosapien has lived up to its claims of “made to be hackable”, but PCB-hacking is fraught with dangers. I’d like to see “made-to-hack” toys have their toy-behaviour controllers on pluggable daughter boards, exposing well-documented headers for owners who want to try their hand at brain surgery.

Having successfully operated on one patient, I’m looking forward to using the Adafruit Bluefruit LE Micro on new candidates… and there’s an unloved, apparently-hard-of-hearing Zoomer in the toy cupboard downstairs. “Zoomer! Here boy! Whassis? Screwdriver! Roll over!”

Add a search engine to Ubuntu Touch browser

You can’t add search engines with the browser GUI, perhaps because Ubuntu Touch is a Work-In-Progress and it’s still early days. Adding search engines to browsers still has patchy support from major browsers, even though the OpenSearch standard is donkey’s years old. I installed Ubuntu Touch on my Nexus 4 after experiencing the “Sleep Of Death” too many times and wanted to use my Firtl search proxy in Touch’s browser.

I located the configuration files (they’re OpenSearch XML description documents, which is handy!) by using grep -r to search for one of the existing search engine names. The search engine description documents are located (on my phone) in


The / filesystem appears to be mounted read-only and must be remounted read-write to make changes. I did this with the command

mount -o remount,rw /

Copy your search engine’s OpenSearch description document into this directory and next time you attempt to set Ubuntu Touch’s web browser’s search engine, you should see the new search engine in the list. Don’t forget to remount / read-only.

Happy Searching!

Parametric 3D printer designs with OpenSCAD

xyzprintingdavinci1.0I bought an entry-level 3D Printer from PrintME3D recently – an XYZprinting DaVinci 1.0 and I’m impressed. I’ve printed nothing fancy – mostly brackets, clips, motor couplings and a few replacement parts for toys and tools.

I’ve been using OpenSCAD and wanted to  put my simple designs online. Some of my OpenSCAD designs might be useful for other people but with different dimensions, so I made a simple parameter form for each design with a preview image to show the effect of changes.

The preview image is linked to a simple 3D viewer powered by JSC3D, which uses STL produced on the server using the modified parameters from the form. The images are of an adjustable, flexible clip-on bracket to hold a rear mudguard in place with an M5 bolt on a Giant MTX bicycle belonging to my daughter.


OpenSCAD rendering of one half of symmetrical adjustable rear mudguard bracket


JSC3D interactive rendering of STL file

The XYZPrinting DaVinci 1.0 is great for an entry model 3D printer, once Repetier (so it can be used with a Linux PC) has been installed and trial-and-error has established good temperatures for the bed and extruder and levelled the bed. After producing many satisfactory-to-good prints, I find it occasionally goes through bad patches of the first layer not adhering to the bed. If poor adhesion happens in only one small patch, it’s not always fatal for the print. I suspect occasional poor adhesion is due to the bed going out of level, possibly due to the vigour with which I remove the previous print’s baked-on glue.

Validating host names – top level domains (TLDs)

For a recent project I needed to update a hard-coded list of TLDs. Keeping it fresh seemed like a good idea, so I took IANA’s list of TLDs (IANA TLDs also available as text here) and made a little API service to provide the data in different formats:

ICANN provides the TLDs in upper case, but the Firtl API lower-cases them for convenience.

Generating coloured-in election map images with SVG

The Election Boundary Map generator in Firtl’s sandpit will attempt to match a text data file with an SVG image of the UK (actually only Great Britain since Northern Ireland is not on the Ordnance Survey map) showing political constituencies. Simply upload a text file with two fields on each line. The first field should be the name of the constituency, the second a numeric value such as a percentage. Separate the two fields with a space.

A coloured map will be generated to reflect the value in each constituency. The colours are drawn from a red-green-blue spectrum from 0 to 100%, or 0 to the maximum value found in the file if the “Stretch values” checkbox is set. Constituencies for which no matching name is found in the uploaded file will be left uncoloured.


The map images are available in PNG, JPEG and SVG. Here are PNG examples of the percentages of votes cast for some of the better-known options at the 2010 General Election, in alphabetical order:











Liberal Democrat


Plaid Cymru





The SVG maps were generated from data from the Ordnance Survey’s OpenData Boundary-Line product (sorry, can’t give a direct in-page link as OS’s HTML is broken). I used the free QGIS mapping application to export SVG from the OS data, but had to edit QGIS’ SimpleSvg plugin to embed constituency names from the ‘Attribute Table’ to allow more straightforward colouring of the map.

The data I used to colour the maps I found by visiting and following the link to the Electoral Commission’s General Election 2010 Results Data (sorry, no direct in-page link as the Electoral Commission’s HTML is insufficiently marked-up).

The electoral data is in one great Excel file (why not an open format?), which I transformed into individual files for upload to my map generator. Here are the files:

election2010bnp election2010conservative election2010green election2010independent election2010labour election2010libdem election2010plaidcymru election2010snp election2010ukip