Software1

= The source code =
At some point I will move the source code for this project to a proper place (like github). For now you can download the most recent version as a zip file here:
s1.17 (released on September 15, 2016; requires hardware version h1.3; supports telescope focusing).
The whole project is now hosted on github.com (only stable versions; the latest was s1.16 for h1.2):
https://github.com/pulsar123/Fast-Stacker
Stable releases on github:
https://github.com/pulsar123/Fast-Stacker/releases
Warning: if you get the package from github, you will have to create a folder "stacker", and then move all the files inside that folder. (If you get the package from my site - the first link above - the folder stacker is already there.)
You should always do the factory reset (keys #*) after each software upgrade.
The older versions are still available here:
http://pulsar124.wikia.com/wiki/Old_versions
Use the official Arduino IDE to compile the code and upload it to your Arduino:
https://www.arduino.cc/en/Main/Software
The cheap knockoff Arduino Uno R3 board I am using requires special USB serial driver (for Chinese CH341 chipset). The following one (file CH341SER.EXE) worked for my board:
http://www.wch.cn/download/CH341SER_EXE.html
Or use my copy if the above link doesn't work:
https://mashchenko.ca/pub/ch341ser.zip
Install it before trying to connect your Arduino board to the PC.
In my code I am using the two following publicly available libraries for Arduino (you need to install them only when using stacker s0.08; starting from s0.10 the customized versions of these libraries are already included in my zip file, so no need to install the libraries, and if you already installed them you might need to delete them to avoid confusion):
* pcd8544 library (for Nokia 5110): https://github.com/snigelen/pcd8544
* Keypad library: http://playground.arduino.cc/Code/Keypad
Install them before trying to compile my code (only for s0.08). See here: https://www.arduino.cc/en/Guide/Libraries
= Customizing my code =
There are some macro parameters in stacker.h file which you might have to modify:
Macro parameter 	Default value 	Description
DISABLE_MOTOR 	Undefined 	Uncomment this line when debugging the control unit without the motor unit
MOTOR_DEBUG 	Undefined 	When defined, limiting switches are disabled. Convenient to use when you are testing the coupling between the motor and the rail (if there is enough torque; if the motor axis is co-aligned with the focusing knob)
BL_DEBUG 	Undefined 	When defined, two keys get reassigned: keys "2" and "3" become "reduce BACKLASH" and "increase BACKLASH" functions. Used to measure the backlash for your rail.
BL2_DEBUG 	Undefined 	When defined, two keys get reassigned: keys "2" and "3" become "reduce BACKLASH_2" and "increase BACKLASH_2" functions. Used to measure BACKLASH_2 parameter, for rail reverse accuracy
DELAY_DEBUG 	Undefined 	When defined, two keys get reassigned: keys "2" and "3" become "reduce SHUTTER_ON_DELAY2" and "increase SHUTTER_ON_DELAY2" functions. Used to find the proper SHUTTER_ON_DELAY2 value, for FRSP (electronic shutter) mode, mirror_lock=2
BATTERY_DEBUG 	Undefined 	When defined, prints actual voltage (not just #, ## symbols) in the bottom right corner of the display, per single AA battery, without period (so 1.25V will be shown as 125). Convenient for detecting what is the lowest voltage your rail can use without skipping steps - depends on the weight of your camera + lens, among other things.
V_LOW 	1.125 	Critically low voltage, per AA battery (when V becomes lower than this, the macro rail is disabled, to preserve the rail's calibration).
VOLTAGE_SCALER 	2.7273 * 5.0/1024.0/8.0	The first number should be computed for the particular values of the two voltage dividing resistors (R1 and R2) you used to connect to Arduino's pin PIN_BATTERY (A0). The first number is computed as (R1+R2)/R2. R1+R2 should be ~0.5 MOhm.
SPEED_VOLTAGE 	11.5 / 8 	Critical power source voltage value, in volts, computed per AA battery (hence the /8 divider). It is used to sense if the controller is powered by batteries or AC adapter. If it is the former, a lower speed limit (SPEED_LIMIT2_MM_S) will be used, to improve the motor's torque when battery operated.
CONT_STACKING_DELAY 	100000 	An additional delay (in μs) in a continuous stacking shot sequence, after making the first shot. Increase the parameter if your camera skips the first shot; otherwise try to make it as small as possible.
SHUTTER_TIME_US 	100000 	Time to keep the shutter button pressed (microseconds). Try to increase this value if some/all shots are not triggered by the rail; otherwise keep it as small as possible.
SHUTTER_ON_DELAY 	5000 	Delay in microseconds between setting AF on and shutter on
SHUTTER_OFF_DELAY 	5000 	Delay in microseconds between setting shutter off and AF off
SHUTTER_ON_DELAY2 	1100000 	Delay in microseconds between initiating a silent picture and triggering the flash (mirror_lock=2 mode only). Adjust this delay using DELAY_DEBUG mode, along with the camera exposure, until silent pictures are always properly exposed by the flash
SHUTTER_OFF_DELAY2 	100000 	Delay in microseconds between triggering the external flash and disengaging the AF switch (mirror_lock=2 mode only)
AF_SYNC 	0 	The mode of AF synching with the shutter. 0 (default): AF is synched with shutter (when shutter is on AF is on; when shutter is off AF is off) only for non-continuous stacking (#0); during continuous stacking, AF is permanently on (this can increase the maximum FPS your camera can yield); 1: AF is always synched with shutter, even for continuous stacking. Use this feature only if your camera requires it.
SOFTWARE_SPI 	Undefined 	By default, hardware (faster) SPI connection between Arduino and LCD is used, since s0.10. If for some reason hardware SPI doesn't work for you, you can define this parameter to switch back to slower software SPI.
BACKLASH_MM 	0.2 	Backlash of the rail in mm. Use the provided value (0.2mm) if your rail is Velbon Mag Slider. I describe here how to measure backlash for your rail.
BACKLASH_2_MM 	0.259 	The nonlinear backlash parameter in mm. Only matters for maintaining the current coordinate accuracy when reversing the rail (with "*1" command). See here.
SPEED_LIMIT_MM_S 	2.5 	Speed limit for rail movements, in mm/s. Too large values will result in the time interval between microsteps becoming shorter than the Arduino loop length, which will break the algorithm. To avoid the latter, make sure that 10^6 * MM_PER_ROTATION / (MOTOR_STEPS * N_MICROSTEPS * SPEED_LIMIT_MM_S) is ~500 microseconds or larger.
SPEED_LIMIT2_MM_S 	2.5 	Lower speed limit, will be used if battery operated. (No longer needed since h1.3.)
BREAKING_DISTANCE_MM	1 	A distance in mm the rail would travel if breaking while traveling at the maximum allowed speed. This parameter together with SPEED_LIMIT_MM_S determine the maximum acceleration / deceleration allowed for rail movements. This acceleration limiter is important for prolonging the life of the rail's bearings and the motor, and to reduce the rail vibrations. Make sure there is a bit more than BREAKING_DISTANCE_MM from the point one of the two limiting switches is triggered until the rail hits its physical limit.
MOTOR_STEPS 	200 	How many full steps your motor makes to turn 360 degrees. For 1.8 degrees motors use 200; for 0.9 degrees motors use 400.
N_MICROSTEPS 	16 	Number of microsteps in a full step. It is 16 for the default Big Easy Driver configuration.
MM_PER_ROTATION 	3.98 	Travel of your rail (in mm) corresponding to one full rotation (360 degrees) of the focusing knob. For Velbon Super Mag Slider it is 3.98 mm.
 	 	
= Installing the software =
Since the hardware revision h1.2, LCD doesn't work properly when the device is powered via USB. The proper procedure to install or upgrade my software is now as follows:
# Double-click on stacker.ino file to open my software inside Arduino IDE.
# Make sure no external power (AC or battery) is connected to the Arduino.
# Connect the Arduino to your computer with a USB cable (the serial driver should be already installed).
# Once you are done with modifying the code (optional), click on the "Upload" button in the IDE.
# Wait until the compiling and uploading is complete (monitor the green progress bar in the bottom right corner of the IDE).
# At this point, Arduino is running the code, but the LCD is most likely working incorrectly.
# Disconnect the USB cable.
# Now you can attach the external power (AC or battery) and test the software. The LCD should work properly now.
# If something still needs to be adjusted in the software, go back to the item #2.
In other words, make sure the Arduino is never powered via both external power and USB, as it can behave erratically.