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

Uploaded Python 3

File details

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

File metadata

  • Download URL: EZMotionMMS2-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 bd1e81ded8450727076c22155328bb61fc3d3a52d9a1252c3d5842b4c3160baa
MD5 18496485dabf31ce9bff751adc406441
BLAKE2b-256 ec4e7f4bc444aa186912e58e3846c4ba08624640700c7cb537d45cc09319278a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: EZMotionMMS2-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66c7391b2b474bffa7b6f014c0fb4717c8a5e422a589a490e90bce64edb11ecf
MD5 9694a902a5c57d8dcd25e0d171a0398f
BLAKE2b-256 09e227646d78201bc70e0b3cc4c03d2c999f39552c5f6757d6cb82aba7459684

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