Control GPIO Raspberry pi with Node-red in Windows PC

Good afternoon

I have Node-red installed on a Windows PC.
I would like to know how to control Raspberry Pi GPIO.
I know that the Raspberry pi / Rasbian has the Node-Red installed

Thank you

Well, there are a couple of things you need to set up first.

You have to configure the RasPi to allow remote GPIO control.

It is one of the settings in the raspi-config screen.

Then you will need to communicate between the two machines.
MQTT is a nominal protocol to use.
On one of the machines you will have to install the MQTT broker.

Try this link for how to.

Then you set up a flow (program) where you send commands to turn certain GPIO pins on/off on the RasPie.

On the RasPie, you receive said messages and send the message to the respective GPIO pin.
(Node called RasPiGPIO from memory)

Thanks for responding so quickly.

The configuration screen is Remote GPIO interfaces?
I also have the Mosquitto broker installed on the Raspberry.

The question is how do I communicate with the Node-Red nodes with the Rasberry some example

Thank you

Either when you run raspi-config (from the CLI on the RasPi) or you select the config from the menu there is an option to allow remote control of the GPIO pins.

That MUST BE SET to ....... allow remote control of GPIO pins.

I am not using a RasPi just now so I can't give you a 100% sure answer to which it is.

On the windoze machine, you put an inject node to send a message.

This is a basic flow:
Read the ReadMe node!

[{"id":"6d994209.790b24","type":"inject","z":"b4f1ccd4.5e8d1","name":"GPIO pin (in TOPIC) ON","topic":"3","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":930,"wires":[["74d3359f.b13b8c"]]},{"id":"74d3359f.b13b8c","type":"mqtt out","z":"b4f1ccd4.5e8d1","name":"","topic":"RASPIGPIO","qos":"","retain":"","broker":"8a2e80be.f7c928","x":460,"y":930,"wires":[]},{"id":"f7f385ef.6a98a","type":"mqtt in","z":"b4f1ccd4.5e8d1","name":"","topic":"RASPIGPIO/#","qos":"2","datatype":"auto","broker":"8a2e80be.f7c928","x":180,"y":1040,"wires":[["88237861.71a708"]]},{"id":"44091c56.c84b64","type":"inject","z":"b4f1ccd4.5e8d1","name":"GPIO pin (in TOPIC) OFF","topic":"3","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":970,"wires":[["74d3359f.b13b8c"]]},{"id":"88237861.71a708","type":"switch","z":"b4f1ccd4.5e8d1","name":"you get the idea","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":380,"y":1040,"wires":[[],[],["ef5c67b7.442068"]]},{"id":"ef5c67b7.442068","type":"function","z":"b4f1ccd4.5e8d1","name":"RASPIGPIO NODE","func":"\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1100,"wires":[[]]},{"id":"f0f610a8.32fbe8","type":"comment","z":"b4f1ccd4.5e8d1","name":"Read Me!","info":"The node below is a `function` node because I don't have the node/s installed as this machine is not a RasPi.\n\nThe top half you put on your PC, the lower on the RasPie.\n","x":630,"y":1060,"wires":[]},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Thanks so much

I have import your code and i have put in Node-Red

Tomorrow are the tests

Note: When I say PC = my computer

Thanks, again Andrew

Please understand, I am still learning Node-Red. So there are no promises.

Are you sure you need to run node-red on both the PC and on the Pi? If you run it in the Pi you can connect to it from the PC using your browser and control what you like on the Pi.

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