These instructions are taken from lexruee’s GitHub site
https://github.com/lexruee/pi-switch-python
The instructions simple to follow and for me just worked !
1) Install WiringPi – get to the latest instructions by following this – install wiringPi
2) Install python boost, python header files and python-pip:
sudo apt-get install python-dev libboost-python-dev python-pip
3) Finally, we install pi_switch using pip
sudo pip install pi_switch
This should work fine on Pi 2 or 3 [ with 1G of RAM ] but will most likely fail on a B+ or A+ because the compiler will run out of resources. To get around this you need to temperally increase the Swap file from 100M to 512M as described below. Importantly the compile will still be very slow because an SD card is not the fastest source of extra memory ! – but it does work
Open a nano session on the ‘dphys-swapfile ‘ with the command below;
sudo nano /etc/dphys-swapfile
Look for the line
CONF_SWAPSIZE=100
and change it 512, save and exit then reboot the pi. Once you have successfully installed the pi_switch change the file back to 100.
I used a simple test program to confirm all is well, you can download this from my Github site .
For more detailed instruction on how to use Pi-Switch and other of lexruee’s RC433 s/w look at his git-hub .
For the mains switch I use Maplin, RC mains switch part number n78ka
http://www.maplin.co.uk/p/remote-controlled-mains-socket-set-single-n78ka
The RC transmitter came from a Chinese ebay site, I cannot remember which one
Other useful links
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=96688 , this was my first attempt
Other links you might find helpful
https://code.google.com/p/rc-switch/wiki/HowTo_OperateLowCostOutlets
http://www.hoagieshouse.com/RaspberryPi/RCSockets/RCPlug.html
Pingback: Mk2 Low Cost Home Automation | The Meandering Pi