Q: Wiring Raspberry PI GPIO pins to a remote to simulate a button press? I have some lights that you turn can on by using a small IR remote. My first idea was that I would be able to wire my RPI GPIO pins to the button and turn then pin on and off to simulate a button press but have had no luck at all.
I tried by connecting the ground of the Pi to the ground of the remote and then connected the GPIO pins to a 330 ohm resistor and then to the button with the tracer wire connected to the chip on the remote.
Is it possible to wire it up this way to simulate a button press to turn on my lights? I have heard some people said you use an opto-isolator but don't understand how to connect this to the PI and the remote?
Here are some pictures of the remote.



A: First, let's talk about what an OptoIsolator is.
What is an OptoIsolator?
Excerpt:
An optoisolator (also known as optical coupler, optocoupler and opto-isolator) is a semiconductor device that uses a short optical transmission path to transfer an electrical signal between circuits or elements of a circuit, while keeping them electrically isolated from each other. These components are used in a wide variety of communications, control and monitoring systems that use light to prevent electrical high voltage from affecting a lower power system receiving a signal.
OptoIsolator Diagram

OptoIsolator Device

OptoIsolator Schematic

Ok, so how does this help me?
So an OptoIsolator is kind of like a relay except it doesn't rely on electromagnets. Instead it often relies on infrared light transmitter (sends light) and a photoresistor (to detect light) on opposite ends of each other.
When the infrared is powered, it shines light on the photoresistor which then allows voltage to pass through the two wires on the receiving end. The devices are great for isolating electronics from one another to avoid damage and work ideal in low power environments where a relay maybe overkill.
How can I use it?
Essentially you connect the transmitter end to your RaspberryPI, and the receiver end to your remote (you will need to desolder a button and wire up the OptoIsolator's receiver in it's place).
When your RaspberryPI fires up the transmitter by enabling/turning on the GPIO pin which it is attached to, that will in turn "press" the button on the receiving side of the OptoIsolator. Keep in mind for as long as the RaspberryPI keeps it's GPIO pin high that the button will be held, so you may need to work on getting the timing right for this device. 
