Active control of a diffraction grating interferometer for microscale devices