Ap12 (Customer) asked a question.

Hi currently i am using Sure servo 2 Ac servo drive model no. SV2A-2150 so we need to control the driver using cn3 connector using Modbus rs485 protocol so we are interested in motion control ie so we need to control using our python app directly

we are using windows pc ,so is there any ref lib or python app available to control the driver and is there any recommended converters/connectors preferred for smooth operation since we have only one driver will be connected Modbus protocol is required ?

 

our ref python app

 

import minimalmodbus

import serial

import time

 

def test_sureservo2():

   

  try:

    # CORRECTED: SureServo2 specific settings

    servo = minimalmodbus.Instrument('COM4', 127) # Slave 127 (not 1!)

    servo.serial.baudrate = 9600     # 9600 baud (not 115200!)

    servo.serial.bytesize = 8

    servo.serial.parity  = serial.PARITY_NONE

    servo.serial.stopbits = 1       # 1 stop bit (not 2!)

    servo.serial.timeout = 2.0      # 2 second timeout

    servo.mode = minimalmodbus.MODE_RTU

     

    print(" SureServo2 Control Test - CORRECTED VERSION")

    print("=" * 50)

     

    # Test 1: Read firmware version P0.000 (register 0x0001)

    print("Reading firmware version...")

    fw = servo.read_registers(0x0001, 2, functioncode=3)

    firmware_value = (fw[0] << 16) + fw[1]

    print(f"Firmware version: {firmware_value} (0x{firmware_value:08X})")

    print(f"  Raw registers: {fw}")

     

    time.sleep(1)

     

    # Test 2: Read current alarm P0.001 (register 0x0002)  

    print("\n Checking for alarms...")

    alarm = servo.read_registers(0x0002, 2, functioncode=3)

    alarm_value = (alarm[0] << 16) + alarm[1]

    if alarm_value == 0:

      print("No alarms - Drive ready")

    else:

      print(f"Alarm code: {alarm_value}")

     

    time.sleep(1)

     

    # Test 3: Enable servo P2.030 (register 0x021F) 

    print("\n Enabling servo...")

    servo.write_long(0x021F, 1, functioncode=16) # CORRECTED address

    print(" Servo enable command sent")

     

    time.sleep(2)

     

    # Test 4: Set position register P5.001 (register 0x1389)

    print("\n Setting target position...")  

    servo.write_long(0x1389, 1800, functioncode=16) # CORRECTED address

    print("Position set to 1800 pulses")

     

    time.sleep(1)

     

    # Test 5: Execute position register P5.007 (register 0x138F)

    print("\n Executing movement...")

    servo.write_long(0x138F, 1, functioncode=16) # CORRECTED address  

    print("Movement command sent - Motor should move!")

     

    time.sleep(3)

     

    # Test 6: Stop/disable servo

    print("\n Stopping servo...")

    servo.write_long(0x021F, 0, functioncode=16) # Disable servo

    print(" Servo disabled")

     

    print("\n All tests completed successfully!")

     

  except Exception as e:

    print(f"\n Error: {e}")

    print("\nTroubleshooting:")

    print("1. Check SureServo2 is powered ON")

    print("2. Verify wiring: Blue→D+, White/Blue→D-")  

    print("3. Make sure no AL.xxx errors on display")

    print("4. Try swapping D+ and D- wires if needed")

 

if __name__ == "__main__":

  # Install minimalmodbus first: pip install minimalmodbus

  test_sureservo2()