What's the best way to AND NPN transistors?

Thread Starter

strantor

Joined Oct 3, 2010
6,782
See scanned notes below.

I've got a wireless relay module that I'm trying to hack in order to interface a couple of sensors with it. The top right of the scanned doc shows the original configuration, standard NPN low side switch. What I want to do is add a condition that my sensor (with another NPN transistor as output) must also be ON in order for the relay to switch. I can't figure whether I should put my sensor output transistor in series with the gate of the original transistor (middle right of scan), or whether I should put it series with the relay coil (bottom right of scan).

Please advise. I would just try one or the other, but I want to get it right the first time, as I don't have a lot of component leg to work with and if I screw it up, I might have to wait until tuesday to get replacement parts.

Thanks.

 

Attachments

THE_RB

Joined Feb 11, 2008
5,438
If your voltages are regulated, you can use a resistor from b-e on the one transistor, anbd a series resistor to each control voltage.

By setting the resistor values it requires BOTH inputs to be high, to get enough voltage b-e for the transistor to turn on. So if only one input is high, the Vbe is (say) 0.4v, if BOTH inputs are high the Vbe is 0.8v (or tries to be) and the transistor is turned hard on.
 

Thread Starter

strantor

Joined Oct 3, 2010
6,782
Well I didn't get around to modifying my circuit like I said I was. I was on-call, and got called out to go labor on a coal/coke crane in the bay on labor day (US Holiday). So now I'm sitting at work, thinking about this again. I simulated both of my proposed modifications in LTSpice, and both worked. Actually the middle right one had less voltage drop between the relay and ground, because there was only one transistor. Is this some simulator magic, or could I expect the same thing in real life? If I were at home, I would just bread board a couple of transistors and find out ;). Maybe I will do that anyway when I get home. But I am not considering this setup for use with my sensor, due to an epiphany detailed in the last paragraph.

Scott I don't think that's exactly what I need. Or I might just not understand it. looks like Q1 is normally ON (pulled high) and then if I pull either A or B are pulled low, it turns Q1 OFF? Is that right? So that would make it an inverted OR gate, not an AND gate? please explain.

Also, I'm trying to keep components to a minimum, since this is a hack job and the PCB is already constructed, with not much room to add anything.

RB, thanks for the tip. That's a pretty cool trick, and I'll try to remember it. I don't think it will work here though, as my sensor is just an optical switch with open collector output and I don't have access to the base. it has 3 wires; power, ground, and collector. Power and ground are used for the LED, and the LED shares ground with the internal emitter. So this thing has to be the lowest of the low side switches and my middle right drawing won't work.
 

#12

Joined Nov 30, 2010
18,224
If your sensor output is a low impedance to ground and you're waiting for a "high", Scott's circuit is a "nand". If your sensor outputs are "high" or high impedance until they go "low", it's a "nor". Depends on how you look at it.

Still, it's a good example. If you want it backwards, re-design it to use a pnp.
 

ScottWang

Joined Aug 23, 2012
7,397
Scott I don't think that's exactly what I need. Or I might just not understand it. looks like Q1 is normally ON (pulled high) and then if I pull either A or B are pulled low, it turns Q1 OFF? Is that right? So that would make it an inverted OR gate, not an AND gate? please explain.
AND gate : any one of inputs is low then the output will be low.
Your circuit is AND + Inverter = NAND.
My circuit is the same AND + Inverter = NAND.
If any one of inputs of the diodes is low then the common of diode will be low, that's equal to the AND gate theory.

The question is what is your input signal V/I?
 

Thread Starter

strantor

Joined Oct 3, 2010
6,782
I got what I wanted by putting the transistors in series with the relay coil like in my bottom right drawing, so further discussion is just for S&G, my curiosity and learning, and the pleasure of discussion. Thank you all for your input.

If your sensor output is a low impedance to ground and you're waiting for a "high", Scott's circuit is a "nand". If your sensor outputs are "high" or high impedance until they go "low", it's a "nor". Depends on how you look at it.

Still, it's a good example. If you want it backwards, re-design it to use a pnp.
There are a few logic inversions going on here, and I think that's where the confusion comes in; that, and my misuse of terms. This is for my projector screen, and this is the lower limit sensor, to cut out the relay and make the screen stop. The sensor is meant to be used with a pullup resistor, thereby giving a "high" signal at the collector when something is detected. I am instead using the output transistor directly to switch the relay coil so the logic is inverted (or at least it helps me to think of it that way). The output transistor is ON when nothing is detected, and it turns OFF when something is detected.

So in your terms, the sensor is a low impedance to ground, and I am waiting for a high impedance to ground, to cut out the relay. So I call this "AND" because I need the the original transistor AND the sensor transistor to be ON in order for the relay to energize. What is the proper term I should be using, and why? I think of these signals as being both "high" when there is a high signal at both bases and both transistors are ON. Is that where I'm getting backwards? Should I be thinking in terms of what level is present at the collectors?
AND gate : any one of inputs is low then the output will be low.
Your circuit is AND + Inverter = NAND.
My circuit is the same AND + Inverter = NAND.
If any one of inputs of the diodes is low then the common of diode will be low, that's equal to the AND gate theory.

The question is what is your input signal V/I?
I'm not arguing with you; please don't take it that way. Just trying to figure this out. Wherever I'm getting my terms mixed up (AND/NAND/OR/NOR, high/low, etc.), I do still feel that I have an understanding of what is going on in both circuits, and it seems to me that your circuit does not do the same thing as the circuit I posted.

In my circuit, if both of my transistors are ON, then the relay will be ON.

In your circuit, if I connected my transistors to A & B, and they were both ON, the relay would be off. Or does your circuit imply that I do away with my transistors, and route the signals that would have gone to my transistor bases directly to A & B?
 

ScottWang

Joined Aug 23, 2012
7,397
I'm not arguing with you; please don't take it that way. Just trying to figure this out. Wherever I'm getting my terms mixed up (AND/NAND/OR/NOR, high/low, etc.), I do still feel that I have an understanding of what is going on in both circuits, and it seems to me that your circuit does not do the same thing as the circuit I posted.

In my circuit, if both of my transistors are ON, then the relay will be ON.

In your circuit, if I connected my transistors to A & B, and they were both ON, the relay would be off. Or does your circuit imply that I do away with my transistors, and route the signals that would have gone to my transistor bases directly to A & B?
Do I arguing with you?
I'm sorry if you felt that way, I'm just trying to explain and figure out what you need, as until now that I still didn't have the V/I of the inputs.

The truth table of my circuit:

A_B__diode-comm__Bjt(C)
-------------------------------
0_0_______0______1(OFF)
0_1_______0______1(OFF)
1_0_______0______1(OFF)
1_1_______1______0(ON)
 
Top