Whilst diving I was amazed by Xmas-Tree worms which are little worms that live in holes that they have made in the coral. They are filter feeders and to catch food they protrude little colourful fans that look a little bit like really colourful xmas-trees. If you get too close to them the shoot back their feeders into their holes and disappear. I thought that this would be a nice idea for a project to replicate the actions of the worms. Below is an image of my xmas tree worm in the making. When it is complete it will be attached to a sesnor and will spot if people come too near and shoot back in. I might even use it to detect and respond to spatial properties such as noise, motion or even bluetooth reception.

Above shows the mechanism for the worm which is moved with a servo motor. The arduino sketch which controls the motion uses a sensor to determine proximity so if a threshold is crossed it forces a servo to 'pull back'. If there is nothing in the proximity, the threshold is no longer crossed and 'x' time has been passed then the servo moves out again, but very slowly. To see the code click here

Wired up ulrasonic sensor from maxbotix. It is great but a bit noisy when the servo is running. To combat it I have used a smoothing algorithm, which I guess is good for all analog sensors.