# GPIO state changes only after reboot of Node-RED

**URL:** https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285
**Category:** General
**Tags:** gpio
**Created:** [3 August 2023 11:32 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285 "2023-08-03T11:32:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Sulomus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sulomus/32/49578_2.png) [@Sulomus](https://discourse.nodered.org/u/Sulomus)
#### Post date: [3 August 2023 11:32 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/1 "2023-08-03T11:32:57Z")

</div>

Hello,  
I have a problem reading the digital IO from Node-RED. The raspberry PI Computing module 4 is enclosed in [reTerminal DM](https://www.seeedstudio.com/reTerminal-DM-p-5616.html?gad=1&gclid=CjwKCAjw-b-kBhB-EiwA4fvKrEE71-vnIGQ-RpicwCmWwOqoem6PswAu3dE35zapBYSrVAjXceJtuRoClDwQAvD_BwE) industrial HMI.

[In documentation](https://files.seeedstudio.com/wiki/reTerminalDM/reTerminal-DM-User-Manual.pdf) it is specified that Digital Input 1 is GPIO pin 16. Therefor I have connected a position sensor into Digital Input 1 and ground to GND\_INPUT.

With my voltmeter I can confirm that the position sensor is outputting 24V when triggered and 0 when not.

I have noticed that the input GPIO node is actually changing according to the position sensor BUT!

- **But it only changes after redeployment of the whole Node-RED! See video attachment.**
- I have connected DI1 to output signal of the Festo position sensor and DI\_GND to ground of the Festo position sensor
- I know for sure that there is voltage because my voltmeter reads 24V when triggered and 0V when not triggered.

How can I solve this problem?

This is the link for the video: [video\_demonstration.mp4 - VEED](https://www.veed.io/view/f95e65ae-f03c-4a88-9980-56fe4b2926af?panel=share)

Is there something I need to configure in the Node-RED?

`[{ "id": "a9c27808bef7b34a", "type": "debug", "z": "103c0611d42ccc43", "name": "debug 24", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 560, "y": 200, "wires": [] }, { "id": "b13d3ca712220c36", "type": "pi-gpiod in", "z": "103c0611d42ccc43", "name": "", "host": "localhost", "port": 8888, "pin": "16", "intype": "PUD_OFF", "debounce": "25", "read": true, "x": 310, "y": 200, "wires": [[ "a9c27808bef7b34a"] ] }, { "id": "0c4a26fd670926f0", "type": "pi-gpiod in", "z": "103c0611d42ccc43", "name": "", "host": "localhost", "port": 8888, "pin": "17", "intype": "PUD_OFF", "debounce": "25", "read": true, "x": 310, "y": 240, "wires": [[ "a9c27808bef7b34a"] ] } ]`

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [3 August 2023 12:09 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/2 "2023-08-03T12:09:36Z")

</div>

Does the Festo sensor has his own supply? Or does it have only 2 wires?  
Do you have type number and/or datasheet for the sensor?

---

<div class="post-metadata">

### Author: ![Sulomus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sulomus/32/49578_2.png) [@Sulomus](https://discourse.nodered.org/u/Sulomus)
#### Post date: [3 August 2023 13:50 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/3 "2023-08-03T13:50:56Z")

</div>

> [@edje11](#):
>
> Do you have type number and/or datasheet for the sensor?

The FESTO position sensor has 3 wires:

- Ground
- 24V Power supply
- Signal

---

<div class="post-metadata">

### Author: ![Sulomus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sulomus/32/49578_2.png) [@Sulomus](https://discourse.nodered.org/u/Sulomus)
#### Post date: [3 August 2023 14:01 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/4 "2023-08-03T14:01:46Z")

</div>

Again I need to highlight the fact that the value in Node-RED changes **ONLY AFTER REDEPLOYMENT.**

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [3 August 2023 17:55 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/5 "2023-08-03T17:55:59Z")

</div>

Is the output of the sensor not an open collector and requires a pull up resistor?  
Again, do you have type of the sensor?

Don't think is a NR issue, more a hw problem.

---

<div class="post-metadata">

### Author: ![Sulomus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sulomus/32/49578_2.png) [@Sulomus](https://discourse.nodered.org/u/Sulomus)
#### Post date: [4 August 2023 07:21 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/6 "2023-08-04T07:21:19Z")

</div>

[This is the PDF documentation](https://www.festo.com/gb/en/a/download-document/datasheet/547908?fbclid=IwAR3E8i2X-C-Bo7GaDW2Ib8lk1uvHAIcK4xvLbVWD6S0I-oi5XC9yog2nseM) of the sensor.

It is PNP sensor - I do not know if it requires a pull up resistor. But when I connect it to standard PLC I do not use any pull up / down resistors.

---

<div class="post-metadata">

### Author: ![Sulomus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sulomus/32/49578_2.png) [@Sulomus](https://discourse.nodered.org/u/Sulomus)
#### Post date: [4 August 2023 07:27 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/7 "2023-08-04T07:27:11Z")

</div>

@edje11  
I have now tested the GPIO library in terminal and when I run the `rapsi-gpio get 16` command the value changes accordingly to the position sensor ... 😕

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [3 October 2023 07:27 UTC](https://discourse.nodered.org/t/gpio-state-changes-only-after-reboot-of-node-red/80285/8 "2023-10-03T07:27:41Z")

</div>

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