need to know the resistance value

MrChips

Joined Oct 2, 2009
30,824
Your circuit wouldn't work.
There is no current path to ground.
The receiver in the opto coupler is wired incorrectly.
 

DerStrom8

Joined Feb 20, 2011
2,390
Also what is the purpose of using an opto-isolator if you're just going to connect the inputs and outputs together? There is no isolation!
 

Thread Starter

kamel2913

Joined Mar 6, 2015
43
upload_2015-5-18_16-33-4.png

sorry it was my bad I forget to put the ground, I have made this ciruits in Proteus it did work with any value of resistance, but in the real it works only with the resistance which has a value close or egale to 180, 250 and 2K2 ohm, I wanted to know why, I tried to do some calcul but I couldn't solve it.
sorry for the ground J ust add it.
this circuit is a sensor of black and white grounds, if he get a black ground he gives 0V if it's white he give 5V.
thanks for intresste.
 

Attachments

panic mode

Joined Oct 10, 2011
2,761
this photocoupler is not "sealed" unit - it is used for sensing (there are lenses on sender and receiver).

by the way schematic is wrong, C and E of CN70 are swapped... (C need to be at higher potential than E). also bottom side of Acquisition stage need to be at zero VDC.

to size your resistors, you need to read data sheet and make some assumptions.
resistor on the left (controls input current of opto), is

R1U=Vr/Ir = (5V - Vf)/If=(5V-1.25V)/0.020A = 187.5 Ohm.
So 180 Ohm resistor is good choice here...

R3U=Vr/Iopto=(5V-Vbe)/Ib = (5V-0.7V)/0.001A = 4300 Ohm
R2U= ... just make it 2-5x R3U, for example 10-22K

R4U= .... need to look at gain of 2N2222, load current etc. but...
load current is small (input of MCU). Also Ib=1mA, hfe is at least 100 so Ic could be 100mA. now we don't want analog operation, saturation mode is fine for switching so usually we assume hfe=10, and therefore Ic_max=10mA (approx.)
5V/10mA = 500 Ohm. Almost any larger value will work, for example 1K.
 

panic mode

Joined Oct 10, 2011
2,761
transistor is an amplifier and - it has gain. any leakage current (if there is no R3U) would be amplified and output voltage (on collector of BJT) would perhaps be something you don't want (or your microcontroller). having R3U provides path to sink any small leakage current without triggering transistor. once the optocoupler is conducting, you would get "big" current of 1mA or so. small fraction of it would go through R3U but bigger fraction would drive BJT.
 
Top