SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By jack0987
#174961
I have a Arduino uno.

Using a 4N33 opto isolator, when I connect pin 1 to +5V and connect pin 2 to GND, the Arduino indicator light go dim.

please advise.
By n1ist
#174963
The 4N33 has the LED connected between pins 1 and 2. You need a current-limiting resistor just like with any other LED. You may also need a new 4N33.

What exactly are you trying to do? Normally one side of the LED in an opto is driven by a GPIO pin or some other controllable signal.
/mike
By jack0987
#174965
Thanks Mike.

The 4N33 seems to have survived. I threw in a 470 ohm resistor and it now works.

What might be a good value to the limiting resistor?

What I am doing in this case has nothing to do with the arduino. I am just using the prototyping area to work on a different circuit and really could use a little help.

I have devices that have ON indicator leds.

First - I wanted to connect second ON led through the opto. We will call this led1. This I can now do.

Second - I would like a second led to come on when led1 goes OFF. That I am trying to work out.

Please suggest something.
By jremington
#174966
Consult the 4N33 data sheet for the maximum input current, although 10 mA is almost always safe.
The Arduino can turn off one LED when the other is on. Otherwise, you will need external circuitry, like a transistor inverter.
By jack0987
#174967
I will need to use external circuity.

When the output of the 4N33 goes low, the second led is to come on.

Can I do this with the 2N3904's and 2N3906's I have or do I need something else from my parts box?
By jremington
#174968
Either one. For the 2N3904, use the common emitter configuration, a 10K base resistor and a 470 ohm current limiting resistor, in series with the LED on the collector. To use the same port pin to control both devices, you will have to wire the optoisolator input to Vcc through a current limiting resistor, so that it is activated when the pin is low. When the pin is high, it will activate the transistor through the base resistor.
By jremington
#174972
This circuit will light the LED when the output is high, and activate the optocoupler when the output is low.
opto.png
You do not have the required permissions to view the files attached to this post.
Last edited by jremington on Mon Sep 15, 2014 4:48 pm, edited 1 time in total.
By jack0987
#174974
This is sort of what I had in mind (but not quite) and it appears to be working.
I had to lower the value of R4 because led2 was dimly lit when led1 was on.
example1-small copy.jpg
Note that the cathode of led2 is connected to Q1. I do not want it to be this way.
I want the cathode to connect directly to ground.
Therefore, If led2 and R2 could be replaced with a driver, then led2 and R2 could be attached at the end of a length of wire.
please suggest a way.
You do not have the required permissions to view the files attached to this post.
By jremington
#174976
That circuit is mostly wrong.
You have the wrong type of transistor and if a PNP is actually being used, it is wired backwards.
You must have a current limiting resistor between "Source" and the LED input to the optocoupler.
You do not need R3, leave that pin unconnected.
Google "4n33 schematic" for lots of examples of how to use this device.
By jack0987
#174985
I think I am getting somewhere using a transistor inverter with a 3904 which is what everyone was trying to explain to me above but I did not understand it and was not doing it right.

R3 is there for a reason but may not be the correct value. In some cases the source led high/low voltage can vary and R3 is used to try and tweek out that difference. If you can shed some light on this it would be most helpful.

Thanks