An apparatus and method are disclosed for optically sensing motion in a microelectromechanical system (also termed a MEMS device) formed by surface micromachining or LIGA. The apparatus operates by reflecting or scattering a light beam off a corrugated surface (e.g. gear teeth or a reference feature) of a moveable member (e.g. a gear, rack or linkage) within the MEMS device and detecting the reflected or scattered light. The apparatus can be used to characterize a MEMS device, measuring one or more performance characteristic such as spring and damping coefficients, torque and friction, or uniformity of motion of the moveable member. The apparatus can also be used to determine the direction and extent of motion of the moveable member; or to determine a particular mechanical state that a MEMS device is in. Finally, the apparatus and method can be used for providing feedback to the MEMS device to improve performance and reliability.