I have a spectrometer that is basically a diffraction grating driven by a stepper motor. I am controlling it with an Arduino UNO that sends off a pulse train, each pulse moves the grating by some fixed amount. I keep track of the number of pulses and relate that to the position of the grating. The Arduino remembers the position of the grating the last time I turned it off so that the next time I turn it on, it can be driven from that known position onward.
The problem is that sometimes I forget to turn on the spectrometer and the Arduino would start sending pulses and increasing the position counter without actually moving the grating. The whole system is then messed up.
I could go into the spectrometer and solder two wires in order to get a DC voltage signal. But spectrometer is somewhat expensive and would like to avoid hacking into it. Are there any better ways?
FYI, here is a video of the scanning grating: https://youtu.be/e_cCWV18UQ0