All Articles / Application Notes

Using Triggers to Simplify Automation

By Albert David, Applications Engineering Team

Last updated on Jun. 03, 2025

Introduction

Triggers allow you to set up actions that occur when a certain condition has been met or an event has occurred. They allow you to add flexibility to processes, reduce communication delays for time-sensitive applications, and make it easier to coordinate timing and positioning of devices with other components within a system.

Triggers are available on X-Series controllers using Zaber's ASCII protocol. See the ASCII Protocol Manual for low-level details of the trigger command set.

Types of Triggers

Setting up a trigger requires specifying two things: the condition and the actions.

Conditions

A trigger's condition can be based on any of the following:

  • the value of a setting
  • a distance interval
  • a time period
  • the value of an IO channel
  • the BUSY / IDLE status of the device (using the motion.busy setting)

Actions

A number of the devices general commands are available to be set as actions:

  • either set or increment the value of a setting
  • change a digital or analog output
  • move the device
  • start a stream or PVT sequence
  • start logging data on the device

With so many different possible combinations of these conditions and actions, there are endless possible ways the triggers can be used. To help illustrate the usage of this feature, we can look at some examples of ways the trigger feature is frequently used.

Application Examples

Endless Rotation of a Rotary Stage

All of Zaber's controllers have a minimum and maximum position setting, and movement is constrained to stay within these bounds. On linear devices, these settings prevent the carriage from hitting physical stops. On rotary devices, physical stops do not exist, allowing for full 360 degree motion. The minimum and maximum position setting will still limit motion after several full rotations, however. To achieve endless rotation, a trigger can be set up to remove this limitation.

The following example describes a set-up that uses a trigger to create continuous motion in a certain direction. The trigger will activate when the current position of the rotary stage is more than a full rotation from the 0 position. The triggered action will subtract a full rotation from the stage's current position.

Using this strategy, when a movement is sent that has the final position as more than a full rotation, the trigger will reset the position with each rotation, thereby preventing the final position from ever being reached. A second trigger can also be configured for continuous rotation in the opposite direction.

The steps to set up triggers are detailed below:

Device Information
Device X-MCC1 with RSW60A-T3A
Microstep Size 0.000234375°
360° Position 1536000 microsteps

First, set up the conditions to activate the triggers after a full rotation in either direction.

       /01 trigger 1 when 1 pos >= 1536000
       /01 trigger 2 when 1 pos <= -1536000

Next, set up the actions to increment or decrement the position.

       /01 trigger 1 action a 1 pos += -1536000
       /01 trigger 2 action a 1 pos += 1536000

Enable both triggers so that they become active. A count can be used here to specify the number of rotations you would like to move. Instead of continuous rotation, this can also be used to enable a longer duration of motion than the limits would otherwise allow.

       /01 trigger 1 enable
       /01 trigger 2 enable 100

Sending a movement command that moves past the full rotation mark will start the continuous rotation.

       /01 0 move abs 3072000

High Frequency Cycling

Some applications require cycling or moving between two points continuously. Often, it is important to control both the size of a cycle as well as the frequency with which they complete.

Using movement commands to create this kind of motion has two limitations. First, each command takes a certain amount of time to send from the computer. Second, there is often a small variability in the timing of when commands are sent. Both limitations are on the order of milliseconds, so for low frequency (1 Hz or lower) applications, neither is a major consideration. However, they can be a limiting factor at higher frequencies.

Once triggers are set up, they no longer require communication to function, which makes it possible for higher frequency cycling applications to be more accurate.

The example below describes how triggers can be set up for a specific requirement.

Device Information
Device X-MCC1 with LSM050B-T4A
Microstep Size 0.1905 µm
Maximum Speed 104 mm/s
Maximum Acceleration 8000 mm/s
Example Application Requirements
Amplitude 0.5 mm
Frequency 25 Hz

The purpose of this particular set-up is to define the two end points of the motion. A point being reached or exceeded acts as a condition to trigger the stage to move to the other position. That position will have a similar condition that sends the stage back to the first point.

To accomplish this, first set up the conditions to activate the triggers when each end is reached. Our example will cycle between the 1 mm and 1.5 mm positions, which are found using the microstep size of the device.

       /01 trigger 1 when 1 pos <= 5249
       /01 trigger 2 when 1 pos >= 7874

Next, configure the actions for the triggers to send absolute movements to the opposite points.

       /01 trigger 1 action a 1 move abs 7874
       /01 trigger 2 action a 1 move abs 5249

Enable the triggers, and send the stage to one of the points to begin cycling.

       /01 trigger 1 enable
       /01 trigger 2 enable
       /01 1 move abs 7874

These triggers will set the amplitude of your motion. Frequency can then be set by adjusting the target speed and acceleration. For example, to achieve a 25 Hz motion you must complete a cycle in 40 ms. For each quarter-cycle, this leaves 10 ms to cover 0.25 mm. There will be multiple speed and acceleration combinations that can achieve this, but an easy option is to set the peak speed to be reached at the end of the quarter-cycle so that it is constantly accelerating over that time period. For this example, this would give an acceleration value of 5000 mm/s2 and a target speed of 50 mm/s, which are both within the ratings for the LSM050B-T4A model.

Triggering a Camera

Triggers can be incorporated into applications involving cameras by using a controller's digital output as an automated shutter release for a camera. Many cameras have a digital input that, when switched, can capture an image. While any type of trigger can be used, in this case, distance triggers are the easiest option as they can coordinate images and positions without having to consider timing.

First, set up a trigger with a distance-based condition.

       /01 trigger 1 when 1 dist 1000
       /01 trigger 1 action a io set do 1 t

Then, enable the trigger to execute 500 times before disabling.

       /01 trigger 1 enable 500

At every 1000 microstep interval, digital output 1 will toggle, switching between high and low states. The connected camera will likely capture an image only when the line switches from low to high. In this case, you should set your distance condition to half the desired distance between images. In this example, the line will only go from low to high every 2000 microsteps: 1000 microsteps, 3000 microsteps, 5000 microsteps, and so on.

More Information

The examples in this article illustrate only a few potential uses for triggers; they are designed to add flexibility and ease of use to a wide variety of applications. Please refer to the Zaber ASCII Protocol Manual to learn more about other conditions and actions that can be created. If you have a potential application in mind, or if you have any questions about triggers, please feel free to email our Applications Engineering Team at contact@zaber.com.