So, maybe it's my understanding that is at fault or maybe it's tinkercad. It's probably the former. But anyway here's my problem

I've connected it according to picture


There is no power going through the anode. The cathode is going to ground. On the upper side 5v is going to base and the emitter sends signals to an input on pin 12.

If i digitalRead pin 12 and Serial.write it. it says 1. which is weird, least for my understanding.

As i understood there needs to be power going through the anode which lights up the diode inside the optocoupler. however there is no power going through the anode yet the emitter gives off a signal.

Anyone mind helping me out in understanding why this is?

Please ignore the resistors on the image

  • fixed it, or least a link to the picture – magicmike992 Nov 28 '18 at 15:37

You connected 5V to the base of the transistor inside, so the transistor is turned on all the time.

Move the 5v pin one to the right (middle pin on the 4N35, i.e. the collector), and it should work.

| improve this answer | |
  • imgur.com/a/Yv6UiZx do you mean like this? now the base is collected to ground, the collector to 5v, the emitter to the input pin. on the other side 5v is connected to the anode and cathode is to the ground. Yet this produces the input pin to return only zeroes. this time it should be only ones – magicmike992 Nov 28 '18 at 15:56
  • No, leave the base unconnected like this: imgur.com/a/uaUCqsC – Gerben Nov 28 '18 at 16:24
  • Ok that actually works great, i'm a bit confused however. does giving power to the base just ignore the what i understand "main" function of the octocoupler? – magicmike992 Nov 28 '18 at 17:01
  • Every transistor is light sensitive. That is why transistors are in black plastic instead of transparent plastic. The output of the optocoupler is a transistor and it can use the light (often a led or ir led) turned on by the input, but also the base pin can be used (for something, I don't know who uses that). Some optocouplers don't even have that base pin. – Jot Nov 28 '18 at 17:06
  • 1
    @magicmike992 Yes, it is extra. The base pin is used here to filter spikes: electronics-tutorials.ws/blog/optocoupler.html so it seems to be used, but a spike can be filtered at the input or output as well. – Jot Nov 28 '18 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.