← 2.2.2 BLDC - Closed Loop - Speed v 1.0
← 2.2.3 BLDC - Speed Mode - Acceleration Feedforward control v1.0
Note: The Guide can be downloaded in PDF format at the end of the article.
Disclaimer and Safety Information
Disclaimer
This quick startup guide is provided as a complementary resource to the official motor drive manual and datasheets. It is not intended to be the sole source of information for proper motor drive configuration and operation. Incorrect configuration or software bugs may cause unintended behavior, including uncontrolled motor operation or runaway. Users must always conduct tests cautiously and ensure they have a reliable method to safely stop the system in such scenarios. Roboteq, the author, and related parties are not liable for any hardware damage, personal injury, or other consequences arising from the use or misuse of the information in this guide.
Safety Symbols Explanation

Table of Contents
1. How to Use This Guide
- This guide is part of a series of documents that must be followed sequentially to configure and test a Brushless DC motor. The process begins with the Open Loop configuration and continues through the sequence of documents until reaching the final target operating mode.
- For example, configuring a higher-level operating mode, such as Count Position with Hall sensors, requires completing the configuration and testing of lower-level modes, including Open, Torque and Speed modes.

2. Theory: Cascaded Operation
- The motor drive operates using a cascaded control structure. the Position Loop drives the Speed Loop, which in turn drives the Torque Loop, ensuring stable and efficient motor control.
- Proper configuration and tuning of all internal modes is essential for optimal performance.


2. Theory: Mode Operation
Position Tracking mode is a position control mode where the input command is directly set by the user without any trajectory applied, unlike other operating modes. In this mode, the motor power depends entirely on the PID settings. It is most effective when command changes are smooth and within the motor's physical capabilities.




2. Theory: Command and Feedback
- The accepted motor command range in Position Tracking mode is -1000 to +1000.
- If the motor command is sent through a communication parameter (e.g., serial command, CAN object, etc.), it will be internally limited to ±1000.
- If the command is received from another source (e.g., analog or pulse input, encoder, etc.), the input or sensor's minimum and maximum limits must be configured. These configurable limits will correspond to ±1000 of motor command.
- Similarly, the feedback will be scaled to ±1000. To achieve this, the feedback sensor's minimum and maximum values must be set through the drive’s configuration.

2. Theory: Velocity Feedforward control
- Velocity Feedforward control is an additional feedforward loop taking part in Position mode.
- In contrast to the Acceleration Feedforward control that acts in Speed Loop only during the acceleration of the motor, the Velocity Feedforward control acts every time there is a change in the trajectory and thus a motor movement.
- The controller operates by multiplying the motor's desired velocity by the velocity feedforward gain. The higher the velocity, the more feedforward power will be applied to the motor. The velocity feedforward power is added to the power output of the Position mode PID, so this mode operates in parallel to the position mode PID.

3. Configuration Steps
1. Set the operating mode to ‘Closed Loop Position Tracking
Closed-Loop Position Tracking mode scales the motor command and feedback to ±1000 and uses only PID control to follow the motor command, bypassing the set acceleration and deceleration values.

2. Set the command mode
If pulse or analog inputs are used, they should be configured accordingly. Set the input's minimum, center, and maximum values to correspond to -1000, 0, and +1000 for the motor command. Depending on the input mode, the range values will use different units. For example, in analog mode, the input values are expressed in millivolts (mV), while in pulse width mode, they are measured in microseconds (µs). For more details, refer to the Roborun+ manual and respective tutorials.

3. Pay attention to the command priorities.
If a pulse or analog input is used, the Roborun+ slider should be muted to avoid conflicting commands. If the drive receives commands from multiple sources, the command priorities must be configured appropriately. For more details, refer to the Roborun+ manual and related guides.

4. Configure the feedback sensor
Position Tracking mode for BLDC drives supports pulse, analog, encoders, and SSI sensors as feedback. The sensors' minimum and maximum values must be set to scale their output to ±1000. The configuration process is similar to that of analog and pulse inputs.
Note that for quadrature encoders, which do not provide an absolute position, a homing process must be performed each time the system is powered on.

5. Configure the Closed Loop Error Detection
This parameter is used to detect large tracking errors due to mechanical or sensor failures and shut down the motor in case of problem in closed loop speed or position modes. The detection mechanism looks for the size of the tracking error and the duration the error is present. Both loop error limit at time parameters are configurable.

6. Set a starting value for the position proportional gain and start the tuning.
Position mode is primarily tuned using proportional gain. A small value, such as 0.03, can be tested initially. Increase the gain until the feedback matches the track command. Integral gain may reduce the final position error but can also cause overshoots. Test with a small amount of integral gain.
Warning:
Before testing closed-loop Position, Open Loop and Speed modes must be configured, and the sensor must be set correctly so that the reported speed is positive when a positive command is given. If the sensor is not set properly, the motor may enter a dangerous runaway condition. Ensure you have followed the respective guides.

Below are different sets of PI gains and their corresponding motor responses.

4. Velocity Feedforward Tuning
7. Add some Velocity Feedforward Gain.
The Velocity Feedforward control can be enabled by adding a non-zero value to the Velocity Feedforward gain.

An easy way to determine the responsiveness of the position mode is to monitor the Loop Error. Increase the Velocity Feedforward gain, until the loop Error is minimized.

The negative Loop Error denotes an overshoot, so the Velocity Feedforward gain value that we will keep in this example is 1, which gives a small overshoot, accelerating the speed response.

- After plotting the Track and Feedback values, the response of a well-tuned system should resemble the following:

5. Troubleshooting
Position Tracking mode operation should be an easy and straightforward process. If the motor does not behave as expected, consider checking the following general points:
- Test the Motor command and Feedback
Move the input and the feedback sensor to both edges and verify that they correspond to the ±1000 motor command and feedback.
- Pay attention to the command priorities
Script and Fieldbus always have the highest priority. The priority of other command sources can be configured through the command priorities parameter. The command mode will change from the highest to the lowest priority if the command source remains inactive for longer than the watchdog timer’s time.
- Ensure that Torque and Speed modes are properly configured and tuned
The motor drive uses a cascaded control operation, where control modes are interdependent. Poor configuration of Torque or Speed modes can affect Position mode.
- PI Tuning
Large amounts of P gain can cause vibrations. If the motor cannot reach the setpoint using only P gain, a small amount of I gain can be tested.
- Motor Runaway
This could be due to misconfiguration of the sensor (feedback changes in the opposite direction). Additionally, if the motor exceeds the sensor’s minimum or maximum limits, the feedback value will jump from one limit to the other (e.g., from +1000 to -1000). This may cause the motor to behave in an uncontrolled manner.
← 2.2.2 BLDC - Closed Loop - Speed v 1.0
← 2.2.3 BLDC - Speed Mode - Acceleration Feedforward control v1.0