Activity Forums Questions & Troubleshooting Modbus RTU Rs485 with a sensor

  • Modbus RTU Rs485 with a sensor

  • ryan

    Member
    July 8, 2021 at 10:02 am

    Hello everyone. I am new to all these kind of stuff. So, here’s a silly question. How can i program the controllino Maxi to communicate with a sensor through the RS 485 and Modbus RTU?

  • Johi

    Member
    July 10, 2021 at 12:43 pm

    Hello Ryan,

    There are several Modbus libraries available on the internet.

    Some of them work others do not work so good.

    For my US customer I have modified it as such that it runs Modbus on a Controllino where the Modbus is the master and the device is the slave on RS485 RTU. The library has a limited support as the device is rather basic. The control of the bus runs from the interrupt handers. If interested, you can PM me and see if I can help you.

    Best regards,

    Johi.

    • This reply was modified 3 years, 4 months ago by  Johi.
  • Lukas

    Member
    July 21, 2021 at 12:29 pm

    Hello Ryan,

    simple Modbus Master example sketch is provided with our CONTROLLINO library for Arduino IDE.

    But at first I would recommend you to use PC+USB-RS485 converter and try to communicate with your sensor from some Modbus Master PC app.

    Good luck!

    Lukas

  • ryan

    Member
    July 23, 2021 at 8:12 am

    Hello Lukas,

    I did have the sensor connected to the PC through a RS485 To USB. I think it success. At least i got some data that seems valid to me. The problem is that when i tried to connect it to an arduino or Contollino Maxi. It failed. So, it would be great if someone could share some example that successfully connect a sensor to arduino or Controllino Maxi.

    • Lukas

      Member
      July 26, 2021 at 10:22 am

      Hello Ryan, but our examples provided with the library work fine when you have proper cabling, slave address and registry ID. Please share with us your sketch which does not work.

      Thanks,

      Lukas

      • ryan

        Member
        July 28, 2021 at 1:56 am

        Thank for you response. So, I use the example given by you guy. I have changed the

        #define SlaveModbusAdd 247

        ControllinoModbusMaster.begin( 9600 ); // baud-rate at 19200

        ModbusQuery[0].u16RegAdd = 0x19; // start address in slave

        ModbusQuery[0].u16CoilsNo = 2; // number of elements (coils or registers) to read.

        These are all the things i have changed. However , the output message doesn’t change at all.

        For ModbusRtu.h , I just copy the ModbusRtu.h from the github link you guys said on the website.\

        For cabling, I just connect the wire according to the function of them.(VCC to 5V GND to GND A to + B to -)

        • Lukas

          Member
          July 29, 2021 at 2:15 pm

          Hello Ryan,

          thanks. May I ask you also for the type of the sensor you are trying to communicate with?

          Thanks,

          Lukas

          • ryan

            Member
            July 31, 2021 at 4:41 am

            It is a temperature and humidity sensor that use Modbus RTU with Data+ and data- wire for communication with PLC. FYI, it is called EE071. Here’s the datasheet for it https://downloads.epluse.com/fileadmin/data/product/ee071/datasheet_EE071.pdf

            • Lukas

              Member
              August 17, 2021 at 8:31 am

              Hello Ryan, thanks for the link. So, you have checked with PC Modbus Master, that the slave address, register address, baudrate/parity/stop bits is correct?

              Please try to disconnect the 5V and supply the sensor from 12/24 V.

              What is the behaviour, please? No Modbus response from the sensor, or invalid response … we need more details to support you.

              Thanks,

              Lukas

Viewing 1 - 4 of 4 replies

Log in to reply.

Original Post
0 of 0 posts June 2018
Now