I have got some MOXA devices. One of them is an Mgate MB3180. I want to code in a program in Python to read the data using TCP.

I don't know if I have to use a regular "TCP reading" or an "RTU over TCP reading". I want to use pymodbus library. The architecture consist of:

Sensor --> Data Acq Device --RTU--> MOXA's Gate --TCP--> Ethernet connector in my PC

I have downloaded MGate Manager from MOXA and run the Monitor, but I don't get anything.

enter image description here

After clicking Start and waiting for some minutes:

enter image description here

  • \$\begingroup\$ If the moxa tools don’t work, the your python code will most likely not work either. You’ve not told us what settings etc you tried and what the outcome was. You could have networking issues,wiring issues, not reading the manual issues etc. \$\endgroup\$
    – Kartman
    Nov 18, 2022 at 13:36
  • \$\begingroup\$ Settings: Baudrate 115200, FIFO Enabled, StopBits 1, Interface RS485 2 wires (and RS 422 too). Data Bits 8. I am using pymodbus and the outcome was "Reading Error" (one message I set in order to detect connection failure). Mode: RTU Slave and Listen Port 502 \$\endgroup\$ Nov 21, 2022 at 8:24
  • \$\begingroup\$ What does ‘reading error’ mean? It could be the gateway didn’t respond, the modus slave didn’t respond or maybe an illegal register. Narrow down the root cause. \$\endgroup\$
    – Kartman
    Nov 21, 2022 at 8:33
  • \$\begingroup\$ c = ModbusClient(host="localhost", port=502, unit_id=1, auto_open=True) / regs = c.read_holding_registers(0, 2) / if regs: print(regs) else: print("read error") \$\endgroup\$ Nov 21, 2022 at 8:36
  • \$\begingroup\$ This tells me next to nothing. Which of the three possibilities I outlined is the error due to? As a simple check, you have tried swapping the RS485 A and B wires? \$\endgroup\$
    – Kartman
    Nov 21, 2022 at 8:42

2 Answers 2


There's not really any such thing in Modbus as RTU-over-TCP: I believe that's a pymodbus idea (presumably for connecting to an ether-serial adaptor).

Use TCP, as you're connecting to the MOXA gateway, whose job is to convert between Modbus/tcp and whatever is on the far side, in this case Modbus/RTU.


The MOXA Gateway could probably need some setup, so it must know the baudrate, parity, stopbits setting of the DAQ device (if this actually translates the sensor data to Modbus RTU).

Only if these are correct the gateway will receive data from the DAQ device which it can than forward on the Ethernet side to your PC.

  • \$\begingroup\$ Please use comments for discussion \$\endgroup\$
    – Voltage Spike
    Nov 21, 2022 at 0:28
  • \$\begingroup\$ I have set all those parameters in Mgate Manager \$\endgroup\$ Nov 21, 2022 at 8:15
  • \$\begingroup\$ You are right, Modbus/TCP is only somehow similar to the RTU-variant... \$\endgroup\$
    – datenheim
    Nov 21, 2022 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.