Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

⚠️   This library is not perfect. Sometimes the returned values do not match with the requests if the communiction is fast.

 

Usage

⚠️   pyserial has to be installed use pip install pyserial

 

Minimal init

from mtecConnectModbus import mtecConnectModbus
pump = mtecConnectModbus("01");

def connect():
    #pump.serial_port = '/dev/cu.usbmodem1431201'
    pump.serial_port = 'COM3'
    pump.connect()
    
def stop():
    pump.speed = 0
    
def changeSpeed(newSpeed):
    pump.speed = newSpeed

 

Documentation

🔧   💥   constructor

Creates the Object to use the library.

from mtecConnectModbus import mtecConnectModbus
pump = mtecConnectModbus("01");

result:

  • mtecConnectModbus, conatins everything used to communicate via modbus

 

🔧   🔌   connect

Connects to the serial converter.

connected = pump.connect()

result:

  • bool, connection to serial interface sucessful?

 

⚙️   🔄   keep alive

📝   While the pump is running, a valid command has to be sent at least every second

If activated, the keep alive feature sends a command some time (interval) after the last command.

This feature can be tweaked in the settings:

  • bool pump.settings_keepAlive_active, if keep alive feature is enabled, default: true
  • int pump.settings_keepAlive_interval, interval after which the command is sent (in ms), default: 250
  • string (or function with return string) pump.settings.keepAlive.command (length: 10), action number (2) + parameter number (4) + value (4), default: "03FD000001"
  • function pump.settings_keepAlive_callback, gets called with return value as parameter, optional

 

🔧   ▶️   start & stop

Starts or stops the pump (target frequency has to be set)

# target frequency has to be set
pump.start()         # starts the pump
pump.startReverse()  # starts the pump in reverse
pump.stop()          # stops the pump

 

✏️   ⏲️   set frequency

Sets the target frequency

pump.frequency = frequency

parameters:

  • float, positive (resolution: 0.01), target frequency in Hz

 

🔍   ⏲️   get frequency

Gets the actual frequency

f = pump.frequency

result:

  • float, positive (resolution: 0.01), actual frequency in Hz

 

✏️   ⏩   set speed

Starts (or stops) the pump in the desired direction

⚠️   Do not switch between set frequency and set speed

pump.speed = speed

parameters:

  • float, negative to reverse (resolution: 0.01), target frequency

 

🔍   🚦   get ready

Gets the readiness of the machine (on)

f = pump.ready

result:

  • bool, machine is ready for operation

 

🔍   ⚡   get voltage

Gets the actual output voltage

f = pump.voltage

result:

  • float, positive (resolution: 0.01), actual voltage in % of voltage rating

 

🔍   💡   get current

Gets the actual output current

f = pump.current

result:

  • float, positive (resolution: 0.01), actual voltage in % of current rating

 

🔍   💪   get torque

Gets the actual torque

f = pump.torque

result:

  • float, positive (resolution: 0.01), actual voltage in % of torque rating

 

🔧   #️⃣   send custom command

Sends custom command to inverter

answer = pump.sendCommand(parameter, value)

parameters:

  • string (length: 6), action number (2) + parameter number (4), example: "03FD00"
  • int, value

result:

  • int, answer value (equals input value if write command)