A micro-opto-electromechanical systems (MOEMS) device is described. The device comprises at least one anchor on a chip; at least one spring connected to the anchor; at least one proof mass connected to the spring, the at least one proof mass being movable with respect to the chip; a movable optical element connected to the at least one proof mass; a first waveguide connected to the chip, the first waveguide being adapted for receiving light from a light source and a second waveguide connected to the chip, the second waveguide being adapted for operatively coupling to a photodetector and the movable optical element being disposed between the back end of the first waveguide and the front end of the second waveguide.