Using GPIO with an Interrupt Handler

454 views
Skip to first unread message

Matha Goram

unread,
Apr 23, 2018, 12:06:13 AM4/23/18
to Node-RED
Hello,

I could not find any setting in the rpi gpio input node (I'm using NR v0.18.3 with RPiB+) that would permit the use of an interrupt handler. The default setting for the rpi gpio node pegs the CPU utilization to 100% upon deployment. Is there a setting for interrupt handling for this rpi node that I am overlooking? The Python spaghetti that I used previously for this test did not consume CPU to this extent.

N.B. upgrading to a newer model is not an option for this exercise.

Thanks.

Colin Law

unread,
Apr 23, 2018, 3:19:54 AM4/23/18
to node...@googlegroups.com
On 23 April 2018 at 05:06, Matha Goram <baq...@gmail.com> wrote:
Hello,

I could not find any setting in the rpi gpio input node (I'm using NR v0.18.3 with RPiB+) that would permit the use of an interrupt handler. The default setting for the rpi gpio node pegs the CPU utilization to 100% upon deployment. Is there a setting for interrupt handling for this rpi node that I am overlooking? The Python spaghetti that I used previously for this test did not consume CPU to this extent.

In that case either you are seeing a bug that as far as I know nobody else has noticed (which seems unlikely) or there is something unusual in your system or flow that causes it to use 100% CPU.  Can you give us some more details of what you are doing and produce a minimal flow that shows the problem?

Colin

Mark Setrem

unread,
Apr 23, 2018, 4:06:06 AM4/23/18
to Node-RED
It would also be good to share the version of nodejs, which version of Python RPi.GPIO you have installed and which version of operating system are you using.

Dave C-J

unread,
Apr 23, 2018, 5:37:06 AM4/23/18
to node...@googlegroups.com
The built in gpio nodes already use edge detection interrupt, so I’m not sure what’s happening. Any other loops going on ?
--
Sent from phone.

Matha Goram

unread,
Apr 23, 2018, 2:48:16 PM4/23/18
to Node-RED
Thanks, Colin et al.

Attached are two files - Word doc (sorry the RPi was too busy for any LibreOffice work!) and the errant flow in a text file. I suspect that the issue has something to do with the Raspian Stretch Chromium upgrade that occurred through my manual maintenance operations. Chromium is not working with localhost or 127.0.0.1 addresses (illustrated in the last section of the Word doc) yet it is fielding Internet addresses.

Let me know if you have suggestions on what I can try next. These RPi boards (two of 'em with similar issue are the original Model B+). On a third RPi (Model 3), I have an five different flows all working as before even after the maintenance upgrades.

Regards.
NR performance debug.docx
NRflow1Anomaly.txt

Matha Goram

unread,
Apr 23, 2018, 2:50:39 PM4/23/18
to Node-RED
Don't want to get too much in the weeds here but just for curiosity sake (I have other sensors where this come in handy), can one specify the edge type {RISING, FALLING, CHANGE}? Thanks.

Matha Goram

unread,
Apr 23, 2018, 3:00:02 PM4/23/18
to Node-RED
Node is v4.8.2
Node-RED is v0.18.4
RPi.GPIO v0.6.3
Latest update/upgrade for Raspbian Stretch have been applied too.

As I remarked in my reply to Colin, "something" in Chromium has messed up my particular RPi Model B+ boards. Looking for suggestions on the directions I should take (except for using newer boards!).

Regards.

Colin Law

unread,
Apr 23, 2018, 3:40:19 PM4/23/18
to node...@googlegroups.com
Put a debug node on the output of the gpio in to make sure it is not triggering at a massive rate.

If that is not it then remove wires till it stops consuming 100% processor. See what you end up with.  If necessary then remove nodes to find it.

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/eaa18178-fa31-4f40-97fc-f198439bb579%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Colin Law

unread,
Apr 23, 2018, 3:42:08 PM4/23/18
to node...@googlegroups.com
On 23 April 2018 at 19:48, Matha Goram <baq...@gmail.com> wrote:
Thanks, Colin et al.

Attached are two files - Word doc (sorry the RPi was too busy for any LibreOffice work!) and the errant flow in a text file. I suspect that the issue has something to do with the Raspian Stretch Chromium upgrade that occurred through my manual maintenance operations. Chromium is not working with localhost or 127.0.0.1 addresses (illustrated in the last section of the Word doc) yet it is fielding Internet addresses.

If it is hogging the processor it may just be that it has not got time to service chromium.  I presume it does still hog the processor if you close chromium though.

Colin
 

Let me know if you have suggestions on what I can try next. These RPi boards (two of 'em with similar issue are the original Model B+). On a third RPi (Model 3), I have an five different flows all working as before even after the maintenance upgrades.

Regards.


On Monday, April 23, 2018 at 2:19:54 AM UTC-5, Colin Law wrote:
On 23 April 2018 at 05:06, Matha Goram <baq...@gmail.com> wrote:
Hello,

I could not find any setting in the rpi gpio input node (I'm using NR v0.18.3 with RPiB+) that would permit the use of an interrupt handler. The default setting for the rpi gpio node pegs the CPU utilization to 100% upon deployment. Is there a setting for interrupt handling for this rpi node that I am overlooking? The Python spaghetti that I used previously for this test did not consume CPU to this extent.

In that case either you are seeing a bug that as far as I know nobody else has noticed (which seems unlikely) or there is something unusual in your system or flow that causes it to use 100% CPU.  Can you give us some more details of what you are doing and produce a minimal flow that shows the problem?

Colin

Dave C-J

unread,
Apr 24, 2018, 3:13:31 AM4/24/18
to node...@googlegroups.com
Hi
No you can’t specify the edge. It uses both by default.
Node 4.8.2 is out of date. You may want to follow our upgrade instructions 
--
Sent from phone.

Matha Goram

unread,
Apr 24, 2018, 6:35:47 PM4/24/18
to Node-RED
Oh, no! Yet another simple mistake on my part. I didn't pay attention to version since I thought Raspbian Stretch would take care of the upgrade (at least a more recent version but not the bleeding edge). Upgrading node the right way should resolve my issue.

Thanks.

Matha Goram

unread,
Apr 24, 2018, 6:37:31 PM4/24/18
to Node-RED
Closing Chromium had a minor effect - the utilization now hovers between 85 and 90+ per cent. I try your other suggestions soon.

Regards.

On Monday, April 23, 2018 at 2:42:08 PM UTC-5, Colin Law wrote:
On 23 April 2018 at 19:48, Matha Goram <baq...@gmail.com> wrote:
Thanks, Colin et al.

Attached are two files - Word doc (sorry the RPi was too busy for any LibreOffice work!) and the errant flow in a text file. I suspect that the issue has something to do with the Raspian Stretch Chromium upgrade that occurred through my manual maintenance operations. Chromium is not working with localhost or 127.0.0.1 addresses (illustrated in the last section of the Word doc) yet it is fielding Internet addresses.

If it is hogging the processor it may just be that it has not got time to service chromium.  I presume it does still hog the processor if you close chromium though.

Colin
 

Let me know if you have suggestions on what I can try next. These RPi boards (two of 'em with similar issue are the original Model B+). On a third RPi (Model 3), I have an five different flows all working as before even after the maintenance upgrades.

Regards.


On Monday, April 23, 2018 at 2:19:54 AM UTC-5, Colin Law wrote:
On 23 April 2018 at 05:06, Matha Goram <baq...@gmail.com> wrote:
Hello,

I could not find any setting in the rpi gpio input node (I'm using NR v0.18.3 with RPiB+) that would permit the use of an interrupt handler. The default setting for the rpi gpio node pegs the CPU utilization to 100% upon deployment. Is there a setting for interrupt handling for this rpi node that I am overlooking? The Python spaghetti that I used previously for this test did not consume CPU to this extent.

In that case either you are seeing a bug that as far as I know nobody else has noticed (which seems unlikely) or there is something unusual in your system or flow that causes it to use 100% CPU.  Can you give us some more details of what you are doing and produce a minimal flow that shows the problem?

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
Reply all
Reply to author
Forward
0 new messages