Porkchop (Customer) asked a question.

How to Read and write data instead of using of the Automatic Read feature of the
MB-GATEWAY. Is it possible to read and write without a PLC using a programming language like Python?

  • RBPLC (Customer)

    Yes. PyModbus is a common one. Others on this forum us it.

    • Porkchop (Customer)

      @RBPLC (Customer)​, I have looked at the documentation for PyModbus. This is most likely what I will use. Thank you.

  • z28z34man (Customer)

    +1 @RBPLC (Customer)​ I am a big fan of PyModbus and have used it on a few projects with great success​. If you need some example code let me know

    I know @Garry (Customer)​  has a very good write up using Excel and VBA to read and write to some modbus address.

    • Porkchop (Customer)

      @z28z34man (Customer)​  Some examples would great. What I would like to do is change the slave ID of an out of the box sensor sensor from the default Slave ID to an unused slave ID. I think the default is 0x01. The PC will run PyModbus and communicate to the MB-Gateway over Modbus TCP/IP. The MB-Gateway will write to the sensor over RTU. The sensor is S-Temp&VWC&EC-02. Once I have changed the Slave ID, I will read data from various sensors.

       

      Thanks! 

      Expand Post
  • Garry (Customer)

    VB.net is an option. I like to use AdvancedHMI. This is free software that has drivers already written for a lot of manufactures of Automation equipment as well as Modbus RTU and TCP.

    https://accautomation.ca/click-plc-advancedhmi-communication/

     

    Another option is to use Node-RED.

    This is a graphical language based on Javascript (Node.js)

    https://accautomation.ca/node-red-installing-the-windows-software/

    The following information will be released on Monday but here is a link to the video explaining Modbus RTU and TCP communications using Node-RED. This is to a Solo temperature controller and Click PLC.

    https://youtu.be/yX1w5vcV6cc

     

    Regards,

    Garry

     

    https://accautomation.ca/

    Expand Post
  • HOST_franji1 (HOST Engineering)

    If you have multiple RTU slaves and want to interface with them via Ethernet, you need the MB-GATEWAY.

     

    However, if you only have 1 RTU slave, and it supports RS-232, you could connect a PC w/a serial port and utilize PC software to talk to it. But if you have a multi-drop RTU RS-485, you need the MB-GATEWAY to do Modbus/TCP from your PC.

     

    You do NOT have to utilize the Automatic Read - that's just to help with throughput (e.g. you are polling values). If you just need it to forward your Modbus/TCP requests to the proper slave, it can definitely do that, regardless of whether you utilize the Automatic Read feature.

    Expand Post
    • Porkchop (Customer)

      @HOST_franji1 (HOST Engineering)​, exactly, I would like to to forward Modbus TCP requests to the proper slave. Do you know where to find examples doing this with Python? There is some example code in the MB-Gateway documentation, but mostly using predefined message instructions.

       

  • HOST_franji1 (HOST Engineering)

    In order to answer your question, please provide us details of what you know:

     

    Q1. Is your question about Python (i.e. you fully understand Modbus)?

    Q2. Is your question about Modbus (i.e. you have Python code but need to know what you need to care about Modbus-wise)?

    Q3. Is your question about the actual slaves (i.e. how do you set up RTU Slave IDs for all my slaves, and for each different kind of slave, how do I how which Holding Registers do I need to care about, Inputs, Coils, etc.?)

    Expand Post
10 of 21