0

I am planning on doing a bit of home automation. I decided on going with the RPi, because it is cheap, and can connect to the internet wirelessly via a USB dongle. I was planning on controlling the system through a PHP webpage hosted on my webserver. I was wondering if I could make it so that when I click a button on the PHP site, it somehow sends a signal to the raspberry pi and makes it activate a GPIO pin. I realize that it would be easier to host the webpage on the actual Pi itself, but I plan to have multiple Pis and would like to be able to control all of them with one webpage.

Thanks In advance

JVarhol
  • 606
  • 3
  • 7
  • 18

2 Answers2

0

I don't think it would be as easy as 'sending a signal' to your Pi. What you could do, however, is set up a MySQL database on the server with your control signals input to the database and have the Pi poll it every so often to check the values.

For actually controlling, you would simply use UPDATE statements to set the values. There may be some lag involved, but this depends on your polling rate and network speed.

nagyben
  • 938
  • 1
  • 10
  • 19
0

Use a websocket (e.g., on Node.js) to open a channel of communication between the Raspberry Pi and the Web page. Run a socket server on the Web server and run clients on your Rasberry Pis. Then create a simple messaging protocol for commands that the Web server will send over the websocket and that the Raspberry Pis will listen for over the socket. They can even communicate when the task is done that it's been done successfully.

swmcdonnell
  • 1,381
  • 9
  • 22