Modbus comunication loss

I have a v5 gateway running firmware 7.31 and a Temp/humidity probe connected, use the modbus protocol to retrieve temp and humidity for a status report. But it seams that every now and then the gateway losses the modbus functionality.
When looking at the seeings page it seams to be enabled, but not functioning. When re enable the modbus everything works again for a period.

Has anybody seen this?
and is there a workaround other then when it fails to do a manual re enable.?
Maybe a new firmware where this works?

I was about to buy multiple setups to run throughout our production facilities but if modbus is so unstable this is not a viable option.



  • At first I thought that this bug was provoked by mains fail but we have now verified that it loses Modbus communication even without mains fail aka. running idle....

  • Hi Kenni,

    Do you happen to know every how many minutes or seconds that the modbus data is disconnecting?
    You may try to reflash and reload the same firmware also. If it disconnects, the other work around is to do a restart of the gateway.

  • Hi Tim

    No we do not know how many minutes/hours it takes for the modbus interface to crash, i will try to reflash the firmaware. But in a live environment the work around with restart is a not an option.
    That is simply not good enough for a service that must be reliable.
    Also the internal clock is reset on every reboot..... this is why we know that the modbus service stops to work in ideal mode.


  • Hi Kenni,

    Can you provide me the setup you have so we can replicate it as well.
    Is your gateway connected to a sensorhub or stand alone with just the temp/humidity sensor? Is there other sensors connected to the gateway? What is the poll rate you used on modbus?

    So after modbus disconnects, it still reconnects itself or would not reconnect? The only way it would reconnect is you go to the modbus tab of the web interface and re enable it?

  • What is the modbus software that you are using?

  • kthkth
    edited January 2017
    Hi Tim,

    A reflash of the firmware did not solve the problem.

    The setup is only a gateway stand alone with the temp/humidity sensor connected.
    There are no other sensors connected.

    We are using a Ruby script to fetch the data from the gateway, here we are using the rmodbus library.
    This script and library are 100% functioning when the gateway is running and modbus is enabled. But when the modbus fails on the gateway, we are not able to communicate over modbus with the script or modbus poll.

    We are connecting and disconnecting on every request from the script... hence no poll rate
    the script is run every time a test of our equipment is done approx 50-100 times a day. The temp and humidity is then written into a database to prove the environment for which the test was carried out.

    When the modbus fails i have to reboot the device to re-enable it. The enable modbus from the webinterface does not work, when the service is down.

    Below is a small example of the interface we use to communicate with the gateway, nothing fancy in that.

    def initialize(ip ='', slaveID='1', port='502')
    @ip = ip
    @slaveID = slaveID
    @port = port
    @modbus = nil
    # create the modbus connection
    @modbus =, @port)

    # create a slave instance
    @slave = @modbus.with_slave(@slaveID)
    rescue Exception => e
    puts e
    end #end initialize

    # Description::
    # This method reads the modbus address of the internal temperature of the sensor gateway
    # The internal modbus address is 30200 q4 on a PLC base 1
    # This is the same as 0 based add 199
    def read_internal_temp
    value = 0.0
    # Read input reg address 199 (0 based) quantity of two, convert to float and round with 1 decimal
    value = @slave.read_input_registers(199, 2).to_32f[0].round(1)
    rescue Exception => e
    puts e
    return value
    end #end read_internal_temp

  • Kenni,

    Where did you get the rmodbus library? Is it from a specific application you borrowed or downloaded?

    Also as a user, we have tried Modbus/IP on the gateway with sensors. You may try to use the modpoll to pull up data-

    You may set a higher poll rate for modbus on the modpoll application.

  • kthkth
    edited January 2017
    Hi Tim

    The rmodbus is the ruby modbus communication library and it works on all the other products we have running modbus..... i would say in that setup alone we are running ~25 modbus clients all responding except your tool. Yes i have already used "Modbus Poll" due to the fact that i work together with the author of the tool Brian Witte... here in Skive Denmark.
    And when your service stops responding modbus poll also does not work,

    The problem is not my implementation but the fact that your product ends up in a state where your modbus service stops communicating.

    I would gladly help to recreate the problem and provide data, but the fact is that the service stops responding for some reason, and only a power cycle of the product works to bring it back.

  • Hi,

    If you are able to get modbus data from the gateway, it is readily modbus available upon enabling modbus. The gateway is designed to still poll data even on an instance that it has timeout. So no need for a power cycle or rebooting the gateway to reenable the service.

    We have also experienced timeout at around 500ms or 1000ms poll rate due to loss, but even upon timeout the gateway would still get modbus data on the modbus poll without any need to reboot the unit or reenabling modbus. You may also set the poll rate at around 1000ms to be on the same poll speed as with the gateway. Logs still shows continuous data gathering even at some point there is a timeout.

    Try also to connect the gateway on a separate computer to isolate it from the rest and just due for testing. Connect it on a separate switch and to a dedicated computer with modbus poll.

  • Hi Tim,
    I think you misunderstand this completely.
    I am not talking about timeout in the service, we work with modbus all the time we know how it works.
    I am talking about the modbus not responding for hours and hours not just 500ms, and we have tried to use different poll rates.

    When the service fails it really fails...... not talking about timeouts.... and only power cycle works!
  • Hi,

    I understand you on this. If the service is failing and not doing an autoconnect then it could be something with the gateway. You may then instead file an RMA for the sensorgateway as it should not happen that way and only a power cycle can reenable the service.


Leave a Comment