As part of a larger home automation project, I wanted the ability to control some mains power outlets remotely. To achieve this, I interfaced the transmitter from an inexpensive 433MHz mains remote control kit with a raspberry pi zero w (via a pair of 4066 chips). I then wrote a programme in C to which the desired channel is passed along with either an "on" or "off" command. I can now run a script from my smartphone which connects to the raspberry pi and triggers the remote mains outlet.
I started off with a mains outlet remote control kit I purchased from Bunnings. It's and Arlec brand kit and works by transmitting on the 433.92MHz band. The remote can control up to four channels (A, B, C & D). A Raspberry Pi Zero W is used to control everything.
To interface the remote control I had to reverse engineer it. I assumed it would be a matter of tracing the button pads and finding a point to which I could connect a GPIO pin on the Raspberry Pi and pull up or down to trigger. This was not the case and I found that the button pads were matrixed so triggering a channel required connecting two specific points with each other, depending on the channel and the desired action ("on" or "off").
As such, instead of direcly connecting to the GPIO, I used the GPIO to trigger bilateral switches within a couple of 4066 CMOS quad bilateral switch packages. The circuit diagram is attached.
The final assembled circuit included headers for connecting the raspbrry pi and the hacked remote. I added a barrel jack for power and put the assembly inside a plastic case.
I wrote a program in C that takes the desired channel (A, B, C or D) and desired control ("on" or "off") and then pulses the remote control to give the desired effect. The code (and KiCad schematic) is on github: https://github.com/Clewsy/p0wer
Ultimately I intend to facillitate switching of these mains outlet units via a web-server. However until I finish that, I currently use a Termux shortcut on my android smartphone to run a script corresponding to the channel. Thus, by pressing a button on my homescreen I can, for example, switch on a lamp in the lounge room at home. The script will connect to the raspberry pi (using ssh) and run the programme with the desired inputs. For example, the following two-line script will connect to the raspi via the home server and run the program with the options to turn on the channel A outlet:
#!/bin/bash
ssh home.server "ssh raspberry.pi "p0wer a on""