# How to change default state off Raspi pins at start node red service

**URL:** https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300
**Category:** General
**Created:** [14 June 2020 06:37 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300 "2020-06-14T06:37:53Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 06:37 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/1 "2020-06-14T06:37:53Z")

</div>

Hi ,

Pretty new on Node Red, I want to make a water irrigation for my garden with 2 watervalves and 1 waterflow control for security. (later on some moisture sensors and so on)  
First of all the 2 watervalves are planned to be activatet from 5 volt relays on a pi zero.

When node red starts it put my pin's state connectet to the relays low , which results in triggering the relays and opens the water flow(because the relays are low level triggered).

This results in a åben watervalve when reboot RaspOS or start node red service.  
Very bad i my situation, water shall not flow just at starting node red.

I'm looking for a solution:  
• Why is node red somehow take control over the pins state ?  
• Is it possible to design the node red flow to put the pins high at start node red?

I I prefer not to change the relays or modify them with soldering because of possible more errors.  
I want to learn more about the behavior of node red instead.

MORE INFO:  
Pins connectet 11 and 36 state of both pins are:  
1 AND IN when node red is not running

Pins connectet 11 and 36, state of both pins are:  
0 and OUT when node red is running.I guess the flow is running as well.

I read the pins with "gpio readall" command  
Pin numbers are physical pin numbers.

I will be grateful for some help here 🙂

---

<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: [14 June 2020 06:53 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/2 "2020-06-14T06:53:42Z")

</div>

Is it node red doing it or are you seeing what happens before node red gets going? Stop node red from starting on boot in order to check that.

---

<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: [14 June 2020 08:17 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/3 "2020-06-14T08:17:34Z")

</div>

If it is definitely node-red then show us how you have configured the pins in node-red. In other words how have you configured the GPIO nodes that control those pins?

---

<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: [14 June 2020 09:09 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/4 "2020-06-14T09:09:46Z")

</div>

Buy other relays that are active high or add an inverter transistor.

---

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 09:14 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/5 "2020-06-14T09:14:25Z")

</div>

Hej Colin Thanks for your reply , it is node red doing it for sure i,am nearly 100 % sure: gpio readall pins at booting Pi shows all pins in high state , dubbel checked it with toggling between node-red-start and node-red-stop (stops the NR service) and these 2 pins go high again when node red service stops.

PIN READING WITH NODE RED SERVICE STOPPED , :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/389845d7b67329d961369bc3ba1002d4afd5dc8e.png)

PIN READING WHEN NR SERVICE STARTET PIN 11 AND 36 CHANGED STATE TO LOW:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a484cecaa0f4ded0df0108ed907b9f3d0ea7d877.png)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [14 June 2020 09:23 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/6 "2020-06-14T09:23:01Z")

</div>

I note that physical pin 11 in your first image is high (1) and in `IN` mode while in the second image it is low (0) and in `OUT` mode....

---

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 09:31 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/7 "2020-06-14T09:31:10Z")

</div>

Just as a start 2 inject nodes, one with payload 0 and one with pay load 1  
2 gpio nodes with digital output and afcours the pin in question.  
INJECT NODE PIN 11:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24614b7f97aadc9fd9cce8fadb7e2e48c71cb5cf.png)

RPI GPIO NODE:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/95baaade12b3a7a1fbff99054590b90fe2496beb.png)

---

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 09:39 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/8 "2020-06-14T09:39:03Z")

</div>

Hi zenofmud , Correct and this happens when node red starts , thats my question , Why is node red doing this? these pins are connectet to a relay that low triggers. 🙂

---

<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: [14 June 2020 09:58 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/9 "2020-06-14T09:58:24Z")

</div>

In the image you have posted you have told it to initialise the pin low. If you want it initialised high then change that.

---

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 21:29 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/10 "2020-06-14T21:29:36Z")

</div>

Great , I changed the initialised pin to 1 and that solved the problem, Thanks a lot Colin ! 🙂

---

<div class="post-metadata">

### Author: ![Johannes](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Johannes](https://discourse.nodered.org/u/Johannes)
#### Post date: [14 June 2020 21:34 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/11 "2020-06-14T21:34:39Z")

</div>

Thx Edje but i do not wan't to change the hardware at first. I want to know what is going on in Node Red first.

---

<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: [28 June 2020 21:34 UTC](https://discourse.nodered.org/t/how-to-change-default-state-off-raspi-pins-at-start-node-red-service/28300/12 "2020-06-28T21:34:40Z")

</div>

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