Modbus is one of the most used industrial automation protocols. In this post, I will explain what a Modbus heartbeat is and how it is used.
What is Modbus Heartbeat?
A heartbeat is either a bit or a holding register that changes state for external devices to tell that the industrial controller (most of the time the PLC) is running.
What is the main function of the Modbus Heartbeat?
The main function of the heartbeat is to facilitate the detection of communication problems in programming environments where the transport layer communication error information is unavailable.
This increments approximately every 5 to 10 seconds. It is the responsibility of the system integrator to notify plant personnel if a Modbus master (the PLC or DCS system) fails to communicate with the transmitter. This register can facilitate this notification.
How is Modbus Heartbeat implemented?
The implementation of a heartbeat depends upon the master and slave in question. For most master applications, a heartbeat can be any simple message that is sent out to each slave to ensure that even if they have nothing new to report, at least they are online and in communication.
The timer register in the master will be expecting the information every 5 seconds (some manufacturers have this time of 10 seconds).
The external device that is communicating with this device would compare over time to see if the register is changing. If it does not, then the external device would declare either a master failure or a comm fail.
In most of the applications, there is no need to implement the heartbeat. This is because most of the Modbus slave units do not respond to Modbus commands unless they are operating. In such cases, just use a normal Modbus Read function.
What is heartbeat in PLC?
A PLC heartbeat signal is a signal that is periodically sent by a programmable logic controller (PLC) to indicate that it is still functioning properly. The signal is used by the PLC’s watchdog timer to confirm that the PLC is running correctly.
Conclusion
The Modbus heartbeat is like a watchdog that will make sure that there is communication between the master and slave in a Modbus communication. This bit or register is not widely used in industrial communication, as most slave devices will not respond to master queries if they are not in communication.