We present a time-of-flight (TOF) ranging experiment based on optical mixing. The key component in this experiment is the optical (de)modulator. Consequently we also report on the design, fabrication, and characterization of a microelectromechanical system diffractive grating (de)modulator with a subwavelength period. The obtained results are an important step toward an optical mixing based TOF 3-D imaging system, which we will further develop in our future work