Raspberry Pi interface for 433MHz outlets
A lot of tutorials deal with connecting a 433MHz transmitter to your Pi. However, opening a terminal on your phone to use the command line to switch on a lamp is no fun. What I wanted was to have an app or something on my iPhone to make my phone behave as a remote.
In order to be as generic as possible i decided to use php to create an interface.
What do you need; a working raspberry pi with WiringPi, 433Utils and Apache installed. Other webservers undoubtebly will work too but i didn’t test this on those servers.
The basics for a remote are simple, you need a way to run ‘codesend’ (433Utils) from a webpage. I use PHP to do this using the PHP shell_exec command like this:
shell_exec(‘sudo /home/pi/433Utils/RPi_utils/codesend 123456‘);
a working example:
<?php if ( isset($_POST['remote']) ) { shell_exec('sudo /opt/433Utils/RPi_utils/codesend '.$_POST["remote"].'> /var/tmp/remote.log'); } ?> <!DOCTYPE HTML> <html> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <button type="submit" name="remote" value="4128960" />on</button> <button type="submit" name="remote" value="4128768" />off</button> </form> </body>
What this does is draw the buttons on the screen. If one of the buttons is pressed the form calls itself but with the parameters. If $_POST has the value “remote” it will execute the codesend program with the value as defined in the pressed button.
note:
due to the fact that access to the gpio pins requires root privileges you have either to grant apache root privileges or you will have to add codesend to the /etc/sudoers file (more).














