The tradition of building automata to demonstrate scientific principals dates back as far a Hero's contraptions in ancient Greece. Automata has also been used in conjunction with religious icons, as well as for performing practical work, and simply for fun as toys and novelties.
Many artists have experimented with Automata and Kinetic Sculpture. The best are able to integrate knowledge of basic engineering mechanisms with a keen sense of playfulness and whimsical design to create novel contraptions that are a delight to watch.
Gina Kamenstky's works are among the best that I have seen. Check out her website for an amazing array of devices and be sure to watch the videos!