1

I'm setting up a Modbus network.

I have a Raspberry Pi, the Pi should be functioning as a server (collecting the data).

And the data will come of multiple Arduino running as a client.

I hope I say that correct.

See the photo for a layout https://i.stack.imgur.com/3QMea.jpg of course will the Arduino's have an ethernet shield and will run the Modbus library.

On the Pi, I have the pyModbusTCP package.

And I have successfully configured a Modbus Server. With the easy Modbus client software I have a connection with the Pi.

But now I would like to read the data out of the server. somebody out here who knows how I do that? or do I have the wrong approach to the whole thing?

the Arduino only need to send data, not receive data.

import argparse
from pyModbusTCP.server import ModbusServer

if __name__ == '__main__':

parser = argparse.ArgumentParser()

parser.add_argument('-H', '--host', type=str, default='192.168.10.43', 
help='Host')

parser.add_argument('-p', '--port', type=int, default=10502, help='TCP 
port')

args = parser.parse_args()


server = ModbusServer(host=args.host, port=args.port)
server.start()
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Stefan de Kraker
  • 333
  • 4
  • 14

0 Answers0