User guide

# Quick start guide

The only key you have to memorize is '6' - the Help key. You can navigate through the Help pages by pressing '1'/'A' keys (hold it for a second for quick scrolling through the pages.)

Test how fast your camera can shoot with the rail (my Canon 50D can do up to 4 fps continuously with a fast memory card), and how fast your flash can recycle at the power level required (less power means shorter recycle time). Usually flashes can do a short sequence very rapidly (a few fps) - useful for one-point stacking with live creatures, but have to be set to lower fps for longer sequences (studio work; usually done with two-point stacking). Specific examples: my flash Yongnuo 560-III + external battery, at 1/16 power, can do at least 30 shots at 4 fps, up to 125 shots at 1 fps, and at least 320 shots when using 0.5 fps. Set the FPS rail parameter (key '8') accordingly: the largest allowed value (say, 4 fps) for outdoor one-point shooting, and something like 1 fps or even 0.5 fps for studio work (when a large number of shots will be made). (FPS parameter is not used in 2-points non-continuous mode.)

The camera can be attached to the rail facing one end or the other end. You should pick an orientation which (a) takes the focus plane outside of the rail (so the rail is not in the way), and (b) minimizes the imbalance of the camera on the rail. (Sometimes an additional flat macro rail, e.g. like this, is required to achieve both goals; you attach it between the Velbon rail and the camera.) Make sure that the 'A' key moves the camera towards the object (and '1' key moves it away from the object). If that is not the case, you will have to reverse the rail orientation using the keys '\*1'.

Determine the depth of field for your macro lens (will depend mostly on magnification and f-number). This can be done experimentally (shoot a few short focus stacking sequences with varying Step size parameter), or estimated theoretically (see e.g. here). Example: one of my macro lenses, Schneider 28 mm f/4 Componon enlarger lens (produces 5:1 equivalent magnification when used in a reversed position on top of three extension tubes), has DoF around 50 μm when used wide open (where it is sharpest). Set the Step size rail parameter (key '5') to be equal to or a bit less than the DoF of your lens. This will ensure no sharpness gaps in the stacked photo.

Set the acceleration factor (keys '\*A') such that you can easily achieve focus, for a given magnification. (Higher magnifications require larger acceleration factor; the larger the acceleration factor, the lower is the initial acceleration used by '1' and 'A' keys.)

Set the backlash compensation ('\*B') according to your situation. If the camera is looking down (even slightly), set it to 'Down'. If it is looking up (even slightly), set it to 'Up'. (This is to make sure that all critical camera movements are done against the gravity - to make the backlash compensation as accurate as possible. The meaning ot "Down" and "Up" options are only correct when the rail orientation - selected via \*1 command is correct: pressing "A" should move the rail towards the subject.) If the rail is perfectly horizontal, you can set it to either 'Down' or 'Up'. Don't leave it at 'Off' (disabled backlash compensation), as camera movements will be very inaccurate!

Use the key '0' to cycle between the three modes of operations - "Single-point continuous", "Two-point continuous", and "Two-point non-continuous".

