Hey guys, I'm brand new to Arduino and electronics in general. I've been reading the manual and can't seem to understand what's written about the optocoupler. The text says that it houses a small LED that causes a photoreceptor inside to close an internal switch when it's lit up and then goes on to say that when you apply voltage to the + pin, the LED lights and the internal switch closes. This is essentially stating the same thing twice but more specifically in the second statement, correct? But then it states that "the two outputs replace a switch in the second circuit", which is where it lost me. Which two outputs is it referring to? Sorry if this the answer is obvious but I would appreciate any insight you can offer.
Hi, What manual?? What optocoupler??
Sorry I should have specified. It's the Arduino Projects Book for the Arduino Uno and I believe it's the 4N35 optocoupler.
If you have a look at the datasheet for a 4N35, the first page has a visual representation of the internal circuit.
The two outputs your book is probably referring to are pins 4 and 5 on the diagram. Basically it is saying that those two pins are "opened" and "closed" the same way a switch opens and shorts a circuit. That is a real oversimplification though and it's not quite as easy as using a mechanical switch. The input needs a current limiting resistor and your output needs to be connected in the correct arrangement for it to truly mimic a mechanical switch.
Ah I see. I guess I’m a little confused about the manual’s language about what it means to “replace a switch in the second circuit”. I understand that by using the optocoupler, you can divide the breadboard into two different circuits but what would the “switch” be in the second circuit being replaced by the optocoupler’s two outputs? What kind of effect is the optocoupler having on the second circuit? Sorry if this seems a bit convoluted :\
The optocoupler outputs replace a switch in the second circuit. If the second circuit does not have a switch, then there is no use in having the optocoupler.
Note that a 4N35 is only intended for DC circuits (not AC) unless other parts are added. The LED cannot withstand much reverse voltage and the output being a bipolar transistor conducts in one direction only.
Do you understand how relays work? Think of the optocoupler as a sort of relay. It allows you to control the output circuit via the input circuit but keeps them electrically isolated. That means the output load can run at much higher current or voltage than the input circuit would be capable of providing.
Here’s a picture showing an opto-coupler switching a 12V circuit from a 3.3V source, the 3.3V side is totally isolated from the 12V, it works the other way as well, isolating a lower voltage input from a higher voltage source.
Hey all, thank you for taking the time respond. I think I understand the general idea. Hopefully all the technical aspects will become clearer once I start building.
Be aware than an opto isolator's output can't carry very much current, and it varies between different devices so its always good to look at the datasheet.