Simple Transistor Inverter Circuit.

crutschow

Joined Mar 14, 2008
34,464
It would appear to me that the problem is not transistor current gain . The transistor is already turned on.
The problem is turning off the transistor.
The reason the transistor can't be turned off (post #27) is that the resistor value to bias the transistor on is too low and current too high for the Opto to sink, so you need more gain to allow the use of a higher valued resistor.
It's actually the low gain of the Opto that necessitates a high gain transistor at the output to drive the relay.
 

ScottWang

Joined Aug 23, 2012
7,409
How does that relate to me? Besides the cathode and anode are marked correctly on the spec sheet just shown upside-down.
The inside LEDs of OP821Z and PC817 are different, so the direction is also different, it wasn't what I made it, it was made by the manufacturers, please check them again.
 

sghioto

Joined Dec 31, 2017
5,391
Only the pinout is different. The symbol I used is a generic optocoupler representing the OP821Z and is shown schematically correct. I did not mark the actual pin numbers.
 

ScottWang

Joined Aug 23, 2012
7,409
Only the pinout is different. The symbol I used is a generic optocoupler representing the OP821Z and is shown schematically correct. I did not mark the actual pin numbers.
You can't use the symbol of a generic optocouple like as PC817 to represent the OP821Z.
 

MrChips

Joined Oct 2, 2009
30,823
I have a suspicion that the LED in the opto interrupter is wired incorrectly.
Measure the voltage across the LED or across the current limiting resistor.
 

ScottWang

Joined Aug 23, 2012
7,409
I don't understand why not unless you are referring to conventional vs electron flow.
What's the difference between OP821Z and PC817?
1. Inside --
OP821Z -- Some kind of IR(Infrared).
PC817 -- normal LED.

2. Control method --
OP821Z -- The power of IR mostly is power on, and uses the material (like paper, plastic film, plate metal, etc...) to cut off the light from IR, use this component to detect the material.
PC817 -- Control the Anode or Cathode of the LED to power the LED ON and OFF, using this component to do the isolation between two other components or circuits or devices.

3. The direction of LEDs Symbols is different.
 

sghioto

Joined Dec 31, 2017
5,391
PC817 -- normal LED.
Incorrect it's an IR LED. In fact I don't know of any optocouplers that are not.
OP821Z -- The power of IR mostly is power on, and uses the material (like paper, plastic film, plate metal, etc...) to cut off the light from IR, use this component to detect the material.
That's because of the way it is manufactured. I show in the schematic that the LED is always ON and follows the same control method as stated by the TS.
Scott I really don't understand this questioning about the schematic symbol. Are you suggesting that the anodes of the IR LED should be negative as shown in the schematic in post #1?
 

ScottWang

Joined Aug 23, 2012
7,409
Incorrect it's an IR LED. In fact I don't know of any optocouplers that are not.
I didn't check many optocouplers, but some info really showed an IR LED.
Edit: I can't get the info from PC817 datasheet.
Scott I really don't understand this questioning about the schematic symbol. Are you suggesting that the anodes of the IR LED should be negative as shown in the schematic in post #1?
Yes.
I don't know why (maybe someone knew that), but components like OP821Z should be shown the same in post #1 and it is also shown in the datasheet.
 

MrChips

Joined Oct 2, 2009
30,823
Initially he says the transistor operates, but in the opposite phase desired.
This says the LEDs are correctly wired and operating.;
Then TS should connect a load resistor on the transistor collector and check that the opto interrupter is working properly.
 

sghioto

Joined Dec 31, 2017
5,391
Yes.
I don't know why (maybe someone knew that), but components like OP821Z should be shown the same in post #1 and it is also shown in the datasheet.
The symbol is shown that way in the spec sheet to match the pinout of the physical layout of the bottom of the package.
Has nothing to do with how it's actually shown in a schematic.
 

Thread Starter

ZoNiE

Joined Nov 21, 2016
20
Initially he says the transistor operates, but in the opposite phase desired.
This says the LEDs are correctly wired and operating.;
I updated the schematic and changed the regulator to 5V and R1 to 220n. The Led's are wired correctly, and are, indeed swiching when the beam is blocked. They are on when the beam is not blocked, and off when blocked. I need to use the external transistor to drive the current to energize the relay, and also invert the logic. I am very space limited. This is essentially being built inside of a connector box.

Yes, to the comment about the transistor is already turned on. I just need to turn it on when the beam is blocked, not the other way around, which is what is happening. The circuit below (and my previous 12V version) is the only version that actually switches the relay.

The cathode, Pin 3, Green wire, is tied to Ground on the bottom sensor. The top sensor's cathode is tied to the Anode of the bottom sensor, and its anode is tied to +5V through the 220 ohm resistor. I have no idea why they did this, but I am stuck using it because I am not allowed to change the internals of the valve, or we would have a different problem. Screen Shot 2023-03-08 at 12.41.03 PM.png
 
Top