Electrical – How to close a remote controller switch with an optocoupler and a Pi

gpioopto-isolatorraspberry pi

I'm trying to close the contacts of a remote controller (wires are soldered to either side). I have an RPi and I'm yet to buy an optocoupler.

What would I need to get this to work? A Pi outputs 3.3v from a GPIO, but can power a circuit independently at 5v.

schematic

simulate this circuit – Schematic created using CircuitLab

shorting a remote control pushbutton with GPIO and a transistor

I was referencing this thread, but they've included a 9v battery, and I don't know what purpose that serves.

Alternatively, I could use a relay powered by the 5v Pi output which is triggered by the GPIO, but I worry that the contacts on a relay are too resistive to conduct a small switch short. Please advise!

Thank-you!!

EDIT: Thanks to user Passerby, I now have formula for finding an optocoupler and resistor.

Assuming the Pi outputs 3.3v at 16mA, what's a suitable resistor/optocoupler combination (x & y on schematic)?

Best Answer

Aside from an appropriate ballast resistor in series with the led side of the optocoupler r = (3.3 - Vf) / If), yes, that should work.

That post had a remote powered by a nine volt battery. Nothing really changes as far as your concerned with a 3 or 5 volt remote instead.

A relay will work too. The contacts of the relay should only have a negligible resistance (near perfect conductor). But then you have an issue of driving the relay, as the gpio cannot do it directly.

An optocoupler is ideal. But you could just use a simple npn transistor (2n3904). You would have to connect the grounds of the remote and the RPI together.