Questions tagged [minimalmodbus]

MinimalModbus is an easy-to-use Python module for talking to instruments (slaves) from a computer (master) using the Modbus protocol, and is intended to be running on the master. The only dependence is the pySerial module (also pure Python).

The minimalmodbus Python Modbus library is hosted on https://github.com/pyhys/minimalmodbus and has its documentation at https://minimalmodbus.readthedocs.io

80 questions
0
votes
0 answers

Why is there an additional 0x00 byte at the beginning of the RS485 Response?

I am currently testing a circuit that I've put together on a carrier board for a Raspberry Pi CM4. It connects RS485 to USB via SP3485CN and CH340E. I've set up a PC with the software Modbus Slave and connected to it using a standard RS485 to USB…
0
votes
0 answers

Receiving unexpected readings from a SDM230 Modbus RTU Meter

I am attempting to retrieve data from a SDM230 Modbus RTU Meter using a raspberry Pi running minimalmodbus (python3). The response every time is: Response from instrument: 01 03 02 00 00 B8 44 (7 bytes) or if I request with read_float() four…
bitman
  • 1
  • 3
0
votes
0 answers

Auto discovery for Modbus TCP and RTU

I am new to Modbus protocol. I am working on a simple Modbus TCP application. In future I will jump to RTU as well. Currently I need to manually add the slave's IP address in the master and then I am able to communicate with that particular slave. I…
0
votes
1 answer

MinimalModbus and Circutor

I own a power analyzer, Circutor CVM-1D, and I'm trying to read data with Arduino Yun via MinimalModbus. The code in Python is: import minimalmodbus CVM_1D = minimalmodbus.Instrument('/dev/ttyUSB0',1) CVM_1D.mode =…
sp64
  • 1
  • 2
0
votes
0 answers

python3 minimalmodbus query PZEM-014 -> PZEM-016 AC and DC multimeters

[SOLVED] Could someone help on this? I use minimalmodbus on python 3.11.1 to query a USB<->RS485 transceiver (see picture below) that is connected to a PZEM-016 (for measuring AC power consumption: voltage, current, power, energy,…
0
votes
1 answer

Modbus MSW is always 0

I have a energy meter EM340 with the following modbus spec: Modicom address Physical address Length (words) VARIABLE ENG. UNIT Data Format Notes 301025 0400h 2 kWh (+) TOT – INTeger part INT32 Value=INT(kWh)*1 Example: if kWh=1234.567,…
jvels
  • 319
  • 2
  • 16
0
votes
1 answer

minimalmodbus checksum error in rtu mode with 2 devices

I have a RPI with a USB CH340 dongle connected to a EM340 energy meter. It works fine with the code below. When I connect 2 x EM340 energy meters I get the following error: pi@raspberrypi:~ $ python3 modbus_test.py Traceback (most recent call…
jvels
  • 319
  • 2
  • 16
0
votes
0 answers

How can I bypass the "no response" error in minimalmodbus?

So I run this code which is supposed to cycle between these setpoints for ten seconds each. It all works as expected, but the problem is that sometimes the instrument does not respond. I would like to add an if statement that resends the message if…
0
votes
0 answers

How do you send a modbus message with CRC using minimalmodbus python library?

Per the manual of the device I want to communicate with, the message should be structured like this: address, functioncode, 0, StartRegister, 0, NumRegs, crc-L, crc-H meaning that if the address is 1, function code is 04, start register is 0, and…
0
votes
1 answer

minimalmodbus read multiple register on same device

Is there a way where I can read a set of register on a device with the python library minimalmodbus? Or is it one by one I need to read_register like this? instrument.read_register(0x0033,1)
jvels
  • 319
  • 2
  • 16
0
votes
1 answer

How to read serial port with several scripts?

I'm using a temperature controller that I want to control with my python app. I use the module minimalmodbus to send instruction to the controller and open/close the serial port. I wrote a class TempSensor with two methods: get_temperature(): to…
0
votes
0 answers

Python minimalmodbus, how to read MODBUS RTU

Sorry for my bad English. I am trying to read data by the Modbus RTU method (library: minimalmodbus) but have a problem. This is my 'Modbus Poll' display. I would like to read data by using minimalmodbus. import minimalmodbus import…
0
votes
0 answers

Minimalmodbus Illegal Address

I am new to the modbus and I am trying minimalmodbus library for python. I have a device connected and trying the examples provided by the minimalmobus documentation I get the following error: MinimalModbus debug mode. Create serial port…
tht
  • 1
  • 1
0
votes
0 answers

Minimalmodbus don't write values above 1000?

I'm trying to write values above 1000 using the minimalmodbus library, but my code generates the following error: Traceback (most recent call last): File "D:/Projetos/ON/HMI/modbus_tk_test.py", line 19, in
0
votes
0 answers

Minimalmodbus response appears inapropriate, will not update

I am attempting to read data from a load cell panel which is configured for Modbus RTU protocol. The goal of the program is to log data, I will link the entire program below, but the setup is where I am having issues. I have gotten the module to…