Mechanism for Spectrometer

Input: yellow slider to which large gear of Zy teeth is fixed.
Brown gear of Zb teeth is fixed to bar OC.
Zy = 2.Zb
OA = OB = OC = ED
OE = DC
Angle EOB of green link = 90 deg.
AB: sliding line of the yellow slider.
Red ball represents a light source.
Green rectangle represent a grating.
Orange rectangle represent a detector.
During motion always:
Angle AOB = angle BOC
AB = BC
Angle ACD = 180 deg.
If a mirror is placed at the green rectangle, the orange rectangle can catch the reflected ray of the incident ray coming from the red ball.