MIT's 'Smart Sand'

BBC News - Self-sculpting sand robots are under development at MIT

Tiny robots that can join together to form functional tools and then split apart again after use might be ready for market in little more than a decade, according to researchers.
A team at the Massachusetts Institute of Technology says it has developed about 30 prototype "smart pebbles" and the software to run them.

Self-sculpting sand - MIT News Office

Imagine that you have a big box of sand in which you bury a tiny model of a footstool. A few seconds later, you reach into the box and pull out a full-size footstool: The sand has assembled itself into a large-scale replica of the model.
Unlike many other approaches to reconfigurable robots, smart sand uses a subtractive method, akin to stone carving, rather than an additive method, akin to snapping LEGO blocks together. A heap of smart sand would be analogous to the rough block of stone that a sculptor begins with. The individual grains would pass messages back and forth and selectively attach to each other to form a three-dimensional object; the grains not necessary to build that object would simply fall away. When the object had served its purpose, it would be returned to the heap. Its constituent grains would detach from each other, becoming free to participate in the formation of a new shape.

DRL - Robot Pebbles

Each programmable matter pebble is a 12mm per side, and together they are able to form complex 2D shapes using four electropermanent magnets able to hold over 80 times the individual module weight. The pebbles are formed by wrapping a flexible circuit around a brass frame. An energy storage capacitor hangs between two tabs occupies the center of the module.

To form shapes through subtraction, modules initially self-assemble into a close-packed block of material (a). Once this initial structure is complete, and all modules are fully latched to their neighbors (b), the modules not needed in the final structure detach from the neighbors (c). Once, these extra modules are removed, we are left with the final shape (d).