Having issues reversing direction for T200 thrusters

Hi everyone,

We are having an issue reversing the direction of our T200 thrusters. We are able to go forward just fine, but when we try to move in the reverse direction, it moves like a millimeter in the right direction, but then it just stops. Im not entirely sure what the issue is since I think the code is correct but I would really appreciate some help with this issue ASAP. Below is the code we are using to test the direction. Thanks.

Test program #1:

from adafruit_servokit import ServoKit
import time

# Initialize the PCA9685 servo driver with 16 channels
kit = ServoKit(channels=16)

# Define the channels for the thrusters being tested
THRUSTER_CHANNELS = [0, 1]  # Channels 0 and 1

# Function to test multiple thrusters smoothly
def test_thrusters(channels, forward_min=1500, forward_max=1900, reverse_min=1500, reverse_max=1100, step=50):
    print(f"\n--- Testing Thrusters on Channels {channels} ---")

    # Set thrusters to neutral before testing
    for channel in channels:
        kit.continuous_servo[channel].throttle = 0.0  
    time.sleep(2)

    # --- TEST FORWARD DIRECTION ---
    print("\n>>> Moving Forward <<<")
    for pwm in range(forward_min, forward_max + 1, step):
        normalized_pwm = (pwm - 1500) / 500  # Normalize PWM range for Adafruit ServoKit
        for channel in channels:
            print(f"Channel {channel}: Forward PWM {pwm}, Normalized: {normalized_pwm:.2f}")
            kit.continuous_servo[channel].throttle = normalized_pwm
        time.sleep(1)  # Reduced delay for smoother ramp-up

    # Stop for a moment
    print("\n--- Stopping Thrusters (Neutral) ---")
    for channel in channels:
        kit.continuous_servo[channel].throttle = 0.0
    time.sleep(2)

    # --- TEST REVERSE DIRECTION ---
    print("\n>>> Moving Reverse <<<")
    for pwm in range(reverse_min, reverse_max - 1, -step):  # Use negative step for decreasing PWM
        normalized_pwm = (pwm - 1500) / 500
        for channel in channels:
            print(f"Channel {channel}: Reverse PWM {pwm}, Normalized: {normalized_pwm:.2f}")
            kit.continuous_servo[channel].throttle = normalized_pwm
        time.sleep(1)  # Keep it consistent with forward test

    # Stop thrusters completely
    print("\n--- Stopping Thrusters (Neutral) ---")
    for channel in channels:
        kit.continuous_servo[channel].throttle = 0.0
    print(f"\n### Thruster Test Completed for Channels {channels} ###\n")

if __name__ == "__main__":
    try:
        test_thrusters(THRUSTER_CHANNELS)
    except KeyboardInterrupt:
        print("\nTest interrupted! Returning thrusters to neutral...")
        for channel in THRUSTER_CHANNELS:
            kit.continuous_servo[channel].throttle = 0.0

Test program #2:

import time

from adafruit_servokit import ServoKit

kit = ServoKit(channels=16)

kit.continuous_servo[0].throttle = 0

time.sleep(5)

print("reverse")

kit.continuous_servo[0].throttle = -0.5

time.sleep(1)

kit.continuous_servo[0].throttle = 0

Hello @MakanH420, which ESC are you using to control thrusters? If you are using one of the BR ones, like this one, here are the timing specifications:

Command time μs
Initialize/Stop 1500 μs
Max forward 1900 μs
Max reverse 1100 μs

To command the thrusters for this ESC, you can use a fixed frequency and just change the duty cycle to match the desired timing. For more information, see how we did to command a custom servo here: Navigator Lib - PWM Outputs C++ - #4 by RaulTrombin

If you are using BlueOS with Navigator board, you can install the JupyterNotebook extension and run motor control example there.

If you are using different library and hardware to generate PWM, you’ll need to check how it’s setting the frequency, enable output, and check if duty cycle is correct.*

*Have you tried to swap this reverse_min/max values?

def test_thrusters(channels, forward_min=1500, forward_max=1900, 
                   reverse_min=1100, reverse_max=1500, step=50):

Hi Raul,

We are using the Adafruit PCA9685 and the HobbyKing 30A Boat ESC 3A UBEC. We programmed the ESC to do forward, break, and backwards so I think it should be good. But I’m not sure if there is another adjustment I need to do to get it to work as we intend.

Seem it have a special sequence to calibrate and set this ESC, on manufacter webpage seems to have a “Programmierung Boat ESC 30A” manual.

here’s an idea:

def calibrate_esc(channel, kit):
      print("Starting ESC calibration...")
    print("1. Make sure ESC is powered OFF")
    input("   Press Enter when ready...")
    
    print("\n2. Setting throttle to maximum")
    kit.continuous_servo[channel].throttle = 0.8
    
    print("\n3. Power ON the ESC now")
    input("   Press Enter after you hear 2 beeps...")
    
    print("\n4. Setting throttle to neutral")
    kit.continuous_servo[channel].throttle = 0
    input("   Press Enter after you hear 1 beep...")
    
    print("\n5. Setting throttle to full reverse")
    kit.continuous_servo[channel].throttle = -0.8
    input("   Press Enter after you hear confirmation beeps...")
    
    print("\n6. Returning to neutral")
    kit.continuous_servo[channel].throttle = 0
    
    print("\nCalibration complete!")
    print("Your ESC should now be calibrated for full forward and reverse operation")

Hi @MakanH420 -
You’ll probably want to disable any braking function as this can cause voltage spikes that damage electronics…

Would I be able to have the T200’s remain in neutral if I only have the esc in forward and backwards programming?

Yes.
A 1500 microsecond servo-style PWM pulse should correspond to neutral, with above and below this corresponding to the rotation in both directions.

As Raul noted, your ESCs may require a unique initialization sequence - have you given that a try?

There is a device that specifically programs the mode for the esc so I’ll have to give that a try and get back to you. Thank you!