To show the basic principal I used a remote wall socket which normally is switched with a remote via a radio frequency of 433 MHz. What I wanted was to have an Arduino controlling the remote switch to turn on/off the wall socket.
First off I want to show you how the final result looks like and then I want to tell you some details about the setup and the basic steps.
What you see here is an optocoupler circuit which is often used as a switching circuit. Those little black ICs are optocouplers. Internally they have a small IR-LED which triggers a photodiode which closes the circuit. With your microcontroller you power up the internal LED. Make sure to use a resistor to limit the current as the LED usually works with 5-10mA. On the other side of the optocoupler you attach the circuit which you want to close. In my case it was the button of the remote. The datasheet for the 4N35 optocoupler I used can be found here.
To prepare your device/remote for being switched externally, you first have to desolder the buttons. In my remote the circuit layout was pretty simple and I could desolder the buttons pretty easily.
Afterwards I attached breadboard cables to the sockets so that I could connect the cables to my optocoupler circuit.
Here is a basic setup plan and a circuit plan for this project:
All that was left to do was to write an Arduino sketch that listens to the Serial port for incoming data to switch the circuit, a small desktop program which transmits the control data and as a bonus a small android app which sends the switching state to the desktop program. Like I described in the last post, you can find serial communication examples in the Arduino IDE. For desktop serial communication using Java have a look into the RXTX project.
My final result demo video shows the switching of a desk lamp which is plugged into a remote wall socket.
With such kind of circuit you can also switch any low voltage device directly. I only used the remote example to present the general basic approach. As companies don't like that people tinker around in their circuits I feel obliged to tell you that the guarantee is void if you mess around with those devices and that they aren't intended to be modified :).
Some people were asking for the code for this project, so I wrapped it up and published it on github.
You will find two project folders and a single java file. The first one is the Android project which does the socket communication with the desktop. The single java file is a simple class which receives the socket data from the Android device and transmits the serial data to the Arduino, so I called it SocketToSerialMediator. The other project folder contains the Arduino sketch.
Note: In order for the SocketToSerialMediator to work you have to include the RXTX library in your Java installation. Please have a look into the project page of RXTX and follow the installation guide. After you compiled the java file just run it on a console and provide the serial port and the socket port.
java SocketToSerialMediator COM14 1234Have fun switching things ON and OFF!