I have been using a Robofocus focus controller for many years now to control a Robofocus geared stepper motor on my various imaging telescopes. It has been a good solution that I have adapted to Newtonians, SCTs, refractors, and even SLR lenses. The one downside is that the Robofocus controller is a bit on the expensive side. For someone starting into imaging with a limited budget it is alot to spend over $300 for a focuser controller.
Fortunately there have been many individuals who have explored using an Arduino with one of the many low cost stepper controller boards to build a focus controller. In my case I was most intrigued by this website:
The author had written an Arduino sketch that emulated the serial protocol used by the Moonlite ASCOM driver. This meant you just had to program your Arduino board with his code and the official Moonlite ASCOM driver would attach to your Arduino and "just work". This alleviated the need to construct a custom ASCOM driver.
I started with the code from the above website and made the following changes:
I added support for the TMP36 so I could have a temperature reading from the focuser. This can be used to track when you might need to refocus as the temperature changes.
The rotary encoder support was so I could manually focus the telescope. I set it up so one step on the rotary encoder moved the stepper on the focuser by one step. I'm still experimenting with this as that seems to give almost too fine of control. I need to try it when I am imaging planets or the Moon as that is where I thought manual control would be most beneficial.
Here is a list of the hardware I used:
Here is a picture of one I made for a friend (this one doesn't have the rotary encoder):
Note about wiring the stepper motor - the stepper I am using is a bipolar stepper. I wired one arm of the stepper across the M3 motor port and the other arm across the M4 motor port. I ran the four wires from these two motor ports to the pins 1-4 of a female DB9 connector. This makes it compatible with the cable that came with my Robofocus controller and I can plug my Robofocus stepper motor straight into the box with no problems.
I need to clean up the source code but I will put that up as soon as I have it like I want it.