Pulsar124 Wikia
Register
Advertisement

The source code[]

The s2.x software versions require completely new hardware version, h2.0. They are not compatible with older hardware versions (h1.x)!

The project is now hosted on github.com:

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.

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 microprocessor:

https://www.arduino.cc/en/Main/Software

To add support to ESP8266 microcontrollers to your Arduuino IDE, go to File > Preferences in the IDE, and enter the following link into the “Additional Boards Manager URLs” field: http://arduino.esp8266.com/stable/package_esp8266com_index.json . Then go to Tools > Board > Boards Manager, and press install button for the “ESP8266 by ESP8266 Community“ option. After that pick the appropriate board: go to Tools > Board, and pick "LOLIN(WEMOS) D1 R2 & mini". Make sure to choose the correct CPU frequency: Tools > CPU Frequency > 160 MHz (the default one is 80 MHz). Set the Upload speed to 512000. You should choose the option "All Flash Content" under Tools > Erase setting on Arduino IDE after each software upgrade, and for your very first install.

Important: due to some annoying properties of ESP8266 microcontrollers, you can upload software to the controller unit only if the rail (motor unit) is attached to the controller via Cat5 cable. Also, the limiter switches should not be in ON (triggered) position. This is due to the fact that the pin D8 (used to read the state of the limiting switches) cannot be in HIGH state at boot time. (And if you disconnect the rail, or one of the limiting switches is On, D8 will be in HIGH state.)

In my code I am using the following publicly available libraries for Arduino

For the TFT_eSPI library - you have to create a file User_Setup.h with the following lines inside the library folder (it is C:\Users\XXX\Documents\Arduino\libraries\TFT_eSPI-master on my Windows machine; replace XXX with your user name):

#define ST7735_DRIVER      // Define additional parameters below for this display
#define TFT_WIDTH  128
#define TFT_HEIGHT 160
#define ST7735_BLACKTAB
#define TFT_CS   PIN_D0  // Chip select control pin D8
#define TFT_DC   PIN_D4  // Data Command control pin
#define TFT_RST  -1    // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define SPI_FREQUENCY  40000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000


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, key "5" becomes "edit BACKLASH" function. Used to measure the backlash for your rail.
BL2_DEBUG Undefined When defined, key "5" becomes "edit BACKLASH_2" function. Used to measure BACKLASH_2 parameter, for rail reverse accuracy
DELAY_DEBUG Undefined When defined, key "5" becomes "edit SHUTTER_ON_DELAY2" function. Used to find the proper SHUTTER_ON_DELAY2 value, for FRSP (electronic shutter) mode in Canon DSLRs, mirror_lock=2
BATTERY_DEBUG Undefined When defined, prints Raw battery sensor value. Used to calibrate the battery sensor. Also 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 0.9 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 10.72/450.0 / 8.0 Scaling coefficient to derive the battery voltage. Computed as battery_voltage/raw_battery_sensor_value / 8.0 . Use BATTERY_DEBUG option to get raw_battery_sensor_value.
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 500000 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. 1100000 for Canon 50D, 500000 for Canon 6D.
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; during continuous stacking, AF is permanently on (this can increase the maximum FPS your camera can yield); 1: AF is always synced with the shutter, even for continuous stacking. Use this feature only if your camera requires it.
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 10 Speed limit in mm/s. Reduce it if the stepper motor skips steps at the highest speed.
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 32 Number of microsteps in a full step. If you change this number, make sure to change accordingly the values for MOTOR_M0, MOTOR_M1, and MOTOR_M2 (see DRV8825 documentation)
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.
POS_SPEED_FRACTION 0.1 If speed is larger than this factor times MAXIMUM_SPEED, stop updating currently displayed position (to minimize noise and vibrations)
V_THRESHOLD 11.3 / 8 Threshold voltage (Volts) between battery and AC operations (divided by 8 - so it's "per battery" value)
Advertisement