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.2.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.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: EZMotionMMS2-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2b2fa98db7de51740504a9e3d8be32bb3c4370f1af8f355f2eca39067c23d962
MD5 6b8619845b08155f9768df2ae38366bc
BLAKE2b-256 07f99384f078185a9a3b7f9a52f30efbb7186f6eb2e22777b6cd87356f41983b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: EZMotionMMS2-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e2af3cc785ec0e7994d1ad2fb499c6ad69e448e87af18ff23b0406ee29e685f
MD5 6b49ea71a76a34b54c5ef39609af5038
BLAKE2b-256 445ff101587c1d474ac41e5ddf9c8d0192e50d14c1e8ae083579336a5cd17b9e

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