A method for controlling a MEMS having a pivotable micro mirror above a substrate, a first and second capacitors disposed between the mirror and the substrate so that as the mirror pivots, an effective air gap of the capacitors changes, the method comprising the steps of:
- defining a deflection angle for the mirror as a set point,
- comparing an actual position of the mirror with a desired position by measuring the difference in capacitances in the capacitors,
- controlling the position of the mirror using sliding mode control to adjust the mirror so that it achieves a desired reflection angle according to the following relationship:
- e(t)=s(t)−u(t)−λ(du(t)/dt)
- where e(t) is the error signal, s(t) is the desired deflection angle, u(t) is the angle readout, and λ is a selected value that varies depending on the position of the mirror.