Usually in circuits a relay is placed "before" the transistor (meaning between VCC and the transistor) in case of a NPN-yransistor whereas a relay is placed "after" the transistor (meaning between the transistor and VSS) in case of a PNP-transistor.

I do understand that in both cases the relay is on the collector side of the transistor - but why is it placed there? As far as I understand, a relay should switch on/off independent of where it is connected to the transistor (emitter or collector.)

  • 3
    \$\begingroup\$ Because common emitter offers the highest power gain as well as low Vce, making it the best configuration for switching. \$\endgroup\$ – Brian Drummond Oct 31 '20 at 13:48
  • 2
    \$\begingroup\$ As far as I understand, a relay should switch on/off independent on where it is connected to the Transistor - your assertion is incorrect. \$\endgroup\$ – Andy aka Oct 31 '20 at 13:49
  • 5
    \$\begingroup\$ Can you put an example circuit so that everyone will have a clarity of what meant by "before" and "after". \$\endgroup\$ – Mitu Raj Oct 31 '20 at 13:59
  • \$\begingroup\$ Your question is not very clear. Can you skim my answer below and let us know which schematic looks like what you are talking about? "How to properly use a relay module with JD-VCC from Arduino/Raspberry?": electronics.stackexchange.com/questions/505318/…. \$\endgroup\$ – tlfong01 Oct 31 '20 at 14:04
  • \$\begingroup\$ The answer is very, very simple, and applies not only to relays but to all manner of loads. If you put the relay after an NPN, it is too hard to drive the base high enough to turn it on. You will need a voltage higher than VCC. Similarly, if you put the relay before a PNP, you will have a hard time driving the base low enough to turn on the PNP. You will need a voltage lower than ground. \$\endgroup\$ – mkeith Oct 31 '20 at 18:19

Here's two circuits for you to look at. I'm sure you can imagine flipping them over to the PNP equivalent if you want to.


simulate this circuit – Schematic created using CircuitLab

Let's assume that to actuate the relay, we need to have a minimum of 10 V across it (a reasonable assumption for a 12 V relay).

In the left circuit, if we want to switch the relay on, all we need is to put at least 0.7 volts between the base and ground, which we can do easily by putting essentially any voltage > 1 volt on the input node. Then the transistor will saturate, the voltage at node A will be around 0.1~0.3 V, and the relay switches on.*

In the right circuit, we need at least 0.7 volts between the base and node B. Remember, for the relay to be turned on, we need it to have at least 10 volts across it, which means that node B is at least 10 V relative to ground. So the voltage at the base needs to be 10.7 V relative to ground, and your input needs to be more than about 11 volts. But the microcontroller probably can't output 11 volts; it can only do 5 V and 0 V (or 3.3 V and 0 V, or 1.8 V and 0 V, depending on its supply voltage).

The transistor will still amplify the current, so the microcontroller doesn't have to supply as much current as the relay requires, but the voltage becomes a limiting factor. And even if you were to put 12 V on the input, with zero base resistance, you'd still have only 11.3 V across the relay, compared to 11.7~11.9 in the left circuit.

*note: This is a simplification, the required voltage depends on the resistor of choice and the current required by the relay. Don't worry about it, the important points of the argument still stand.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.