First you will one ore more Wireless Remote Control Power Plugs.
You can turn on/off each power plug using the remote but for that you need to be in the proximity of the devices. What if you can control your lamp or coffee machine via internet. Yap, you can using RaspberryPi or Arduino but in this setup we will use RaspberryPi.
All you need is a cheap 433MHz transceiver connected to GPIO pins of RaspberryPi. Once connected then you need the pulse code that the remote is emitting and you can start control your power plug via your shell. In my case I can set the pulse code each outlet is listening for but in case you are not able to configure, there are a lot of sites that explains how to do this.
After you connect the transmitter to a GPIO pin you will need to install and configure a software that is able to send pulse trains to GPIO pin.
Let's start. First install git:
# apt-get install git-core gcc make build-essential
Then clone and install wiringPi.
# git clone git://git.drogon.net/wiringPi
# cd wiringPi
# git pull origin
Then download RCSwitch:
# git clone https://github.com/r10r/rcswitch-pi.git
# cd rcswitch-pi
Edit file send.cpp and change the GPIO pin with the one that the transceiver is connected:
int PIN = 3;
In my case I changed the code to accept the pin number as argument. If no pin is given as argument it defaults to PIN. Just add the following line before if (wiringPiSetup () == -1) return 1;.
if (argc == 5) PIN = atoi(argv);
You can download the code from the attached file WiringPi.tgz. After the code is updated just compile it
It will result a binary file named send. Copy this command to /usr/bin and make it executable:
# chmod a+c /usr/bin/send
All done. Now you can use send command to send send pulse trains to GPIO pin. In my case to turn on first power outlet (I have 3) I need to run:
# send 11111 1 1
And to turn it off:
# send 11111 1 0
Having this, I created commands in RController for my 3'rd socket.
send 11111 3 1
send 11111 3 0