Joining two GPIO inputs using "Join" node to output a single function

Hello everyone! Starting with some context. I'm the technical director at an escape room, and I've used node-red to control most of our electronics in one of our rooms by means of two Raspberry Pi 3s running two node-red servers, joining the two using TCP. Node-red has been a wonderful environment to work with, as I have very little coding experience and mainly do low-voltage wiring.

So, my predicament. The grand finale of the room is that the team must have one of their own sit in an "electric chair" (it really just vibrates and uses some sparkers :smile: ) while the rest of the team pushes the button to trigger the chair's execution sequence. Previously, the chair would go off whenever the button was pressed, so the general manager at my establishment wanted me to add a pressure switch to the seat of the chair to make sure someone HAS to be seated to trigger the execution sequence. I installed the switch, wired it up as an input GPIO, and realized I had no idea how to make that switch be a prerequisite or gate for the pushing of the execution button. I read that the "join" node can merge two messages to one output, so maybe that could help? I only saw examples of sensor readings being merged, however.

Would anyone have a suggestion on how to make this work? I'm running Node-RED 1.2.8

Thank you in advance,
Austin

See this article in the cookbook for an example of how to join messages into one object.

Could you just simply wire the two physical switches in series so they both have to be closed to trigger the gpio input?

That's a really good idea! My problem there is the distance between the two, there's almost 75 feet of wiring between the button and the seat sensor, sadly.

Use node-red-contrib-simple-gate which is the node red red equivalent of a series switch. Use the seat switch to control the gate so it only lets the main switch message through when appropriate.

1 Like

That shouldn't be a problem. I use opto isolation devices like the 4N25 to protect my RPi inputs. Since your only passing a small amount of current to turn on the LED in the 4N25, 75' should not be a problem.

1 Like

That sounds like a great idea! I'll add it to my palette and let you know the results! Thank you!

That's a very good point! I'll give the gate a shot, and if it doesn't work, I'll run wiring in series!

If I understand correctly you have a RPI on the chair, and another RPI remotely about 75 feet, connected together with TCP.

Maybe take a look at this - Controlling GPIOs on another Raspberry Pi - General - Node-RED Forum
you can use HTTP in/out, MQTT or maybe use the "remote GPIO", and then on device 2 use a function node with an IF statement that checks if "switch on chair" is activated.
Just an idea - I myself will check out the GPIO stuff.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.