New control box for a focus rail with many other options

I have now completed the new control box for the focus rail that I described how to build in a post I made a year or two ago. Actually, the new control box is capable of a great deal more than controlling a focus rail. The current version is set up to control three motors so that the X, Y and Z position of the camera/object can be set in 3D space. Thus, the control box can be used for both Z stacking and stitching images. Further, the number of motors can easily be expanded to 5 allowing control of rotation in 2 planes with the object of making macro stereo photographs. The box includes 8 opto-coupled outputs arranged to allow the triggering of 4 cameras/flashes (only 4 because 2 outputs are used per camera to activate pre-focus and the shutter). Unused at the moment, but already incorporated, are 8 analogue/digital  inputs that could either be used to trigger motor movements, or allow cameras and flashes to respond to external events, or one or more could be used to stop the motors when a limit is reached.


Rotary encoder controlled camera mover controller with the focus rail described in an earlier post

The menu system is driven by a rotary encoder and incorporates a ‘click sensitivity’ option that allows the encoder to increase any variable by between 1 and X for each rotational click. The use of the encoder provides for a much more responsive and versatile interface than a button pad. There is a switch to turn off power to the motors that is useful both when testing, to prevent heating of the motor, and also as an emergency stop! An LED indicates when the motor is active and there is an external button to reset the microprocessor. I have used an Arduino Mega 2560 because it is significantly more capable than an Uno. Further expansion would not be a problem bar finding room in the control box and having the abilities of a spider where routing the wiring is concerned. EasyDriver boards ( control the motors and commercially available opto-coupler boards are used for the flash and camera output control signals. In theory, the design  could easily be used to control a pan and tilt system for hyper-resolution photography and/or virtual 3D. The programming leans heavily on an interrupt-based encoder library that enables the encoder to be read while the sketch is busy doing other things (see The current sketch is about  600 lines including comments etc.

The approximate cost of all the hardware, assuming a Mega clone such as a Funduino is employed, is about £35. Because all the components are available as finished boards, the only difficult things are the point-to-point wiring between them, and between the boards and the sockets etc. Mostly, the wiring can be done using Dupont  jumper cables.

The little video of the prototype below shows the bare bones of the project in action. The mechanics of the X&Y axes have yet to be constructed – they could simply be repeats of the design I published earlier but my intention is to motorize an old microscope mechanical stage and incorporate on it a rotary table rather like the one I also described in a previous post. When I am happy with the code, I will publish the sketch that will control the mechanical gubbins. Meantime, it functions very well as an alternative to the push-button control box that I made for my focus rail.

By way of cheering up those, including myself, that make stupid mistakes, the reason the control box is shown powered from both a USB input and an external power supply, is because I blew the Arduino’s external psu circuitry by connecting its 5V output to the 5V output on an EasyDriver!


About petermobbs

Inveterate meddler.
This entry was posted in electronics, Photography and electronics and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

13 Responses to New control box for a focus rail with many other options

  1. Erik Brede says:

    Looks great ! Can’t wait to see your code and diagram 🙂

  2. marsden29 says:

    This looks very interesting, Peter. By the way it’s good to see your screw heads lined up properly!

    • petermobbs says:

      Yep, CNC milled the box lid!

      All the best,


      • marsden29 says:

        I should have said screw slots! I don’t think I’m OCD but every screw I put in must have the slot (or crosshead) aligned. It goes back to my railway days when Midland screws were aligned across the grain and LNWR ones with the grain. (Or the other way round, I can’t remember now!)

  3. marsden29 says:

    Do you store the variables (distance, # of shots & delays) to save having to re-enter them every time?

  4. Hi Peter 🙂 Is it possible to download your code from any site yet ?
    best regards,

    • petermobbs says:

      Hi Eric, You have mail @live. I expect to post a beta version within a few days. Been building a stepping motor-based stereo turntable to be controlled by this system for macro stacked 3D. It works! Will be posting an updated video very shortly. All the best, P.

  5. Halil Hakan Ertug says:

    Did you finish the project ?

    • petermobbs says:

      Hi Halil, Yes, I use it as Z stacker with rotation for stereo photography and also to control an XY table (or ZX table) for stitching or stack and stitch. The XY table is from a Proxxon micromill I converted to CNC a few years back. I have only implemented 3 of the potential axes – the software will control up to 5 (X, Y, Z and A, B). All the best, P.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s