Caenorhabditis Elegans (C. Elegans) Nematode Project
This project started with a couple of less than perfect hardware experiments but ended with some software fun.
Without easy access to a 3D printer or even a laser cutter I am usually confined to using “off the shelf” boxes or serendipitous finds to house or support my projects. I can manage a bit of woodwork but this is usually at a “macro” scale (as examples, I reroofed our house and built a lapstrake canoe) and this makes me wary of attempting fine detail. I know I thought, “I will try Perspex”. A bit of online shopping took me to acetate sheet and I quickly ordered a sample.
I had a couple of continuous servo motors sitting in my “bit box” and had in mind to use as the basis for a lightweight robot chassis. Then addition of a couple of wheels and a small ball castor looked likely to make a good trial for an acetate sheet platform base.
A laser cutter would be great for acetate sheet as I quickly found out. It can be cut by scoring with a Stanley knife and snapping over an edge in a similar manner to glass cutting. It can be drilled with care but gluing calls for a polychloride glue that takes hours to set. I am sure that with enough time and patience I could have built up a composite base using layers of acetate sheet but I have to confess that I ended up with a “bodge”. The original plan to trial building a lightweight robot meant I was using an Arduino Nano and the low power requirements of the servos allowed me to use a 9v PP3 battery as an external power source. The initial trial sensor was a very cheap ultrasonic rangefinder board.
As a proof of concept for the continuous servo motors this was acceptable. All I have to do now is find a way of stacking and mounting the components to achieve a smaller overall package.
However, after a very simple test program confirmed that the motors could be happily driven together using the Arduino Servo.h library I put some though into how to get this little device trundling around the room without too much intervention. I remembered reading about a project that used an artificial neural network to simulate some of the behaviours of a nematode worm.
Caenorhabditis elegans is a free-living, transparent nematode about 1 mm in length that lives in temperate soils. This short lived but easy to study nematode has been widely used in research labs since the sixties. In 2012 C elegans became the only animal to have its entire connectome mapped – this is the only creature where we have a complete neural wiring diagram. This includes all of the connections between the 302 neurons and their interaction with the 95 muscle cells. TheOpen Worm project intends to build a complete simulation of the whole organism.
With a less ambitious aim than the Open Worm group, Nathan Griffith posted a project to GitHub for the C software supporting a simulation of the C elegans neurons controlling a robot and running on an Arduino. Compressing the connectome into a program that requires only 13,542 bytes of program space with global variables taking up just 825 bytes of SRAM is impressive. The short video of his Nematoduino robot navigating a room and responding to a barrier is also impressive.
The artificial neural network takes selected input from code running the ultrasonic rangefinder and runs a simulation of that stimulus through the neurons. Output values are collected from neurons that would (in viva) be connected to the worm “neck” muscles and used to control two motors running them independently at different speeds forward or reverse.
This was clearly just the thing for my bodge of a robot. I needed to adapt the motor control code for the simpler requirements of the servo motors and could not help making a few other small changes. However, the code is essentially the code I downloaded from GitHub. Does it work? Well yes it does. Disarmingly well, considering that there are no procedural rules ("if this, do that") in play – just stimulation and response through a set of weighted connections. This is clearly an area for further development although artificial neural networks make big demands upon memory and increasing demands upon processing power as they grow. Shoehorning a small network onto an Arduino Nano worked well but any next step presents greater challenges.
If you fancy giving this approach a try then you can download the code from GitHub or grab my small modifications from the website supporting my book “Practical Arduino C”. My code can be downloaded from the web site projects page.
Artificial Neural Networks (ANNs) are an active area of research and the founding technology for a great deal of the Artificial Intelligence (AI) projects and start-up businesses today. I had some instructional fun a few years ago building an ANN to play an acceptable game of noughts and crosses (tic tac toe) with some success although I don’t recall my model ever beating a trained simulation of Donald Michie’s MENACE“machine”.
ANNs started out as an attempt to model the function of brain neurons and later developments in the techniques has seen success in diverse AI areas such as computer vision, speech recognition and board game play. The big challenge in trying to model animal brain activity (with human brain activity as the ultimate goal maybe) is one of scale. While our little nematode has only 302 neurons, animals needing greater neurological support rely upon vastly greater numbers. However the huge numbers of neurons are dwarfed in turn by the numbers of connections between them. These connections being continuously laid down within an active brain.
Outside of some research labs, almost all ANNs are run on digital computers while animal brains are essentially analogue. Connections between brain neurons may run at varying speeds (due to their type and length) but they can all run as and when they are stimulated and multiple signals can arrive at any given neuron from a range of sources simultaneously and/or in a meaningful sequence. This is impossible to achieve using a digital computer which is incapable of managing more than a few parallel processes. Even when an ANN is scaled up to run on a large cluster of computers the achievement is dwarfed by the parallel processing capacity of even a simple animal brain.
So there we have the challenge. I love the idea of building new ANNs to tackle robot tasks but in the short term I need to switch to a more robust and stable hardware chassis. Anyone up for an Arduino cluster?
Last 2 pics just to show I can work OK even if only at a larger scale. Honest.