Arduino open / close control of skylight
I have a skylight that uses a Truth Hardware motor and controller. The controller board failed, and they no longer make this device. I want to build an Arduino system to replace it. I think I know how to design the Arduino interface circuit to use MOSFETs to turn the motor on and off, and drive it up and down.
What I don't know, and need help with, is determining when the window is all the way open, or all the way closed.
I want to use a method that is similar to the Truth controller. After a power failure it had to "re-learn" the open and close limits. It would run the window all the way open, then all the way closed. At the limits you could hear that the motor was under heavy load for a few milliseconds. After this "learn" cycle it would open and close the window as commanded by a toggle switch.
I don't know how the controller detected the limit conditions, but I know that it does not use microswitches. I suspect it monitored the motor voltage somehow, and at the limits the motor binds and acts like a short, so it drew more current and drags the voltage down slightly. When this is detected the motor is shut off or reversed before damage is done. But this is a guess.
I looked over the Truth control board and I see an LM393D - analog comparator. I think this is an Op Amp. I don't know much about these components.
Can someone suggest a schematic for a circuit that could be used for this application?