I am planning on doing a bit of home automation. I decided on going with the Raspberry Pi, 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 Raspberry Pi itself, but I plan to have multiple Pi's and would like to be able to control all of them with one webpage.

1 Answer 1


You could use PHP to create a text or csv file on the server with the instructions needed and then have a python script on the Pi run on a cron schedule that downloads the file and acts on the instructions.

I am currently working on a small project that does just this but just plays a selected mp3 file on the Pi and deletes the file on the server afterwards.

I can provide my code so far if required?

  • Seems interesting, about how long does it take from the time you press the button to the time it plays.
    – JVarhol
    Jan 31, 2014 at 9:04
  • Hi, I currently have a cron task run every 5 mins that FTP's into the server, checks if a file exists if not it exits if it does then it will download the file read the instructions (name, song to play & email address) it then plays the song and sends an email to confirm the song was played and deletes the file so a new one can be created or if not it will just exit the next time cron checks for a file. So it depends on how close to the 5 minute increments that the file is created.
    – kyle2k
    Jan 31, 2014 at 12:02
  • Ah, i see, I would have to do it mush more frequently, like every 10s, which shouldn't be a problem.
    – JVarhol
    Jan 31, 2014 at 12:05
  • I'd like to see the code if you could please share it?
    – user30623
    May 6, 2015 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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