As I wrote this blog Raspberry Pi exploded on the scene taking everyone by surprise with the sheer volume of people wanting to buy it. Many readers will have to wait a while to get their hands on one so why not use the time to investigate rather more interesting projects than just writing games? How about giving a humanoid walking robot some Artificial Intelligence….
I read an interesting blog post the other day which suggested a world-wide decline in interest in robotics. The writer had arrived at this conclusion by comparing the number of hits on Google for the word ‘robotics’ now, with those obtained a few years ago. There was a large drop. Robotics is a ‘special case’ though because I believe the public fascination with the subject continues unabated and any loss of interest lies with those working in the field. The concept of an artificial human has never lost its grip on the public imagination and science fiction writers have always remained keen to exploit a desire to see man create sentient life.
But surely I’ve drifted off into the world of Artificial Intelligence, away from robotics? That’s the problem: the two are inextricably linked in a layman’s mind because the fictional image is one of a self-aware intelligence in a super-human body capable of working in the worst environmental conditions. In practice, great strides have been made on the mechanical and low-level control side of humanoid robots, but the intelligence, well…. I’m afraid Number 5 still isn’t alive. Artificial Intelligence or AI was The Big Thing in the 1980s and concepts like Artificial Neural Networks promised much but in the end, delivered little. I remember one project involved an ANN ‘looking’ at the video feed from a platform camera on the London Underground. It had been ‘taught’ to generate one of three outputs: platform empty of people, platform half-full and platform full. Interesting, but a long way from the Terminator. AI is still at the stage of requiring vast amounts of computer power to achieve something that starts to look like it might behave like the brain…of an insect. Check out my blog post on project SpiNNaker which will use 1 million ARM-core processors.
The AI is really beyond those with small budgets, although there is plenty that can be done to understand the concepts without breaking the bank. This Elektor book contains practical hands-on introductions to many areas of AI. It’s possible to make some pretty ‘clever’ non-AI hardware though: take the time to watch video clips of robotic footballers at RoboCup competitions. Remember how ‘toy’ humanoid robots moved in a very un-natural way and when they fell or got knocked over they couldn’t recover? Things have changed. What’s more, you don’t need the finances of Sony or Honda to build an impressively realistic ‘walker’ that can cope with uneven surfaces and get up if it does lose its balance. Actually, I enjoy watching them recover after a fall more than watching the game itself. At this level, the ‘intelligence’ generally lacks a learning capability and relies on pre-programmed responses to sensor inputs.
So, if you want to build your own walker, what do you need in the way of hardware? In terms of processor power, a basic microcontroller (MCU) will suffice to get something tramping across the floor. A modern 16 or 32-bit type will have sufficient memory and processing speed to handle both high and low-level functions. An example of a low-level function is a servo motor driver: it will take a high-level command like ‘Rotate 30 degrees’, translating it into the necessary numbers for the PWM unit in the microcontroller. High-level functions combine sensor inputs with a map of the known environment and the mission profile, to produce the appropriate commands to the low-level functions.
As suggested above, for small humanoid robots the best motor to use is a standard RC servo because the joints do not need full 360 degree rotation and most modern MCUs have at least six PWM output channels – one channel per servo. Commercial mechatronics boards usually bring these out to standard 3-pin servo headers.
The next essential device for a walker is a 3-axis accelerometer. Once very expensive these are now very cheap in chip form. Why do you need it? Because that’s how you can simulate human walking by measuring the tilt of the robot body. Also, should it fall over, the robot can work out its position and how to right itself.
So where to start? There are a number of mechatronics boards available that feature the components mentioned above, or have separate plug-in modules for accelerometers. The Cerebot MC7 reviewed the latter in a blog post some months ago, pointing out a few problems, but finding that the free Robot Vision Toolkit and RobotSee programming language worked very well on the mechatronics board.based on a dsPIC33 both have 8 servo connectors and sockets to take their Pmod modules, including an accelerometer. Another option is the Freescale Tower mechatronics board with a Coldfire MCU, 8 servo connectors, touch sensor and a 3-axis accelerometer. Just the job. And if you want a basic set of mechanics to go with it, there’s a robot kit too. I
To take advantage of the Cloud development environment with its free on-line tools offered by mbed then I suggest the Cortex-M3 module (It has six PWM outputs) and a SparkFun ADXL345 accelerometer module. The mbed Cookbook has the software drivers you’ll need for this and a whole range of peripheral devices including RC servos.
Finally, what if you want to implement some really complex algorithms involving some AI? Move the high-level functions to a fast single-board computer (SBC) running Linux or an RTOS and use say, the USB port for command communication with the now low-level processor. Researchers in robotics often use a notebook computer for this task, although that may be a bit bulky for a small walking robot. There are plenty of suitable SBCs on the market such as BeagleBoard and the new Raspberry Pi.
If you're stuck for something to do, follow my posts on Twitter. I link to interesting new electronics components and development kits and retweet posts I spot about robot, space exploration and other issues.