# Gpio timer duration,

**URL:** <https://discourse.nodered.org/t/gpio-timer-duration/4566>\
**Category:** General\
**Created:** [4 November 2018 22:32 UTC](https://discourse.nodered.org/t/gpio-timer-duration/4566 "2018-11-04T22:32:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghbisson](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Ghbisson](https://discourse.nodered.org/u/Ghbisson)\
**Post date:** [4 November 2018 22:32 UTC](https://discourse.nodered.org/t/gpio-timer-duration/4566/1 "2018-11-04T22:32:24Z")

</div>

I would like to measure how long a gpio input is "On" so I could send a notification after a certain period of time. I looked at some nodes and at first look I can't find nodes that would do such a thing.  
Any good idea to fullfill this function ?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [5 November 2018 06:45 UTC](https://discourse.nodered.org/t/gpio-timer-duration/4566/2 "2018-11-05T06:45:15Z")

</div>

Hi,

You can try my [node-red-contrib-interval-length](https://github.com/bartbutenaers/node-red-contrib-interval-length) node. Because you are measuring the time interval between a message containing an ON, and a message containing an OFF. It can also send a timeout message, when after X (milli)seconds no input message has arrived.

Let me know about your progress!

P.S. Keep in mind that you cannot get high accuracy measurements.

Good luck!  
Bart

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 November 2018 09:13 UTC](https://discourse.nodered.org/t/gpio-timer-duration/4566/3 "2018-11-05T09:13:28Z")

</div>

> [@Ghbisson](#):
>
> I would like to measure how long a gpio input is "On" so I could send a notification after a certain period of time. I looked at some nodes and at first look I can't find nodes that would do such a thing.  
> Any good idea to fullfill this function ?

I think node-red-contrib-mytimout should be able to do that for you.

> **[node-red-contrib-mytimeout](https://www.npmjs.com/package/node-red-contrib-mytimeout)**
>
> A timer that supports setting the run time by passing JSON to the input. Latest version: 3.2.2, last published: 2 years ago. Start using node-red-contrib-mytimeout in your project by running \`npm i node-red-contrib-mytimeout\`. There are no other...
