Communication between Raspberry Pis on different networks
from illectrility@sh.itjust.works to python@programming.dev on 06 Mar 2024 17:01
https://sh.itjust.works/post/15794141

I’m sorry if this isn’t the place to ask this, I also asked over at !raspberrypi@lemmy.ml.

So what I want to do is this: Two RasPis are at different locations. They’re on different networks but have internet access. Pressing a button on one of the Pis turns on an LED over at the other Pi via GPIO. How can I make the communication work? My first thought was Telegram bots as I’m familiar with those for notifications but you can’t have Telegram bots communicate with each other, sadly. Is there a good (and secure) solution to this? Preferably using Python code and without continuous costs like server hosting, etc?

Thanks!

#python

threaded - newest

NegativeLookBehind@lemmy.world on 06 Mar 2024 17:16 next collapse

Oracle cloud “always free” tier VM instance, which you could setup a VPN to, from each Pi.

Disregard3145@lemmy.ml on 06 Mar 2024 17:59 next collapse

For a simple one way communucation where latency is unimportant, you might leverage any number of free services with apis you can abuse. You could send a tweer, or nastodon message, You could have one just update a file with a timestamp as a github gist or on pastebin or something.

There are also free mqtt broker services.

Or you could put one on the public internet with ddns name and talk directly to it.

Or you could set up a VPN between them - is logmein still a thing? - and then talk to each other directly via that interface

danielquinn@lemmy.ca on 06 Mar 2024 18:37 next collapse

The easiest & cheapest option would be to expose one of the devices to the internet on a known port and connect from the other device to that one with SSH.

Once you’ve got a connection, you can do pretty much anything you want, including writing to a pipe or even a file and polling it.

If you don’t want to expose either, then you need a third party to facilitate the connection that is on the Open internet, though that server can be yours too. Even a €4/mo box at Hetzner would do it.

If these options sound good, let me know and I can be more detailed.

illectrility@sh.itjust.works on 07 Mar 2024 19:59 collapse

All of the answers I got so far were great. I’ll probably use a messaging service though but thank you very much

knfrmity@lemmygrad.ml on 06 Mar 2024 19:12 next collapse

VPN server on one, client on another.

A matrix bot on each end would work too but seems unnecessarily complicated.

norambna@programming.dev on 07 Mar 2024 00:02 collapse

A VPN would be my first choice. ZeroTier works like a charm on the RPis. I’ve shared even SQLite databases over Samba over Zerotier among a bunch of RPis daily for a couple of years without a hitch.

xurxia@mander.xyz on 10 Mar 2024 09:43 collapse

There are free IoT cloud solutions to send and receive data and that work with MQTT protocol for this purpose.