A process for forming complex microelectromechanical (MEM) devices having five layers or levels of polysilicon, including four structural polysilicon layers wherein mechanical elements can be formed, and an underlying polysilicon layer forming a voltage reference plane. A particular type of MEM device that can be formed with the five-level polysilicon process is a MEM transmission for controlling or interlocking mechanical power transfer between an electrostatic motor and a self-assembling structure (e.g. a hinged pop-up mirror for use with an incident laser beam). The MEM transmission is based on an incomplete gear train and a bridging set of gears that can be moved into place to complete the gear train to enable power transfer. The MEM transmission has particular applications as a safety component for surety, and for this purpose can incorporate a pin-in-maze discriminator responsive to a coded input signal.