The image shows a way of connecting an optocoupler. My problem comes from how the emitter (Q1 in the image) is connected. The emmiter goes to a resistance going to ground and to v_out. When i try to add this to my circuit the pin that is suppost to be receiving data, the v_out pin goes silent. If i remove the resistance going from the emitter to ground and just have vout to the emitter everything works fine.
1 Answer
Normally you would connect the ground (0V) side of resistor R2 to the ground of the Arduino and the other side of R2 (which is also connected to the emitter of Q1) to an input pin of the Arduino. When the LED is energized by pressing the button it sends light to the fototransistor. Because of this the phototransistor starts conducting current (I1) which causes a voltage drop I1xR2 over R2. When this voltage is high enough the input pin will show a "1" (or HIGH) when read out. "High enough" means >= 0.7 x Vcc, where Vcc is the voltage of the powerline to the Arduino.
The website from which the picture in your question originates (here) has an extensive article about the working and implementation of optocouplers. It also shows examples of alternative circuits.
-
maybe i'm misunderstanding here, but something like this? imgur.com/6xZE5gx Here the red wire goes to the collector. the emitter goes to ground via resistor and sends signal to the Arduino via the gray cable Dec 5, 2018 at 20:16
-
I would leave away the resistor in the collector line. Are the resistors from the picture the real ones you use (how did you get a non standard resistor of 250 Ohm?). Personally I have more faith in the circuit of fig. 14 in the datasheet: vishay.com/docs/81181/4n35.pdf– PimVDec 5, 2018 at 22:54
pin goes silent
pin that is suppost to be receiving data
.... which pin are you talking about?