Rpi-gpio input node "stopped"

I'm trying to follow the Rapsberrypi.org guide "getting started with Node-RED"

I completed very easily the first flow for switching on/off a LED with a rpi-gpio out node and two inject nodes, but I got stuck adding a button with a rpi-gpio in node to control the LED. This is step 11 in the above-mentioned getting started guide.

The button shows as "stopped" and does not change its state after pressing it

I have a RPi2 Model B with the following raspbian and node-red versions:

Description:    Raspbian GNU/Linux 9.1 (stretch)
Release:        9.1
Codename:       stretch

Welcome to Node-RED
===================

25 Nov 17:24:58 - [info] Node-RED version: v0.19.4
25 Nov 17:24:58 - [info] Node.js  version: v8.11.1
25 Nov 17:24:58 - [info] Linux 4.9.41-v7+ arm LE

For the rpio-gpio in node (that's the node for my press button) I have the same properties as in the tutorial, one pin connected to GPI04-7 (with pullup resistor) and the other one to GND. That should mean that GPIO pin 4 will be set to HIGH, and pressing the button will cause it to go LOW.

I've also added a debug node to check if the payload changes from 1 to 0 but I only get this first message (this "1" is due to the pullup resistor and the checkbox "Read initial state of pin on deploy/restart" being marked in the settings):

11/25/2018, 10:30:52 AMnode: f5cc3952.9c7f58
pi/7 : msg.payload : number
1

But after that, the flow diagram shows the button as "stopped" and nothing happens when I press the button.I've double-checked the wiring and it's identical to the one in the tutorial.

Are there any messages printed to the window where you copied the “welcome to node-red” message from?

Nope. It only shows the server start messages and start/stop flow messages, but nothing happens when I press the button.

By the way, I should say that node-js was already installed in my raspbian version, I havent installed it myself.

I include the node-red console messages:

pi@raspberrypi:~ $ node-red
26 Nov 02:20:32 - [info] 

Welcome to Node-RED
===================

26 Nov 02:20:32 - [info] Node-RED version: v0.19.4
26 Nov 02:20:32 - [info] Node.js  version: v8.11.1
26 Nov 02:20:32 - [info] Linux 4.9.41-v7+ arm LE
26 Nov 02:20:38 - [info] Loading palette nodes
26 Nov 02:20:47 - [info] Settings file  : /home/pi/.node-red/settings.js
26 Nov 02:20:47 - [info] Context store  : 'default' [module=memory]
26 Nov 02:20:47 - [info] User directory : /home/pi/.node-red
26 Nov 02:20:47 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
26 Nov 02:20:47 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
26 Nov 02:20:47 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

26 Nov 02:20:47 - [info] Starting flows
26 Nov 02:20:48 - [info] Started flows
26 Nov 02:20:48 - [info] Server now running at http://127.0.0.1:1880/
26 Nov 02:23:11 - [info] Stopping flows
26 Nov 02:23:11 - [info] Stopped flows
26 Nov 02:23:11 - [info] Starting flows
26 Nov 02:23:11 - [info] Started flows

Does changing the pin to 40-GPIO21 make any difference?

1 Like

From the documentation, have you tried:

sudo apt-get update && sudo apt-get install python-rpi.gpio

Also, the user must be a member of the gpio group. To add the current user to the group

sudo adduser $USER gpio

Yes! it works with BCM21
Why is that?

It could be that something else is controlling access to pin7 (gpio4)

I'm working with pi user, which belongs to gpio group already.
I've installed node-red from scratch in another RasPi using the script:

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

But the button remained also "stopped". Trying with pin gpio21 instead of gpio04 worked, though.

Thanks! it works actually with any other GPIO pin except with GPIO04.(GPCLK0). Even the other two GPCLK pins (BCM5 & 6) work, but not GPIO04.
How could I check if there's something interfering with that pin? I have no other circuits connected to the RPi.

That pin is used for a clock output or something I think. If you have not disabled that use then it was still being acquired by that so you could not use it.

1 Like

Run raspi-config and check that 1-wire is disabled.

1 Like

Sorry guys! I've tried all the post above, but nothing... I'm stucked on "stopped" on every PIN I try to use.
Any help... please!

@naamah75

  1. what version of Raspbian?
  2. what version of NR and node.js?
  3. what is your flow?
  4. What gpio node are you ruing?
  5. have you added a catch node attached to a debug node to see if something shows up?
  6. is anything showing in the log?

Raspbian 4.19.42
Node-Red 0.20.7
node.js 10.16.0

I'm tring to test a very simple flow:

[{"id":"d4e89534.91d728","type":"debug","z":"a0828933.d7acb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":390,"y":160,"wires":[]},{"id":"8e6c472d.8a8608","type":"catch","z":"a0828933.d7acb8","name":"","scope":null,"uncaught":false,"x":240,"y":100,"wires":[["fd9db602.965038"]]},{"id":"fd9db602.965038","type":"debug","z":"a0828933.d7acb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":390,"y":100,"wires":[]},{"id":"864afcd8.23514","type":"rpi-gpio in","z":"a0828933.d7acb8","name":"","pin":"11","intype":"tri","debounce":"25","read":false,"x":230,"y":160,"wires":[["d4e89534.91d728"]]}]

image

I've no error or warn in the log.

Using command gpio read 0 I'm able to read the status of a wired pushbutton; so I'm sure that the hardware is working.

Is this running on a pi?
how do you have the button connected i.e. what pins are you using?

My hardware is a Pi 3B+
I've tried a lot of pins, and all of those I've tried it works with the command line gpio command but none with Node-Red.
The GPIO node is "stopped" and cannot acquire or write any pins.

Can you copy and paste the Node-RED startup log?

Do you mean the log that is shown on the terminal window during startup? or there's a log file? in this case where to find the file?

the console log shown in the terminal window

Welcome to Node-RED
===================
11 Jul 07:14:49 - [info] Node-RED version: v0.20.7
11 Jul 07:14:49 - [info] Node.js  version: v10.16.0
11 Jul 07:14:49 - [info] Linux 4.19.42-v7+ arm LE
11 Jul 07:14:53 - [info] Loading palette nodes
11 Jul 07:15:04 - [info] Settings file  : /home/pi/.node-red/settings.js
11 Jul 07:15:04 - [info] Context store  : 'default' [module=memory]
11 Jul 07:15:04 - [info] User directory : /home/pi/.node-red
11 Jul 07:15:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Jul 07:15:04 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
11 Jul 07:15:04 - [info] Failed to get version from Pi
11 Jul 07:15:04 - [info] Server now running at http://127.0.0.1:1880/
11 Jul 07:15:04 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
11 Jul 07:15:04 - [info] Starting flows
11 Jul 07:15:05 - [info] Started flows
11 Jul 11:34:04 - [info] Stopping modified flows
11 Jul 11:34:04 - [info] Stopped modified flows
11 Jul 11:34:04 - [info] Starting modified flows
11 Jul 11:34:04 - [info] Started modified flows