The design of a machine which is composed of homogeneous mechanical units is described. We show the design of both hardware and control software of the unit. Each unit can connect with other units and change the connection by itself. In spite of its simple mechanism, a set of these units realizes various mechanical functions. We developed control software of the unit which realizes `self-assembly,' one of the basic functions of this machine. A set of these units can form a given shape of the whole system by themselves. The units exchange information about local geometric relation by communication, and cooperate to form the whole shape through a diffusion-like process. There is no upper level controller to supervise these units, and the software of each unit is completely the same. Three actual units have been built to test the basic movements, and the function of self-assembly has been verified by computer simulation.