Polling inputs

Brecht

New member
Hello everyone,

I use Sequent Microsystem HATs for my home automation. All my switches are connected to 'Sixteen LV Digital Inputs' which I poll from node-red every 10ms to detect button events. As polling is not efficient and 99% of the time nothing can be detected, I was wondering how I could optimise this. I've read that other HAT's have interrupt handlers, but this is not mentioned in the manual of the 16LV input HAT.

Any thoughts on how I can optimise this?

Thanks!

Manual of the Industrial Automation V3 8-Layer Stackable HAT for Raspberry Pi:
Two of the Raspberry Pi’s GPIO pins are used for I2C communication. Another pin is allocated for the
interrupt handler, leaving 23 GPIO pins available for the user
 

alexburcea

Moderator
Staff member
Hi,
Assuming you have V2.x, there is an interrupt pin connected to Raspberry PI GPIO11. But I am not sure that is your problem because the inputs are filtered out for using AC signals. It is hard to tell you the cutoff frequency of the filter because this depends of the voltage you use for the switch but is not greater than 10Hz. Your 10ms should catch any transition if any (actually the 10ms will overload the Raspberry I2C port, if NodeRED manage to do a request each 10ms). If you see the corresponding LED flashing when you push the button, you should be able to catch that event but if you did not see it, the voltage was too low and/or contact was too fast.
Please let me know what version of the card you use and input voltage.
 

Brecht

New member
Hi Alex,
I'm not sure if we understand eachother correctly, but I'm not really having a problem, I rather like to optimize the communication between the rpi and the HAT's. That is why I informed about the polling solution.
Is there a way to check the version of the card via software? Because the HATs are stacked and it's hard for me to unplug my installation. My order was in oktober '23 (Order SH-4609). All my digital inputs are working on 24V DC.

Thank you
 

alexburcea

Moderator
Staff member
Hi,

Considering your order date you have 16-inputs V2.0 so you can use internal pullup and interrupt on GPIO11 to optimize the code (access the card only if you get interrupt on GPIO11).

Alex.
 

indygreg

New member
i have the V4 8-Layer Stackable HAT and had a similar question to brecht. does this mean i could use the node red raspberry pi gpio node as an input to your IOPLUS OPTIn node to effectively trigger a reading when the state of the pin changes? i am new to node-red if i read this right would you mind walking through how to set this up?
 

alexburcea

Moderator
Staff member
Theoretically yes, this means the raspberry GPIO26 is connected to the local processor but we need to change the firmware for that.
Give me few days to make a new firmware release for Home Automation HAT and I will let you know.
 

indygreg

New member
Theoretically yes, this means the raspberry GPIO26 is connected to the local processor but we need to change the firmware for that.
Give me few days to make a new firmware release for Home Automation HAT and I will let you know.
(i just fell in love with this product) :)
 

alexburcea

Moderator
Staff member
Hi,

Please update card firmware , instructions here.
Now, if opto inputs are changing the GPIO26 will go low for 10ms. We did this way because we need to release the pin for the button which is connected also here.
You can use "rpi gpio-in" node. Please set the debounce interval less than 10ms (5 is a good number).
The node will generate 2 events per opto change but you can discard one.
Let me know if you have any questions.
 

indygreg

New member
perhaps i am doing something wrong?



greg@PI1:~/ioplus-rpi/update $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
(use "git add <file>..." to include in what will be committed)
../ioplus
../node-red/node_modules/
../node-red/package-lock.json
../node-red/package.json

nothing added to commit but untracked files present (use "git add" to track)
greg@PI1:~/ioplus-rpi/update $ ./update 0
bash: ./update: cannot execute: required file not found
 
Top