I am implementing a simple project with several Raspberry Pi 3s' connected to my home network. I hosted a web server using PHP on lighttpd server on one pi that I am calling my "central node".

I have a python script on that central node that reads some sensor information through the GPIO pins. Now, what I want to accomplish, is to obtain the sensor data from the other nodes on my network ( the other Pi 3s' apart from the central one ).

I thought about SSH remote execution from the central Pi to the other Pis' to run the script and get back the data. But that would be a problem since my router uses DHCP and the Pis' get assigned different IP Addresses each time. So there isn't a way to differentiate between them as such. Another way would be to SSH the Pi using their MAC addresses, but it being a Layer 2 protocol, wouldn't be usable outside the same network.

So what should I do in this scenario ? The data feed needs to be realtime to the central node. If necessary, I can host the webserver on a separate machine and use the Pis' only for data retrieval as well.

  • Why not create a script that runs on the non-central Pi's that makes a web request to the central Pi's web server and stores the data to the DB? Feb 22 '17 at 4:50
  • That would involve setting up all the other Pi's individually. I was looking for more of a plug and play type of system. For eg, just hook up the Pi to the network, and the central server would configure all the communications automatically@SteveRobillard
    – RwitamB
    Feb 22 '17 at 5:20
  • Can't you use the machine names instead of the IP addresses for the slave Pi's?
    – kodybrown
    Feb 22 '17 at 5:28
  • Regarding @Steve Robillard's suggestion, you can still remotely configure the slave devices from the central node.
    – kodybrown
    Feb 22 '17 at 5:31
  • That would restrict me to an inter-network operation only. Can't use machine names outside of the network @wasatchwizard
    – RwitamB
    Feb 22 '17 at 5:40

This sounds like an perfect application for MQTT. You can connect all your devices to a cloud broker , and the devices can publish and subcribe to message feeds. This is different from one-to-one client-server relationships and more powerful.


If you wish , you can install a private broker on your own Pi inside your home network instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.