Remote access to GPIO from internet

#1

Hi!

I am new to Node-Red and have managed to control a led via a gpio pin on my raspberry pi. My problem is that I can only control it if the device that I am using to control is connected to the same wifi connection as my pi.

How can I control the gpio pin on the pi from a device that is connected to a different wifi network (so that I can control the gpio remotely)?

Thanks a lot and sorry for the noob question!

#2

Some ways to do this would be use twitter, or another messaging app, so you look for a message from a person or with a certain keyword to trigger the flow.

If you mean " i want to connect Node-RED to the internet" it comes with security warnings, but there is a guide here https://github.com/node-red/cookbook.nodered.org/wiki/How-to-safely-expose-Node-RED-to-the-Internet

#3

Thanks a lot for you answer!
I thought it would be much more straight forward that that… :frowning:

The link you sent is very informative though so I’ll try to work it out!

#4

You will need to run node-red on the pi that has the GPIO pins. Then the question is how to tell that instance of node-red what to do from somewhere remote. As ukmoose has suggested, using a messaging app is a good way to do that without exposing the pi to the internet, which is fraught with danger. Telegram is used by many as the messaging app.

#5

It’s been shown that a new device (like your RPi) attached directly to the internet will be located and probed within 15-30 seconds of being connected… thus the hoops you need to jump through to ensure that others are not able to take over the device and potentially have access to other devices (or smart control systems!) on your local network.

So, if you really do need to access the node-red editor from the internet, please be safe and follow the directions – if you just want to send and receive msgs from your running flows, then twitter, email, and telegram are good (and safer) solutions for most people. Good luck!

#6

Roger that.

Thank you all for the feedback! It is greatly appreciated!

#7

i will reinforce the message given by others. The relatively easy way to expose your system across the Internet is to use something like Telegram. This is probably the easiest of the secure messaging apps on which to build the “bot” interface you need and there are a couple of contributed sets of nodes to help you along the way.

It is possible to build up quite a sophisticated interface if you need to - for example if the rest of your family need to use it :slight_smile:. There are plenty of examples available for you, check the flows site or do a Google search. If you get stuck, there are plenty of people who will help you untangle what you’ve started.

1 Like
#8

Something to consider is that recent releases of Raspbian for the Pi include the RealVNC server https://www.realvnc.com/en/. You get a personal-use license and limited access to their cloud service. You can configure the client (VNC Viewer) on your computer or phone for remote (internet) access to the Pi desktop, where you can run a browser connected to Node-RED, either the editor, dashboard, or both. Performance for editing flows is not great, and obviously you have to run the desktop version of Raspbian, but for pushing a dashboard button connected to a gpio pin it should be fine.

1 Like