**Single-point continuous stacking.** ("Live insects mode"). Choose the number of shots to take (N; key '9'). Set it to a number larger than what you think you need (you can always abort stacking when/if the camera moved too far). Set the tripod with rail and camera attached near the subject. Use tripod knobs for rough positioning, then sideways knob on the Velbon rail and the '1'/'A' buttons on the controller unit to correctly frame the subject and bring it into focus. Use '1'/'A' keys to bring the focus to the initial point - which is either the foreground part of the subject (if camera is facing up; backlash='Up'), or background part (if camera is facing down; backlash='Down'). Hold your flash with a small softbox close to the subject, and press 'D' key on the controller. This will initiate the stacking sequence. You can interrupt the stacking at any time by pressing any key on the controller unit. Use keys '#D' to move the camera back to the last starting position if neeeded. If your camera has a faster burst mode, you can use it by setting the option '\*C' to 'Brst'. (You'll aslo have to enable the burst mode on your camera.)

**Two-point continuous stacking** ("Outdoor mode") and **Two-point non-continuous stacking** ("Studio mode"). If doing non-continuous stacking, use keys '8' and '9' to change the two relevant delay parameters (first one is the time for the vibrations to die off after the camera has moved to the next shot position - the longer the better; the second one should be longer than the exposure time; these two delays have a different meaning if Canon's Electronic shutter is used). Position the camera and the flash, use '1'/'A' keys to bring focus to the foreground of the subject, press '4' to set the foreground point (it is a delayed key - press and hold it longer than 0.5s until you hear a confirmation beep), then use '1'/'A' keys to find the background position, press 'B' to memorize it (again, a delayed key). To double check, you can press '7' and 'C' to move back and forth between the two points, use '1'/'A' and '4'/'B' again if you need to fine-tune/reset any of the points. Once fully satisfied, press 'D' ("Drive") to start continuous or non-continuous two-point focus stacking (you can do it from any position of the rail). As with 1-point stacking, you can interrupt the stacking at any time by pressing any key (except for '#') on the controller unit. Unlike the 1-point stacking case, interrupting 2-point stacking puts the rail in a special 'Pause' mode. In this mode, you can travel by a single frame (without taking a shot) by using '#1'/'#A' keys, or travel by large - 10 frames - steps, by pressing '1'/'A'. You can also use the GoTo command (key '2') to go directly to any desired frame number. Once you move to the desired frame (most likely that will be the last failed frame), press 'D' to resume stacking from that frame. Alternatively, you can press '#B' to abort stacking. In the non-continuos mode you can also use the electronic shutter on Canon cameras (see the Electronic shutter section).

One can also do a timelapse focus stacking (multiple stacks separated by a specified time interval), for two-point stacking only. Use keys '\*4' to set the number of stacks N\_timelapse (if set to '1', timelapse is disabled), and '\*7' to set the time interval, dt\_timelapse, between the start of each stack (in seconds). If an individual stack duration is longer than dt\_timelapse, then all the N\_timelapse stacks will be carried out without a delay, one after another. The maximum total length of the timelapse sequence is limited by the ability of the Arduino's millis() timer, which is around 50 days.

**Be careful with the timelapse feature** - one can inadvertently damage your camera and/or rail if you use some crazy combinations of possible parameters! For example, if one sets up a crazy stack consisting of 9,999 shots, and then use the maximum 4 fps framerate and the maximum N\_timelapse=999, the timelapse shooting will run non-stop with 4 frames per second for 29 days, and will make (or rather will attempt to make) 10 million shots! By that point your DSLR will be long dead (typical shutter lifetime for DSLRs is around 100-200 thousand), and other hardware might also fail.

# Display

The 7-lines display has the following layouts:

## Main layout

### Line 1: the mode

* Shows one of the three operational modes (color-coded):
	+ One point continuous (red color)
	+ Two points continuous (green color)
	+ Two points non-continuos (blue color)
* You can cycle through the three modes using key "0".
* Each mode has somewhat different input parameters (lines 2 and 3) and derived parameters (line 4).

### Line 2: input parameter "Step"

* Distance between adjacent frames in a stack, in micrometers.
* Can be edited using key "5".

### Line 3: other input parameters

* Parameters (editable via keys "8" and "9") depend on the mode:
	+ One point continuous mode: frames-per-second FPS ("8") and number of shots N ("9").
	+ Two points continuous mode: frames-per-second FPS ("8").
	+ Two points non-continuos mode: first (pre-shot) delay d1, seconds ("8"), and second (after-shot) delay d2, seconds ("9").

### Line 4: derived parameters

* What is shown depends on the mode
	+ One point mode: total length of the stack "d" (in mm), and the duration of the stack "t" (in seconds).
	+ Both two-point modes: number of frames "N", and the duration of the stack "t" (in seconds).

### Line 5: foreground and background points

* FXXX: coordinate of the foreground stacking point in mm. (Zero is near the foreground limiting switch.) Can be set or reset to the current position by using key "4".
* BXXX: coordinate of the background stacking point in mm. (Zero is near the foreground limiting switch.) Can be set or reset to the current position by using key "B".
* Background coordinate should always be larger than the foreground coordinate. If that is not the case, the deived parameters in two-point modes will show "\*\*\*\*" instead of numbers. Also, "D" key (initiate stacking) will be ignored, with the message "Bad 2 points!".

### Line 6: current coordinate

* Normally displays the current position in mm (distance from the foreground limiting switch). Sometimes shows other information.
* When the rail is reversed (after pressing \*1), the first character on this line will be "R".
* When running a timelapse stacking, the three last characters on this line will show the current stack number.
* This line will briefly show a message when executing many functions (e.g., when reading from or saving to a memory register; when starting stacking; when pausing stacking, etc.)

### Line 7: status line

* **Status letter:** "B" when breaking, "C" when doing calibration, "P" when in a paused mode (interrupted 2-point stacking), "S" when doing non-continuous stacking, "T" when doing timelapse stacking.
* **Motion status:**
	+ <- : rewinding to the foreground limiter;
	+ -> : fast-forwarding to the background limiter;
	+ > : doing stacking towards the background limiter.
	+ < : doing stacking towards the foreground limiter.
* **Current frame:** live frame counter during focus stacking.
* **Point status:** "F" if the rail is precisely at the foreground point, "B" - same for the background point.
* **Battery status:**
	+ When compiled with BATTERY\_DEBUG macro parameter, shows the raw voltage sesnor reading. Use it to calibrate the sensor (parameter VOLTAGE\_SCALER).
	+ When compiled without BATTERY\_DEBUG macro parameter, shows bitmap images corresponding to 5 levels of a battery charge (color-coded), from empty (red) to full (white).

## Alternative layout

This is the layout when you are pressing the "\*" key.

The following parameters can be modified via the alternative layout:

### Left side

* **\*1**: Reverse the rail. "Off" is default, "On" is reversed (indicated with a letter "R" on the left side of line 6). Use this command to find the rail direction when pressing key "A" moves the camera towards the subject.
* **\*4**: Number of stacks "N" in a timelapse sequence. Set it to "1" to disable timelapse.
* **\*7**: Time interval "dt" (seconds) between stacks in a timelaspe sequence. If dt is smaller than the length of one stack, stacks will be executed one after another without a delay.
* **\*0**: Saving the battery.
	+ Off: no saving (motor torque is continuosly operating, even when not moving). This will result in the best possible positional accuracy, and the best holding torque. You should always set it to "Off" in a studio setting (with AC power).
	+ On: saving (motor torque is disabled when not moving). Use it when operating from batteries. Accuracy may be reduced, and there is no holding torque (don't point the rail up or down at a significant angle).

### Right side

* **\*A**: Acceleration factor. Only affects the initial (acceleration) phase of rewinding (key "1") or fast-forwarding (key "A") the rail. Value of 1 corresponds to the maximum allowed acceleration/deceleration. The larger the factor is, the smaller is the acceleration.
* **\*B**: Backlash compensation.
	+ Down: use it when the camera is facing down, or horizontal.
	+ Off: backlash compensation is disabled (not recommended - accuracy can be dramatically affected)
	+ Up: use it when the camera is facing up, or horizontal.
* **\*C**: Mirror lock, only applies to non-continuous stacking.
	+ Off: No mirror lock support
	+ On: Mirror lock support (trigger shutter twice per shot - first one raises the mirror, then after some delay the second one takes the shot)
	+ FRSP: Full Resolution Silent Picture mode of Magic Lantern alternative firmware for Canon DSLRs. It's actually unrealted to mirror locking. One has to use a special adapter to connect both camera (shutter wire only) and an external flash to the rail.
	+ Brst: Burst mode (only in 1-point shooting mode). You also have to enable the burst mode on your camera.
* **\*D**: Buzzer on/off. Currently buzzer is only used for delayed keys ("4", "B") confirmation, and in case of an emergency limiting switch triggering.
* **\*9**: Base acceleration factor - for all moves except for the initial (acceleration) phase of rewinding (key "1") or fast-forwarding (key "A") the rail, and emergency breaking. Value of 1 corresponds to the maximum allowed acceleration/deceleration. The larger the factor is, the smaller is the acceleration.

# Keys

My stacker has 15 different functions directly associated with each key on the 4x4 keypad, plus 27 more two-key combinations (starting with the key "#" or the key "\*"). The meaning of some keys changes when you are in a "paused" mode, "editor" mode, and "help" mode. Here is the list of the single-key and two-key functions:

## Group B: Change parameters

Some parameters are entered via the editor mode, others have a table of predefined values one can cycle through.

**Editor mode**: some parameters values can be directly typed in using a special "Editor" mode. In this mode, numeric keys are used to enter the value, with "#" key used to type the dot symbol (.). "A" is to accept the value, "B" is backspace command, and "C" is to cancel the editing mode (keeping the old value). Key "D" is ignored. The values entered are subject to the minimum/maximum values specified in stacker.h (e.g. FPS\_MIN and FPS\_MAX). If you enter a value outside of the allowed range, it will be set to one or the other allowed extreme values, with a warning displayed. If a value you enter (only for FPS and Step size parameters) violate a physical limit (maximum speed limit), it will be truncated to comply with the limit. (Again, a warning will be displayed). For Step size, the values you enter will be rounded off to the nearest whole number of microsteps (so it will be a multiple of 0.63 um).

**Important**: FPS parameter affects the maximum allowed Step size (due to the maximum speed limit) even in the non-continuous stacking mode (where FPS parameter is not used). If you get the warning "Reduce FPS!" trying to enter a large Step size value in the 2-points non-continuous mode, switch to a continuous mode (key "0"), reduce the FPS value to a very small value (you can enter 0 -> it will record it as 0.01 fps) using key "8", and then switch back to the non-continuous mode (key "0").

## Group C: Using memory registers

To permanently store the current rail state into a custom memory register. Stored in EEPROM (non-volatile memory.) The keys are ignored in the "paused" mode. To know which parameters are currently saved in memory registers, see the structure "regist" declaration in stacker.h .

 \*5, \*6 | Save to / read from register 5

## Group D: Miscellaneous

 3 | Parking. This is an experimental feature. Use it at the end, before turning the rail off. It should improve long-term accuracy of the rail (fewer Calibrations would be required). Parking consists of a go-to operation to the nearest "multiple of 4 full stepper motor steps" position, relative to the motor position at boot time. Most likely this feature is only useful if "Save energy" option (\*0) is set to "0". This feature would still work correctly even if you did a Factory reset, rail calibration, and/or changed the rail direction, since the boot time.

# Initial setup

## Camera specific setup

The rail was designed to work with any camera which has a wired remote shutter capability, but there may be a need to do some parameter adjustment to make your camera work better with the rail. If your camera only works with a wireless shutter trigger, you still should be able to use it with my rail - if you hack the wireless controller for your camera (by connecting the shutter button in the controller to the output of my rail's two relays).

### Connecting camera to the rail

The motor unit uses a 3.5 mm stereo phono socket for communicating with the camera. (One can also use a 2.5mm stereo socket, but they tend to be less durable.) You will need to make a special cable to connect your camera to the rail - at one end it has to have a jack matching the remote control socket on your camera, at the other end - a 3.5 mm stereo phono jack. If your camera is a Canon or Nikon DSLR, you can use one of cheap Yongnuo shutter cables (just search for "yongnuo shutter cable canon" or same for nikon on ebay). These cables have a 2.5 mm stereo phono jack, so you'll have to replace it with a 3.5 mm stereo jack. This cable handles two camera triggers - shutter and autofocus. The tip of the stereo phono jack has to be connected to the shutter trigger, the middle zone - to the AF trigger, whereas the base should be connected to the common camera's ground.

If your camera is not Canon or Nikon, your best bet would be to search on ebay for cheap wired remote shutter triggers for your camera's model. For example, a trigger for Sony's A DSLR cameras can be found for as little as 2$ with free shipping. Check this great resource for the ways to make a remote shutter cable for your camera: http://www.doc-diy.net/photo/remote\_pinout/ .

You will also need a cheap 3.5 mm stereo phono jack from ebay (1$). And then it is just a matter of soldering it together.

Once you connect your camera to the rail, you can test it by using the "#7" ("take a single shot") function on the rail.

### Adjusting software constants

You might need to adjust some of the camera-specific constants in *stacker.h* to optimize your camera's performance. For example, if your camera consistently skips the first shot when doing a fast continuous stacking, you could try to increase the parameter CONT\_STACKING\_DELAY (current value is 100,000 us = 0.1 s). Or if some shots are occasionally not triggered, perhaps increasing the shutter press time will help (SHUTTER\_TIME\_US , default value is 0.1 s). You could also try to play with advanced parameters SHUTTER\_ON\_DELAY and SHUTTER\_OFF\_DELAY (a delay between triggering the AF switch and triggering the shutter switch, and a delay between releasing the shutter's trigger and releasing the AF trigger, respectively), though the default values (0.005 s) should work for most.

Yet another constant is AF\_SYNC. The value of "0" results in the camera's AF switch being pressed for the whole duration of continuous stacking (only the shutter trigger goes on and off to take shots). This worked on my previous camera - Canon 50D, and resulted in a slightly better performance. If your camera (like my current camera, Canon 6D) doesn't like this feature, you can set AF\_SYNC to "1", in which case the AF trigger would go on and off every time the shutter trigger goes on and off. Again, this only affects continuous modes of stacking; non-continuous stacking always behaves as if AF\_SYNC=1.

Finally, you should measure the fastest FPS speed your camera + your flash can deliver, and then use that to modify the parameter FPS\_MAX
*stacker.h*. You might want to use a fast memory card in your camera to get the best performance. For example, my Canon 50D can reliably do at least 30 shots in RAW format at 4 fps, using a very fast CF card Lexar 1000x Pro. My flash can also cope with this frame rate at 1/16 power.

### Mirror lock support

In continuous stacking camera vibrates regardless of whether the mirror is locked or not (so one has to use a flash to eliminate the blur due to vibrations and rail motion), so locking mirror will not accomplish much. On the other hand, it doesn't make much sense *not* to use the mirror lock feature when doing non-continuous stacking, as the whole purpose of a non-continuous stacking is to minimize camera vibrations.

In Canon DSLRs I have (50D, 6D), the way the mirror lock feature works is (1) you enable the mirror lock in the camera's advanced settings, (2) with the mirror lock enabled, a single shutter press raises ("locks") the mirror, and only the second press takes the shot. (The slight difference is that for 6D I have to set AF\_SYNC to "1" as otherwise the mirror locking feature doesn't work.) My understanding is that Nikon's DSLRs behave the same way. Consequently, I used this model to implement the mirror lock support in my rail. (If your camera's mirror lock works differently, it might not work properly with my rail.)

Specifically, in non-continuous stacking only, if one sets the rail's Mirror lock mode to "On" (key \*C), the rail will trigger the camera's shutter twice per each shot location. First camera moves to the next shot location, then instantly the shutter is triggered to lock the mirror (obviously, you have to enable the Mirror lock feature in your camera first), then after First\_delay (key "8") seconds the shutter is triggered for the second time, to actually take the shot, and then after Second\_delay seconds (key "9"; should be longer than your exposure time) the camera moves to the next frame location, and so on.

Set Mirror\_lock to "Off" to disable mirror lock support. In this mode, the shutter will be triggered only once per shot, in non-continuous stacking. (In continuous stacking, Mirror\_lock is ignored - as long as it is On or Off.)

Starting from s1.14, my rail supports electronic shutter (only for Canon cameras; see the Electronic shutter section). The electronic shutter support is enabled by setting Mirror\_lock to "FRSP". This feature only works for non-continuous stacking.

## Backlash compensation

### Overview

Backlash is an unavoidable issue occurring in many mechanical systems, in particular in macro rails. It manifests itself in physical coordinates not always matching the program coordinates, e.g. every time the direction of motion changes to the opposite.

Starting from s0.10, full backlash compensation is implemented in my stacking rail software (one direction only - when the camera is looking up). From s2.00, backlash compensation works properly for both when the camera is facing up (backlash=Up, key \*B), or down (backlash=Down). The backlash compensation is implemented in such a way that every time the rail comes to a stop it is fully backlash compensated (so the physical coordinate = program coordinate); also stacking is always done in the "good" direction (against the gravity) to maintain the accuracy. Warning: never turn backlash compensation off (backlash=Off), except for debugging purposes, as it will dramatically reduce the accuracy of the rail movements. Even if your rail is perfectly horizontal, pick one non-zero value (backlash is either Down or Up).

The tricky part is the backlash compensation for the rewind/fastforward movements (keys '1'/'A') in the "bad" direection (along with the gravity). I implemented an algorithm that ensures that the same amount of pressing on either key will result in the same travel distance - in both "good" and "bad" (backlash compensated) directions, with a twist that it will take a bit longer for the rail to come to a complete stop when moving in the "bad" direction (as it first has to overshoot the destination by the backlash value, and then come back).

If you find the inconveniences caused by the backlash compensation feature outweigh the better accuracy achieved, you can always disable backlash compensation by using the function "\*B". But you should be aware that positional (in)accuracy then will become comparable to backlash - 200 microns for my rail, which is huge!

### Measuring backlash for your rail

My backlash compensation algorithm needs to know the largest backlash manifested by the rail, under all realistic conditions. It is okay to overestimate this parameter (the only drawback being all backlash compensated movements will take a bit longer), but underestimation will result in a loss of positional accuracy.

From my measurements, maximum backlash for the rail I am using, Velbon Mag Slider, is 0.2 mm. I use this value in stacker.h. You can leave it as is if you are using the same rail; but if you are using a different rail, keep reading.

It is convenient to make use of the focus stacking functionality of my automated rail to measure the rail's maximum backlash. The procedure is as follows.

1. Set up your rail: position it to be slightly non-horizontal, with the camera facing slightly up.
2. Point the camera with the maximum magnification lens you have (I used 5:1 macro) to a slanted target with lots of nice micro-texture (I used a slanted piece of grey-colored paper).
3. Set up proper lighting (a flash, could be with a softbox).
4. Disable the backlash compensation (click "\*B" until BL=Off). Make sure the rail is not reversed (function "\*1"; Rev should be =Off).
5. Use the controller to rewind the rail to the middle point (roughly). Memorize that point as a background point (press "B").
6. Move the rail in the positive direction (key "A") by an amount > expected backlash (e.g., by 2 mm or more).
7. Press "C" key to travel back to the background point. As the traveling was done in the bad (along the gravity) direction, the rail thinks it is at the background point, but it actually lagging behind by the amount = backlash of your rail.
8. Use "#7" to take the reference shot.
9. Use key "5" to select the appropriate value for the Step size parameter. A reasonable choice would be to set it to 1/2 of the DoF of your macro lens (in my case, it was 25 um).
10. Use key "9" to select the required number of shots in 1-point stacking mode, N\_frames. Make it large enough that the product of this and the previous (Step size) parameters is large enough to cover any conceivable backlash your rail might have. Say, use 20 to get the stacking length 20x25 um/frame = 0.5 mm.
11. Press "1" to move rail further by an amount larger than your likely backlash (say, 2 mm).
12. Press "C" to go back to the background point. Now the rail position is backlash compensated, because the movement was in the "good" (against the gravity) direction.
13. Press "D" to start 1-point focus stacking in the "good" direction.
14. Copy both the reference shot and the N\_frames stacking sequence to your computer, process them identically in a way emphasizing micro-texture (high contrast, reasonable amount of sharpening). You might want to do stack alignment for convenience.
15. Find which of the stacking shots looks the closest to the reference shot. The number of this shot in the stacking sequence will tell you how large is the backlash of the rail. For example, if the best matching shot is #9 (and numbering starts from 1), the backlash = (9-1)x Step\_size, or 200 um in our example (Step size = 25 um).
16. Assign the backlash value you found to the parameter BACKLASH\_MM in stacker.h , and compile/upload the code to the controller.
17. Enable backlash compensation (key "\*B"; BL=Down or BL=Up).

### Measuring non-linear backlash factor

There is one more backlash related parameter, BACKLASH\_2\_MM, which is a measure of how non-linear the backlash is, and only affects the current position accuracy after doing a rail reverse (function "\*1"). This parameter doesn't affect at all the accuracy of backlash compensation.

One possible way to fine-tune this parameter to your rail is:

1. Compile the code with the line "#define BL\_DEBUG" uncommented (in stacker.h).
2. Now, the key "5" gets a new functionality: edit the BACKLASH\_2 parameter. Its current value is displayed (in um) on the right side of the line 6 on the screen.
3. Make sure backlash compensation is on (click \*B until BL=Up).
4. Set up your rail: position it to be slightly non-horizontal, with the camera facing slightly up.
5. Attach maximum magnification lens you have to your camera, attach camera to the rail, point to a contrasty target, illuminate the target with plenty of light, and use Live View to monitor the target.
6. Make note where the current focus is on the target, then press "\*1" to reverse the rail. Wait until the backlash compensation is done, and compare the new focus position to the original one. If they are different, adjust the BACKLASH\_2 parameter (click "2" or "3") and press \*1 again.
7. Repeat the previous step until you found the BACKLASH\_2 value such that the rail position doesn't change after the rail reverse. Convert it to mm (from um), and update the BACKLASH\_2\_MM parameter in stacker.h accordingly.
8. Comment out the "define BL\_DEBUG" line in stacker.h, recompile the code. Now the device will use the correct value of BACKLASH\_2 parameter, to preserve accuracy when doing the rail reverse.

## Electronic shutter

Focus stacking is expensive as it wears off the shutter and the mirror moving mechanisms of your camera fairly quickly. (It is common to take >300 shots for a single stacked photo, when doing extreme macro, 10:1 or higher magnification; and DSLR's shutters are typically rated at 100,000 or so shutter actuations). In addition, constant movements of the shutter and mirror mechanisms create additional vibrations which can reduce the sharpness of your macro photos.

The solution: electronic shutter. Some newer cameras (mostly mirroless ILCs) already have this feature. Unfortunately, the popular Canon DSLRs don't, but the great alternative firmware, Magic Lantern, added this functionality to many Canon's cameras, starting from 2008 models (like my Canon 50D and 6D). They call it "Full Resolution Silent Picture" (or FRSP for short).

**Warning: Magic Lantern is a third party alternative firmware which can damage your camera - don't blame me if that happens!**

FRSP only works in Live View, and it is a problem for focus stacking, as many (all?) Canon DSLRs cannot trigger a flash while in Live View (and external flash is essential for extreme macro stacking). The reason for that seems to be the fact that in Canon's Live View it takes a fairly large and variable amount of time from the time you press the shutter button until the actual shot is taken. (The spread of delays is likely camera model specific; for my Canon 50D is is ~0.2s.) Fortunately I found a workaround: if you make the camera exposure long enough (comparable or longer than the intrinsic spread of the delays between the shot initiation and the actual capture), you can find such a constant delay between the shot initiation and an external flash triggering that all your electronic shutter photos will be properly exposed by the flash lighting:

For this to work you obviously need a device which can trigger the external flash with the specified delay after the shot initiation. And here my rail happened to be the match made in heaven, as it is fully programmable and it already has the two optocouplers required for this to work. FRSP is initiated by shutter half-press (AF trigger), so one can redirect the output from my rail's shutter optocoupler to the external flash, and leave the AF optocoupler connected to the camera's AF circuit as before. All this can be accomplished by a simple adapter:

With the hardware side taken care of, the only remaining stuff to do was to change the rail's software a bit, and that's what I did in s1.14 (and newer versions). Specifically, I added a new mirror\_lock mode (changeable via #C keys, as usual), mirror\_lock=FRSP. This new mode should only be used for non-continuous focus stacking.

For FRSP + external flash to work correctly, you need to figure out the values of the following three timing parameters for your camera:

1. **Camera exposure:** 1/4s for my Canon 50D and 6D. You can start with a fairly large number, and then try to reduce it as much as you can. (When it gets too short, some or all of your electronic shutter photos will not be properly exposed by the external flash light). Very long values are bad because you will need a much darker environment in your studio, and also the noise might become an issue. (Noise is totally not an issue with 1/4 exposure on my Canon 50D). Make sure to set these two Magick Lantern parameters as shown: ExpOverride=ON, ExpSim=ON.
2. **Flash delay:** the delay from initiating the shot until the external flash is triggered. In mirror\_lock=2 mode this delay is given by macro parameter SHUTTER\_ON\_DELAY2 in stacker.h. You can use a special debugging mode (by uncommenting the line "//#define DELAY\_DEBUG" in stacker.h) to figure out the proper value for SHUTTER\_ON\_DELAY2. (In the DELAY\_DEBUG mode, key "5" becomes "edit SHUTTER\_ON\_DELAY2".) For my Canon 50D the good value of SHUTTER\_ON\_DELAY2 is 1100000 (or 1.1s). For Canon 6D, it is 500000 (0.5s).
3. **Frame rate**. Finally, once you figured out the two previous timings, you should find the shortest interval between adjacent shots (the sum of the two non-continuous delays, First\_delay and Second\_delay - changeable with the keys "8" and "9", respectively) which will result in camera's recording properly all the electronic shots, for realistically large stacks (say, 300 shots in a row). Also, the Second\_delay should be longer than SHUTTER\_ON\_DELAY2; otherwise the flash will be triggered when the rail is already moving to the next frame position. For for both Canon 50D and 6D, the good values are First\_delay=4s and Second\_delay=1.5s (meaning each shot will take 5.5s + the rail travel time between shots.) With smaller First\_delay values I could take a few silent pictures without issues, but after 60-90 shots this would crash my camera, so only the first 60-90 shots would actually be recorded.

Here is the procedure to determine the above timings parameters. Make sure you always use the same memory card with your camera (it helps if it is a fast card), and that the Long exposure noise reduction is disabled in your camera (or set to Auto; for 50D, setting it to Auto disables the noise reduction for exposures shorter than 1s, which is sufficient for FRSP purposes). Also make sure the camera's screen displays the shot it just took for a short time (~1-2s) - the Image Review option. Set the camera to Manual mode (including the ISO). Do testing in a fairly dark room. Set the external flash to make properly exposed shots when using normal shutter. I did it the following way: attached a DIY pinhole to my camera in place of a lens, placed the external flash right next to the camera facing the pinhole, and chose the flash power (1/128) which would properly expose the sensor. This allowed me to use a fairly bright room, and save on flash batteries. For this testing, I compiled the rail code with "//#define DISABLE\_MOTOR" uncommented, so I didn't have to worry about the rail moving back and forth. Set mirror\_lock=FRSP in the rail.

1. Set camera exposure to a fairly large value (say, 1s). Enable the FRSP feature in your camera (read this thread for details): install the most recent nightly Magic Lantern build on the camera's memory card, enable ML modules silent\_picture and mlv\_rec, turn the camera off and on to start the modules, go to the Silent pictures menu and set it to "full resolution" and "MLV" format, then start Live View. When you half-press the camera's shutter a silent picture will be taken. All FRSP shots will be recorded as individual frames in a single large MLV file. (Once MLV becomes larger than 4GB, it will split into 2, 3 etc. segments, each ~4GB large.) If you want to stop recording to the current MLV file, and start a new MLV file, you can go to the ML menu, disable and then enable again the Silent Picture mode. (Simply leaving the Live View mode will not start a new MLV file!) You can unpack MLV files into individual raw (DNG) frames using Windows/Mac software MLV Mystic.
2. Recompile the rail with "//#define DELAY\_DEBUG" uncommented. Use key "5" to change the current value of SHUTTER\_ON\_DELAY2 macro parameter. Start with a small value (say, 0.1s), and then increase it by steps ~0.1s. Test each value by making a FRSP shot (press #7 keys). Have at least 6s between silent pictures (#7 presses). When SHUTTER\_ON\_DELAY2 is too short, all frames will be unexposed (you'll briefly see grainy noisy image on the camera's screen). Starting from a certain value, all frames become properly exposed. Once the value becomes too large, some or all frames become unexposed again (and some might be fractionally exposed, the rest of the frame being black). Your task is to find the smallest SHUTTER\_ON\_DELAY2 value consistently producing properly exposed silent pictures. If you cannot find any good SHUTTER\_ON\_DELAY2 value at this point, your camera exposure is probably too short. Increase it, and run the tests again.
3. Set SHUTTER\_ON\_DELAY2 to the *shortest* good value you found, and start reducing the camera's exposure, while taking silent pictures (#7), with the same precautions as before (at least 6s between shots). At some point, when the exposure time becomes too short, you will start seeing either partially or fully unexposed frames. Find the smallest exposure value which consistently produces well exposed shots. (It is 1/4s for Canon 50D and 6D.)
4. Make a more vigorous testing of the two parameters you just found, exposure time and SHUTTER\_ON\_DELAY2, by running long stacking sequences. Set Second\_delay ("9") to a time slightly longer than SHUTTER\_ON\_DELAY2, and choose such First\_delay ("8") that the sum First\_delay + Second\_delay is at least 8s. Set Step size ("5") parameter to a value you'd normally use (say, 5um), and then set the foreground and background points to get the total number of shots (in two-point stacking) to be 300 or so. Start non-continuous two-point stacking ("D"). You can monitor the progress on the camera's screen. If you start seeing partially exposed or unexposed frames, abort stacking (press any key, then #B), then increase a bit the camera exposure time (and perhaps the SHUTTER\_ON\_DELAY2 parameter), and then try again. You should be able to reach a point when there are no black frames in a 300-shots stack. (Double check that on your PC, after unpacking the MLV file.)
5. Now you can start reducing First\_delay value ("8"), and then repeating the stacking test. Once it becomes too short (<5.5s for Canon 50D), the camera will only record some of the shots (this can be detected only in your PC, after unpacking the MLV file; the camera's screen will appear to work fine even if shots are no longer recorded to the card). After that the camera might need to be power cycled. Find the shortest First\_delay value when you can consistently produce good long (~300 shots) stacks.

All this sounds like a lot of work (and indeed it was), but this only needs to be done once, and then you can use FRSP with the above three parameters for all your studio focus stacking needs, essentially for free! (No wearing off of the camera's shutter and mirror mechanisms.)

# Operating the device

## Rewind / fast forward functionality

The two most used keys in the rail are "1" (rewind - moving camera in the negative direction, towards foreground) and "A" (fast forward - moving camera in the positive direction, towards foreground). The rail moves as long as you press one of these two keys, and comes to a stop once the key was released.

As with all rail motions, the maximum acceleration/deceleration limit and maximum speed limit apply. The maximum speed limit is 10 mm/s. The acceleration/deceleration limit is the maximum value encoded in stacker.h (derived from BREAKING\_DISTANCE\_MM and SPEED\_LIMIT\_MM\_S) divided by the current value of the accel\_factor parameter. The latter can be modified at runtime using the keys "\*A", with the possible values 1, 2, 4, ..., 64. Only the initial acceleration is affected by the value of the accel\_factor; after keys "1" or "A" are released, deceleration happens with accel\_factor=1 (maximum acceleration).

Moves in the "bad" (along with the gravity) direction (key "1" if \*B=1; key "A" if \*B=-1) result in a full backlash compensation loop - if backlash compensation is enabled. (The rail will overshoot by the BACKLASH amount - 0.2mm - and then come back.) This is not the case with moves in the opposite direction (against the gravity), where no backlash compensation is needed. For convenience, the software makes sure that the same amount of pressing both "1" and "A" keys results in the same amount of the rail traveling, in the corresponding direction. (With the twist that it takes longer for the rail to come to a complete stop after moving in the "bad" direction, because of the backlash compensation loop.)

When the rail is reversed (after pressing the "\*1" keys; the symbol "R" is displayed at the beginning of the fifth line), "foreground" and "background" are swapped. (So if before the reverse pressing the "1" key would move the camera to the left, after the reverse the same key will move camera to the right.)

## Changing parameters

Many of the rail parameters can be changed at runtime, either using Editor mode (so the values can be typed in), or flipping through a table of predefined values. (See #Group B: Change parameters for details.)

The current values of all the parameters (with one exception - Buzzer on/off (\*D)) are saved to the non-volatile memory (EEPROM), and are restored after power cycling the rail. Most of these parameters can also be saved to one of the six custom memory registers, which are also written to EEPROM.

## Foreground and background points

Two-point stacking (continuous, non-continuous, and timelapse) requires two special points to be set: foreground point and background point. Use keys "1" and "A" while monitoring the camera's Live View to find a good location for the foreground point; use the key "4" to save the current location as the foreground point. Same with the second - background - point, only use a different key - "B" - to store it. (Both "4" and "B" are delayed action keys: one has to press and hold it for >1/2s until you hear a beep. I implemented this as I often re-set the points accidentally, as I am typically not looking at the controller when setting up the points - I look at the camera's screen instead.) You can always come back to the foreground point (by pressing the key "7") and/or to the background point (by pressing the key "C") and then use "1"/"A" keys followed by "4" or "B" keys to fine-tune and reset either of the two points.

Instead of "1" and "A", you can also use Go To command ("2" key) to go to a specific coordinate (in mm), and then use "4" or "B" to memorize the point.

The coordinates of the two points are always stored in the non-volatile memory, so will be remembered after power-cycling the rail. They are also saved in custom memory registers (also using non-volatile memory).

## Focus stacking

Use key "0" to cycle through the three stacking modes - 1-point continuous, 2-points continuous, and 2-points non-continuous. Each mode has a different set of input and derived parameters displayed on the screen.

### Single-point stacking

Single-point focus stacking is a continuous stacking (camera keeps moving and shooting at the same time, without stops), so using a flash is essential to eliminate the motion blur. Once the key is pressed, the software will use the current values of the three main stacking parameters - number of shots to make, N\_shots (key "9"), distance between shots, μm/frame (key "5"), and the frame rate, FPS (key "8"), to commence focus stacking from the current point in the good (against the gravity) direction. The first shot is taken at the location where the "D" key was pressed. As the stacking is underway, the current frame counter (at the bottom of the screen) is constantly updated.

If your camera is facing up (even slightly) or horizontal, set \*B (backlash compensation) to "1". Your initial focusing point should be in the foreground of the subject, and stacking will proceed toward the background part.

In the opposite case - if your camera is facing down (even slightly) or horizontal, set \*B (backlash compensation) to "-1". Your initial focusing point should be in the background of the subject, and stacking will proceed toward the foreground part.

Single-point focus stacking can be aborted at any time by pressing any key. (There is no pause feature in this mode; see the Pause feature section below.) One can move camera back to the starting point of the last single-point focus stacking by pressing the keys "#D". As it is easy to stop stacking, and we usually don't know in advance how many shots would be required to cover the whole subject, set Number of frames ("9") to a value larger than what you think you'll need, and then abort stacking once the whole subject was covered.

As there is essentially no setup involved, the single-point focus stacking mode is the most suitable for shooting live insects outdoors.

### Continuous two-point stacking

Continuous two-point stacking is a continuous kind of stacking, so a flash is required to eliminate the motion blur resulting from the camera moving and shooting at the same time. First one has to set the foreground and background points (see #Foreground and background points), and set the values for the two stacking parameters - distance between shots, Step (changeable with "5" key), and the frame rate, FPS (changeable with "8" key). The parameter N\_shots is not used in this mode. (Number of shots is derived self-consistently from the coordinates of the two points and the Step parameter.)

Two-point stacking is always done in the "good" (against the gravity) direction. The rail doesn't have to be at the starting point when you press the "D" key; if the rail is not at the starting point, it will first automatically travel to there, and then start stacking.

The "derived parameters" line on the screen shows the two important two-point focus stacking parameters: number of shots to take, and the total stacking time (seconds). As the stacking is underway, the current frame counter (at the bottom of the screen) is constantly updated.

This mode can be paused by pressing any key (see the Pause feature section below).

Compared to the single-point shooting, the two-point stacking mode gives you more control (you specify exactly the starting **and** the ending point for the stack), with the drawback that it takes longer to set it up. As a result this mode is more suitable for non-live subjects, and can be used both outdoors and indoors.

### Non-continuous two-point stacking

Non-continuous two-point stacking employs a non-continuous (move - pause - shoot - pause - move again) mode of focus stacking, which can be done with both flash and continuous lighting. As in the continuous two-point stacking, one has first to set the foreground and background points. There are three important parameters here: distance between shots un microns, Step (changeable with "5"), the length of the pre-shot pause in seconds, First\_delay (changeable with the "8" key), and the length of the post-shot pause in seconds, Second\_delay (changeable with the "9" key). The first delay should be long enough to let the camera vibrations caused by the rail motion and camera's mirror locking (see below) to settle down; the second delay should be longer than the chosen exposure time. The non-continuous stacking, similarly to the continuous two-point stacking, always starts from the lowest point (foreground point if the camera is facing up, and background point if it is facing down - assuming that you set up the backlash compensation correctly with \*B keys). If the rail wasn't at the starting point when you pressed "D", it will travel there first.

As this mode is all about minimizing the camera vibrations, it makes a total sense to always use the camera's mirror lock feature, in which case the rail's Mirror Lock feature should also be on (use "\*C" to set Mirror\_lock to "1"; this is the default). This will result in the rail triggering the camera's shutter twice for each location. The sequence of events is "move camera to the next shot position - trigger the shutter once to raise the mirror - wait for First\_delay seconds - trigger the shutter for the second time to take the shot - wait for Second\_delay seconds to make sure the exposure is over by the time the rail starts moving again" and so on. The rail's Mirror Lock feature has no impact on continuous focus stacking modes (either single or two point).

If you have a Canon camera, with the non-continuous two-point stacking you can also use the electronic shutter (or Full Resolution Silent Picture, FRSP for short) feature of the alternative firmware Magic Lantern, by setting the Mirror\_lock parameter to "2" (use \*C key). The electronic shutter can be used with or without an external flash. You'll need to make a simple adapter for the electronic shutter to work (see Electronic\_shutter for the details).

This mode can be paused by pressing any key (see the Pause feature section below).

### Timelapse mode

Timelapse stacking consists of more than one stack executed one after another, with a specified time interval between the starting times for each stack. Timelapse stacking can be done using either continuous or non-continuous two-point stacking modes. (Single-point stacking is not supported.) There are two related parameters: number of stacks to perform, N\_timelapse (changeable with the "\*4" keys), and the time interval between the starting times of each stack in seconds, dt\_timelapse (changeable with the "\*7" keys). By default N\_timelapse=1, meaning the timelapse mode is disabled. Once N\_timelapse is set to a value larger than one, next time you press "D" key, timelapse stacking will commence, utilizing either continuous or non-continuous two-point stacking modes, respectively.

When the timelapse stacking is underway, the last number in the sixth line on the screen continuously displays the current stack number, whereas the current frame (within the current stack) is displayed in the usual spot, in the bottom line.

This mode can be paused by pressing any key (see the Pause feature section below).

Use this mode when there is some slow time evolution in your macro subject - for example, for slowly opening flower buds.

**Be careful with the timelapse feature** - one can inadvertently damage your camera and/or rail if you use some crazy combinations of possible parameters! For example, if one sets up a crazy stack consisting of 9,999 shots, and then use the maximum 4 fps framerate and the maximum N\_timelapse=999, the timelapse shooting will run non-stop with 4 frames per second for 29 days, and will make (or rather will attempt to make) 10 million shots! By that point your DSLR will be long dead (typical shutter lifetime for DSLRs is around 100-200 thousand), and other hardware might also fail.

## Pause feature

The pause feature implemented in my software is one of its strongest selling points - I am not aware of a feature of this kind implemented in either commercial products (Cognysis StackShot) or other similar Arduino based DIY projects (Rylee Isitt's stacking controller, Stackduino etc.).

In my rail one can pause a (two-points) focus stacking operation by pressing any key. This can be especially handy when you are doing super or extreme macro stacking, with magnifications 5:1 and up, which typically require hundreds of individual shots to obtain a useful depth of field. With such long stacking sequences the chances that something goes wrong are fairly high. For example, the camera's memory card runs out of space; or the camera or flash battery dies half way through the stacking; or your flash gets too hot and turns off because of the thermal protection. In all those case my rail's ability to pause stacking, and then move camera back a few shots to the point where the first failed shot was taken is very valuable, potentially saving hours of your time and hundreds of shots which would have been otherwise wasted.

When the rail is in the Paused state, the status letter displayed at the left bottom corner of the main screen is "P". If the rail was moving from one frame to another frame positions when it was paused, it will automatically move back to the last taken shot position, with a proper backlash compensation (if it is enabled).

In this mode, most key presses are ignored, and some of the keys which do work have a different function. Here is the list of the functions which can be performed while paused:

* "D": resume stacking, taking the first shot at the current position.
* "6": Help mode
* "#B": abort stacking.
* "#7": take one shot at the current location.

In addition, the following functions are available only when paused in the middle of active stacking (not while traveling to the starting point for the stack, and not while waiting between stacks in a timelapse mode):

* "#1" / "#A": move camera to the previous / next frame positions, with backlash compensation if enabled.
* "1" / "A": move camera 10 frames back / 10 frames forward, with backlash compensation if enabled.
* "2": Go To to a specific frame number

With the latter commands, the frame counter is properly adjusted to reflect the current frame position.

What exactly happens when you initiate the pause (by pressing any key) depends on the current stacking mode.

### Single-point stacking

Single-point ("outdoor") stacking is the only stacking which doesn't have the pause feature. And the reason is fairly obvious: single-point stacking is aimed at shooting live insects outdoors, where (a) total number of shots you take is limited by the ability of your camera/flash to shoot rapidly (4 fps for my camera) and the short time you can reasonably expect the live insect to remain motionless - likely no more than 30 shots per stacking, so a pause feature is not really needed, and (b) pausing stacking of a live insect is kind of pointless - by the time you fixed your issue (changed battery e.g.), the insect is likely gone.

Instead, pressing any key during a single-point stacking aborts the current operation. One useful feature here is the function "#D" which will rewind the rail to the starting point of the last stacking sequence. So if you are lucky and the insect is still there after aborting the stacking and fixing the issue, just press "#D" followed by the usual "D" to restart the single-point stacking from the same point.

### Continuous two-point stacking

Continuous two-point stacking can be properly paused by pressing any key.

If the pause happened during the initial rail travel to the starting (foreground) point, the rail will safely come to a complete stop, with only the keys "D" (resume stacking), "#B" (abort stacking), and "#7" (take a shot) operational. If the pause took place during stacking, additional commands "#1" / "#A", "1" / "A" (moving the camera by one or 10 frames steps) and "2" (Go To a specific frame) are also available.

### Non-continuous two-point stacking

This mode can be properly paused by pressing any key. The pause behaviour is the same as with the continuous two-point stacking (see above), with the additional twist that if the Mirror Lock feature is enabled on the camera and on the rail (function "\*C"), and the pause happened at the time when the mirror was locked, shutter will be triggered once to lower the camera's mirror into its normal position.

### Timelapse mode

Timelapse stacking can be performed with both continuous and non-continuous two-point stacking modes, and is enabled by setting the parameter N\_timelapse to a value larger than one (function "\*4"). It can be properly paused by pressing any key at any time.

If the pause happened while stacking, the situation is identical to the pause in continuous and non-continuous stacking described above. If the pause was initiated while the rail was waiting between two different stacks, only the basic pause keys ("D", "#B", "#7") are available.

Warning: pressing "#B" while paused in the timelapse mode will abort the whole timelapse sequence, not just the current stack.

Another warning: the timelapse time counter keeps working while paused. So when you pause while waiting between stacks and then resume timelapse shooting, the next stack will start when it was supposed to before the rail was paused. If we are already late for the next stack because of the pause, the next stack will start instantly.

## Using memory registers

Fast Stacker software provides the ability to save the current state of the rail to one of the six memory registers in non-volatile memory (EEPROM) with a single two-key command, and then to read the state from the register using another single two-key command. Currently the following parameters are saved (the up-to-date list can be found in *struct regist* declaration in *stacker.h*):

* Stacking Mode;
* N\_shots;
* step size;
* FPS;
* First\_delay;
* Second\_delay;
* accel\_factor;
* N\_timelapse;
* dt\_timelapse;
* mirror lock;
* backlash compensation;
* rail reverse state;
* save energy;
* foreground point;
* background point;
* buzzer on/off.

To save to / read from the registers 1, 2, 3, 4, 5, and 6, the following pairs of commands are used: "#2"/"#3", "#5"/"#6", "#8"/"#9", "\*2"/"\*3", "\*5"/"\*6", "\*8"/"\*9", respectively. These commands are only accessible when the rail is at rest, and is not performing stacking (either active or paused).

Rail reverse state is one of the saved parameters. If the register you just read from has the rail reverse state opposite to the current one, the rail will automatically perform a backlash compensation loop (if the backlash compensation parameter stored in the register is set to "on").

Memory registers are very convenient for storing specific, frequently used combinations of the rail parameters (usually for specific lenses and/or specific macro subjects).

## Rail reverse

All the rail directional operations (direction of the rewind/fast forward, stacking, backlash compensation) can be reversed with the function "\*1". Press it again to go back to the original state. If the backlash compensation is on, each rail reversal results in a backlash compensation loop, to keep the rail coordinates accurate.

Rail reversing is not allowed when you are near one of the limiting switches. If that is the case, you will get a warning ("Too close to limiters!"). Move away from the switch, and then try again.

In the default state, the screen has an empty character at the beginning of the sixth line. In the reversed state, that character displays "R" (for "reversed").

The current reverse state is stored in EEPROM, so will be remembered after power-cycling the rail. It is also stored in custom memory registers.

Use this function with certain lenses which require the camera to face in the opposite direction.

## Rail calibration

The very first time you turn on the device, a full rail calibration will be performed. But first, a warning will be displayed:

```
  Calibration
   required!
 Press any key
 to start calibration

```

Once you press any key, the rail will travel in the positive direction (from foreground to background) until the corresponding limiting micro switch is triggered. Then the rail will break safely (with the limiting acceleration - that's why you have to leave enough of space for the rail to travel - from the moment it hits the switch until it hits the physical limit), and then will travel all the way back until it hits the opposite limiting switch. Then it will break again, and travel back into a safe area. The whole process will take between 6 and 12 seconds, depending on the initial rail position.

The calibration stores the coordinates corresponding to the two limiting switches to non-volatile (EEPROM) memory. After the calibration, the rail should never trigger either of the micro switches in the course of normal operation: when rewinding (keys "1"/"A") or doing stacking, the rail will break safely and stop right before hitting the corresponding switch.

With time calibration might get lost, resulting in the rail triggering one of the micro switches accidentally while rewinding or stacking. If that happens, a partial calibration is instantly initiated: the position of the switch which has just been hit will be recorded, the usual warning will be displayed, and once you press any key the rail will travel to the opposite switch until it is triggered, and then will travel back into a safe area.

One can always initiate a full calibration manually, by using the keys "#C". The usual warning will be displayed, and then the rail will run the full calibration cycle (same as when the rail was used for the first time).

Finally, a full calibration (with the standard warning) will take place after a factory reset (keys "#\*").

If you want to minimize the number of times you do the calibration, always turn Save energy off ("\*0"=0), and always park the rail (key "3") before turning it off.

## Factory reset

Key combination "#\*" initiates a full factory reset, which will bring the rail to the same state as it had initially, when you powered it on for the first time. Warning: this will erase all the EEPROM data, including the five memory registers. Factory reset is automatically followed by a full rail calibration.

You have to do a factory reset every time you upgrade the rail's software to a new version, right after the upgrade. Failure to do so may result in some erratic rail behaviour. Evene better, use Tools > Erase Flash > All Flash Content option in the Arduino IDE every time you upload a new version of the software.

## Emergency breaking

Use the command "#B" to request an emergency breaking while the rail is moving - when running calibration ("#C"), when rewinding /fast forwarding ("1" / "A"), or when traveling to the foreground or background points ("7" / "C"). The status character (bottom left corner of the screen) will briefly display "B" when breaking. The breaking will be performed with the maximum deceleration.

The keys "#B" have a different meaning in the Paused mode (when paused while doing stacking) - there they are used to abort stacking.

## Miscellaneous functions

Use "#1" / "#A" functions to move the rail exactly one Step size towards the foreground or background, respectively (when the rail is not paused). When paused, the behaviour is slightly different: pressing "#1" / "#A" will move the camera to the previous / next frame location in the current two-point stacking sequence.

Use "#7" to trigger the camera's shutter once. Useful for testing the exposure before firing up a stacking sequence.