Skip to main content

Python wrapper built around minimalmodbus for controlling EZMotion MMP/ MMS 740 and 760 series servo motors and driver modules via serial-to-RS485 converter.

Project description

EZMotionMMS2

Python wrapper built around minimalmodbus for controlling EZMotion MMP/ MMS 740 and 760 series servo motors and driver modules via USB serial-to-RS485 converter.
(Unless required by applicable law or agreed to in writing, software is distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.)

Wiring Diagram

Example: Position Mode (Single motor)

::

from EZMotionMMS2 import *
Motor1= Ezm("COM24", 1, 115200)
Motor1.Shutdown()                  # Shutdown and Enable the motor

# Set modes of operation to Relative Position mode
Motor1.Set_Op_Mode("POSITION REL")

#print selected modes of operation
print(Motor1.Read_Op_Mode())

Motor1.Enable_Motor()

#send new target position (10 turns + 180 degrees in CCW direction) to the motor and update
Motor1.Set_Target_Position(10,180,"CCW")
Motor1.Update()

# wait for the motor to reach target position
while (Motor1.Pos_Target_Check_Flag() == False):
    pass

# Read and print motors current position
turns,angle = Motor1.Read_Actual_Position()
print("Turns = ", turns)
print("Angle = ", angle)

#send new target position to the motor and update
Motor1.Set_Target_Position(5,180,"CW")
Motor1.Update()

# wait for the motor to reach target position
while (Motor1.Pos_Target_Check_Flag() == False):
    pass

Motor1.Disable_Motor()

Example: Speed Mode (Single motor)

::

import time
from EZMotionMMS2 import *
#Create motor object with slave address 1 and port COM24
Motor1= Ezm("COM24", 1, 115200)
Motor1.Shutdown()

# Set modes of operation to Speed mode
Motor1.Set_Op_Mode("SPEED")
Motor1.Shutdown()

Motor1.Set_Acceleration(500)
Motor1.Set_Deceleration(500)

# Set target velocity to 1000rpm in CW direction
Motor1.Set_Target_Velocity(-1000)

Motor1.Enable_Motor()
time.sleep(5)
#read and print motor actual velocity
print("Motor Speed = ", Motor1.Read_Actual_Velocity())

#print selected modes of operation
print(Motor1.Read_Op_Mode())

# Set target velocity to 1000rpm in CCW direction
Motor1.Set_Target_Velocity(1000)

time.sleep(5)
Motor1.Disable_Motor()

Example: Torque Mode (Single motor)

::

from EZMotionMMS2 import *
import time

#Create motor object with slave address 1 and port COM24
Motor1= Ezm("COM24", 1, 115200)

Motor1.Shutdown()

# Set modes of operation to Torque mode
Motor1.Set_Op_Mode("TORQUE")

#Set target motor torque
Motor1.Set_Target_Torque(-80)

Motor1.Enable_Motor()

#read and print actual motor torque
print(Motor1.Read_Actual_Torque())
time.sleep(15)

#read and print motor actual velocity
print("Motor Speed = ", Motor1.Read_Actual_Velocity())

#read and print actual motor torque
print(Motor1.Read_Actual_Torque())

#print selected modes of operation
print(Motor1.Read_Op_Mode())

Motor1.Disable_Motor()

Example: Homing Mode (Single motor)

::

from EZMotionMMS2 import *
import time
Motor1= Ezm( "COM24", 1, 115200)
Motor1.Shutdown()
Motor1.Set_Op_Mode("HOMING")
Motor1.Shutdown()
Motor1.Homing_Method(-3)
Motor1.Homing_Torque(200)
Motor1.Update()


Motor1.Enable_Motor()
time.sleep(5)
print("Motor Speed = ", Motor1.Read_Actual_Velocity())
print(Motor1.Read_Op_Mode())
# Motor1.Set_Target_Velocity(1000)
time.sleep(5)

Motor1.Disable_Motor()

Example: Speed Mode (Dual motor)

::

import time
from EZMotionMMS2 import *
#Create motor object with slave address 1 and port COM?
Motor1= Ezm("COM24", 1, 115200)
#Create 2nd motor object with slave address 2 and port COM?
Motor2= Ezm("COM2", 2, 115200)
Motor1.Shutdown()
Motor2.Shutdown()

# Set modes of operation to Speed mode
Motor1.Set_Op_Mode("SPEED")
Motor1.Shutdown()
Motor2.Set_Op_Mode("SPEED")
Motor2.Shutdown()


Motor1.Set_Acceleration(500)
Motor1.Set_Deceleration(500)

Motor2.Set_Acceleration(500)
Motor2.Set_Deceleration(500)

# Set target velocity to 1000rpm in CW direction
Motor1.Set_Target_Velocity(-1000)

# Set target velocity to 1000rpm in CCW direction for 2nd motor
Motor2.Set_Target_Velocity(1000)

Motor1.Enable_Motor()
Motor2.Enable_Motor()
time.sleep(5)
#read and print motor actual velocity
print("Motor Speed = ", Motor1.Read_Actual_Velocity())
print("Motor Speed = ", Motor2.Read_Actual_Velocity())

#print selected modes of operation
print(Motor1.Read_Op_Mode())
print(Motor2.Read_Op_Mode())

# Set target velocity to 1000rpm in CCW direction
Motor1.Set_Target_Velocity(1000)

# Set target velocity to 1000rpm in CW direction for 2nd motor
Motor2.Set_Target_Velocity(-1000)

time.sleep(5)
Motor1.Disable_Motor()
Motor2.Disable_Motor()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EZMotionMMS2-1.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

EZMotionMMS2-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file EZMotionMMS2-1.0.0.tar.gz.

File metadata

  • Download URL: EZMotionMMS2-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for EZMotionMMS2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e610eb71c5d1570c4b7630c921d13564925118695fe03fa52cc1137acb819d49
MD5 f56a9a889ea898a5c37c8fd3bceda0de
BLAKE2b-256 640a0a0bd4cb29e2c864993a40af501f008484f3faee1d876b7c8dc47e011a79

See more details on using hashes here.

File details

Details for the file EZMotionMMS2-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: EZMotionMMS2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for EZMotionMMS2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd5f3446cc6cd56f9700cf8e47cdb0d5f6647c6fdede67a7cf26d23266ca41c8
MD5 5014daf4ff57dfdcba2f4225e3b6a32f
BLAKE2b-256 8aa41019eb4f65fdc4de5e48ff98438c1e0d8be129889d818ab61165564fd260

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page