I found a remote control switch by Stanley at Bed Bath & Beyond for $10. It lets you turn on/off 3 electrical outlets with a small remote control. Its similar to this one on Amazon. I was able to open the remote easily and get to the buttons. I soldered couple of wires to the end of the terminals and was able to extend it out to the side of the remote. I connected the wires to a transistor to theÂ emitterÂ and collector. Used a 10k resistor to ground it to Arduino’s ground. Pin 7 & 8 were connected to the base of the NPN transistor (2N3904).
At first, I tested it with serial communication. The code would listen for a “1” or a “0” from the serial monitor and send a HIGH/LOW to pin 7 or pin 8 (1 for ON and 0 for OFF). Once I got that to work, I changed the code so it will read a index.php on a webserver. The index.php is set to read a txt file which has a 0 or 1 written to it by another PHP file. “On.php” will write a “1” to the txt file and “Off.php” will write a “0” to the txt file. When Arduino gets the information, it activates the appropriate pin to activate the transistor for 1 second.