An optical encoding apparatus for the detection of position and/or motion of a mechanical device includes a codescale, an encoder housing having one or more portions and a light-detecting sensor embedded within the encoder housing, wherein the light-detecting sensor is capable of sensing a pattern produced by the codescale superimposed on the light-detecting sensor, and wherein the light-detecting sensor includes a two-dimensional array of light detection elements having dimensions n-by-m where n and m are both integers greater than 4.