# Output logic source and sink

Joined Nov 30, 2021
15
Hi all, Im working to design a circuit that can sink after a load is apply, but when there's no load also be able to output logic levels 5v/0v. The max that a load could be is 12V and not not more than 100ma, therefore I decided to use octocapulers to make some output logic. In my attach image, what I'm trying to accomplish is that when there is no load the output will be 5v or 0V. But when a load is connected be able to sink and drive the load. I know my image circuit won't work, but I just wanted to illustrate what I wanted to accomplish. Probably there are ICs or a good way to make a circuit to accept sourcing or sinking. Thank you.

#### Attachments

• 2.7 MB Views: 28

#### WBahn

Joined Mar 31, 2012
30,230
Hi all, Im working to design a circuit that can sink after a load is apply, but when there's no load also be able to output logic levels 5v/0v. The max that a load could be is 12V and not not more than 100ma, therefore I decided to use octocapulers to make some output logic. In my attach image, what I'm trying to accomplish is that when there is no load the output will be 5v or 0V. But when a load is connected be able to sink and drive the load. I know my image circuit won't work, but I just wanted to illustrate what I wanted to accomplish. Probably there are ICs or a good way to make a circuit to accept sourcing or sinking. Thank you.
What do you mean by "sink and drive" the load? If the other end of the load is tied to 12 V (or some other voltage), do you want to be able to sink current when the optocoupler transistor is on and have no (or very little) current if it is not? Or do you want to be able to sink current from the load when the output is LO and drive (source) current to the load when the output is HI?

#### MisterBill2

Joined Jan 23, 2018
18,928
OK, since sink is not defined, and source is only to pull up to +5 volts, while the low is zero in all conditions, this is easy.
The solution is an open collector output transistor, with a pull-up resistor fed from a 5 volt sourcewith adiode, so the supply there will need to be 5 volts plus the diode drop. Then for a 12 volt output, the connected device is fed from 12 volts and the transistor either pulls the other side to zero or lets it be pulled up to 12 volts.

#### WBahn

Joined Mar 31, 2012
30,230
Most optocouplers are intended for pretty low current operation, but there are plenty out there that can handle 100 mA when on and withstand 12 V when off. One thing to be sure is that you have sufficient current transfer ratio to support the 100 mA.

#### LowQCab

Joined Nov 6, 2012
4,186
Mister Bill nailed it.
But there's still no where near enough information as to why any of this is necessary.

What is this Circuit supposed to do ?

What are the various Loads that might be connected to this Circuit ?

What Frequencies are involved ?

How much Current does the Circuit have to Source at 5-Volts.
.
.
.

#### MisterBill2

Joined Jan 23, 2018
18,928
I did neglect to mention that the transistor must be an NPN type with a fairly high gain and low leakage, and rated for at least the anticipated current. The optocoupler would drive the base of the transistor, and there will be a logic inversion in that the output will be low when the optocoupler is active.

Joined Jul 18, 2013
28,757
Keep in mind an opto isolator IC output can used in sink or source mode.

#### MisterBill2

Joined Jan 23, 2018
18,928
Quite right, Max. I was only considering the circuit presented. So YES, it could be rearranged a small amount and be a non-inverting circuit. A good point indeed. Thanks.