4N25 Optocoupler (Optoisolator)

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
This is my first time positing to the forums and I am simply trying to use the 4N25 optoisolator to electrically isolate a DC voltage so it can be sensed by a microprocessor on the output side. Here is the basic circuit I am using:




This is the same circuit I've seen on other websites describing how to use the 4N25. I have varied the R1 and R2 values from 100 Ohms up to 10 KOhms and varied the input V1 from 0 to 10 V but the output either remains at some constant value in the mV or it is equal to V2. However, it never is equal to V1 which is what it should do.

Somebody please let me know what I am doing wrong.
 

SgtWookie

Joined Jul 17, 2007
22,230
They're designed to be used as optically isolated logic switches, not as linear devices.

Your circuit is wrong. R2 needs to be in the wire that goes to +5v instead of between pin 5 and Vout. Wired the way it is, you would always read 5v on the output.

The pin numbers for 4 and 6 are in the wrong place; exchange them.

The emitter side (on the left) has a Vf of around 1.2v @10mA. Calculate your current limiting resistor R1 as:
Rlimit = (Vsupply - 1.2v)/10mA
So, if your V1 is either 5v or 0v, then:
Rlimit = (5v-1.2v)/10mA = 3.8/0.01 = 380 Ohms. Use the closest standard value, or use resistors in series or parallel to get 380 Ohms.

The 4N25 has a current transfer ratio of 20%
Don't expect the output to sink much current. Use a 2.5k to 3k resistor for R2.
 

BMorse

Joined Sep 26, 2009
2,675
This is my first time positing to the forums and I am simply trying to use the 4N25 optoisolator to electrically isolate a DC voltage so it can be sensed by a microprocessor on the output side. Here is the basic circuit I am using:




This is the same circuit I've seen on other websites describing how to use the 4N25. I have varied the R1 and R2 values from 100 Ohms up to 10 KOhms and varied the input V1 from 0 to 10 V but the output either remains at some constant value in the mV or it is equal to V2. However, it never is equal to V1 which is what it should do.

Somebody please let me know what I am doing wrong.

VOut should also be connected between the pin and the resistor, not where you have it on the circuit or else you will always be reading the value of V2....

B. Morse
 

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
I tried your solution with the following circuit:



Maybe I'm not understanding something. By an optically isolated switch, does that mean it requires some signal to go high or low to start? How exactly does this start? Also, will it simply output the same DC voltage on V1 on the output?

Thank You.
 

hgmjr

Joined Jan 28, 2005
9,027
Here is a link to the wikipedia section the topic of opto-isolators. This material will help provide you with a bit more background on the subject. Hopefully it will answer you main questions. Anything that is not clear you can come back here and ask for clarification.

hgmjr
 

BMorse

Joined Sep 26, 2009
2,675
I tried your solution with the following circuit:



Maybe I'm not understanding something. By an optically isolated switch, does that mean it requires some signal to go high or low to start? How exactly does this start? Also, will it simply output the same DC voltage on V1 on the output?

Thank You.

With the circuit above, you should read V2 on Vout.

If you disconnect V1, then you should read almost 0 volts on Vout.

You "activate" the opto coupler by turning the LED side on or off to control the state of the output phototransistor...

B. Morse
 

SgtWookie

Joined Jul 17, 2007
22,230
You misunderstood me when I said the pin numbers were swapped.

You also misunderstood me when I said the resistor needed to be moved to the wire going to Vcc.

You have likely destroyed the optocoupler, but here is how you should have connected it. Note the corrections in red.

 

Attachments

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
Thanks for all your help.

I still can't seem to get it working so I think the optocoupler may not be the right solution for what I'm trying to do.

I'm trying to isolate the DC voltage of a battery so I can send it to the analog input of a microprocessor. Can anyone offer up a type of circuit or solution that would do this.
 

retched

Joined Dec 5, 2009
5,207
Why do you want to isolate it? And you were right that the optocoupler was wrong for the job.

If you want to isolate something from its power source, you should use an isolation transformer. Isolation transformers have the same number of windings on the primary and secondary windings so they do not raise or lower the voltage, just physically isolate it.

You may want to put it out there and just tell us what your trying to do. That will help save time with the wild goose chases.
 

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
It's a battery management system that will be a part of a Formula Hybrid vehicle. The rules say that the high voltage circuit must be isolated from the low voltage circuit. However, we have to sense the battery voltages for the battery management system to work. It is also to protect the microprocessor.
 

SgtWookie

Joined Jul 17, 2007
22,230
You might use a linear Hall-effect sensor to detect current flow through a known resistance. The Hall-effect sensor would provide the isolation as well as giving an output corresponding to the current.
I=E/R (Current = Voltage/Resistance)
So if you know both R and I, you can derive E.

One problem with that is the electrical noise. You will need very good filtering and shielding.
 

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
I have been reading about analog optocouplers, would this work and could anybody recommend a type? Again, the voltage of the batteries being sensed is from 0 to 5 V.
 

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
They are packs of cells. Each pack has nominal voltage of 18.5 V which is reduced with a voltage divider to 5 V. 24 packs in total.
 

Thread Starter

chumarkrch

Joined Nov 2, 2009
7
I have heard from our project adviser that there are optocoupler/optoisolator ICs that have D/A and A/D converters built in so an analog voltage can be relayed linearly while isolating the inputs and outputs. Does anyone know of any ICs like this?

Thanks
 
Top