A standard edge sensing scheme for optical rotary encoders is to square up the raw analog sine wave by comparing it against a given voltage. If your analog signal has a 2Vpp amplitude, the value at which you switch off of, creating the edges of your square waves, could be...