# Heartbeat

**URL:** <https://forum.inductiveautomation.com/t/heartbeat/3415>\
**Category:** Ignition\
**Created:** [October 11, 2011, 7:01pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415 "2011-10-11T19:01:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinmarchand](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@kevinmarchand](https://forum.inductiveautomation.com/u/kevinmarchand)\
**Post date:** [October 11, 2011, 7:01pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415/1 "2011-10-11T19:01:57Z")

</div>

Hi,

```
Is there a way sugest by Inductive Autmation to setup a heartbeat between Ignition and a PLC?

Thanks
```

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [October 11, 2011, 7:18pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415/2 "2011-10-11T19:18:59Z")

</div>

There are a couple of ways to do this. Do you want the heartbeat to be generated by the PLC or by Ignition?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 11, 2011, 7:24pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415/3 "2011-10-11T19:24:34Z")

</div>

[Here’s a topic](http://inductiveautomation.com/forum/viewtopic.php?f=13&t=4623&hilit=+heartbeat) from back in the FSQL days, but still applicable.

---

<div class="post-metadata">

**Author:** ![RRNut](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@RRNut](https://forum.inductiveautomation.com/u/RRNut)\
**Post date:** [October 12, 2011, 11:53pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415/4 "2011-10-12T23:53:34Z")

</div>

I use a DB tag that looks at the time of last change of a PLC tag that is always changing. Here is the expression on the db tag.

try(if(dateDiff({[~]PLC/InternalTimerReg.LastChange},now(), “minute”) \< 2, 0, 1), 2)

Basically the expression looks at the last time the tag changed and if it’s less than 2 minutes the tag value is 0. If its greater than 2 minutes then it sets the tag to 1. I added the try just in case there is an error with the if or datediff funcitons.

---

<div class="post-metadata">

**Author:** ![dale](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dale](https://forum.inductiveautomation.com/u/dale)\
**Post date:** [June 8, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/heartbeat/3415/5 "2022-06-08T22:19:50Z")

</div>

Thanks! This was very helpful for creating a MQTT comm fail alarm.  
Had to create two tags, since I’m using UDTs.  
Note that {GroupID} is a UDT parameter and {RootInstanceName} is defined automatically with any UDT.  
Tag#1: Derived integer tag which just monitors system clock minute; here is the source tag path I used:  
[MQTT Engine]Edge Nodes/{GroupID}/{RootInstanceName}/Tags/Clock\_Minute

Tag#2: Expression boolean tag to trigger an alarm, here is the expression:  
if(dateDiff({[.]…/Statuses/Unit\_Comm\_Status.LastChange},now(),“minute”)\<2,0,1)  
( Note: ‘Unit\_Comm\_Status’ is Tag#1 )
