3
\$\begingroup\$

My circuit is below. It has an NPN transistor. In NPN transistors, the current is supposed to flow from collector to emitter (from positive to negative), but CircuitLab shows negative current. Here is a snapshot:

Transient

I am looking at the line labelled I(R1.nA). I am sure CircuitLab is correct, but I cannot understand why it is happening.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
11
  • 4
    \$\begingroup\$ R2 is bizarrely low, why is it so low? \$\endgroup\$
    – Hearth
    Oct 5, 2023 at 14:42
  • 1
    \$\begingroup\$ @Hearth, this is in the name of science. I don't really know what I am doing, I am trying to learn. \$\endgroup\$ Oct 5, 2023 at 14:50
  • 2
    \$\begingroup\$ A picoohm is about fifteen orders of magnitude too small here. That's such a small resistance that even if you had a magic 1 pΩ resistor somehow, the wires you connect to either side of it will have orders of magnitude more resistance than the resistor. I have literally never encountered anything smaller than μΩ (1 μΩ = 1000000 pΩ), and even that only in extremely high-current measurement circuitry. Typical circuits doing ordinary things will never involve resistances smaller than about 1 Ω (= 1000000000000 pΩ), and a typical resistance in this position would be about 100 Ω to 10000 Ω. \$\endgroup\$
    – Hearth
    Oct 5, 2023 at 14:58
  • \$\begingroup\$ @Hearth Thank you for clarification! I was experimenting with different values of resistance and pico\Omega is what left. What is puzzling to me, is that with such a low resistance I would expect infinite current and it should burn transistor and I would not be able to plot anything, but somehow everything works just fine. I am guessing NPN transistor has some resistance in it to prevent it from burning. \$\endgroup\$ Oct 5, 2023 at 15:02
  • 3
    \$\begingroup\$ @user1700890 No, that's the base cut-off current, the maximum current you'll get out of the base when the transistor is in cutoff. What you care about is Pₜₒₜ, the maximum allowed power dissipation. Maximum base current is not usually given directly in datasheets as it's more a function of total power (which involves base and collector current) than base current alone. \$\endgroup\$
    – Hearth
    Oct 5, 2023 at 15:23

1 Answer 1

11
\$\begingroup\$

In simulators like CircuitLab or LTspice resistors have a direction, the current through them will plot differently depending on how the resistor is oriented in the circuit. If you take R1 and rotate it 180 degrees the current will be shown going positive.

It's hard to tell which way around they are, so what I do when possible is plot the current from a non-ambiguous point, such as the collector of Q1. In CircuitLab this is done by plotting I(Q1.nC).

\$\endgroup\$
16
  • 3
    \$\begingroup\$ Oh. My. Stars. What insanity. I checked, and it really does depend on which way you rotate the resistor. \$\endgroup\$
    – JRE
    Oct 5, 2023 at 14:52
  • 1
    \$\begingroup\$ Thank you so much! I wish there would be an arrow next to resistor to indicate current flow. \$\endgroup\$ Oct 5, 2023 at 14:52
  • 3
    \$\begingroup\$ @JRE That's how SPICE works; positive current in a two-terminal device is always current flowing from pin 1 to pin 2 (or maybe it was pin 2 to pin 1, I don't recall, but it's consistent). In graphical editors, you can't generally tell which pin is pin 1 and which is pin 2, but there is an order to them. \$\endgroup\$
    – Hearth
    Oct 5, 2023 at 14:55
  • 1
    \$\begingroup\$ @JRE I learned this long ago in LTspice. When designing a push-pull audio amplifier I wanted to plot the emitter currents for the output pair. The emitter resistors seemed like a good place to do it but since they're usually oriented the same way I'd have to turn one around or else both currents would show the same polarity. Using the current probe on the emitters of the transistor instead of the resistors plotted it correctly. \$\endgroup\$
    – GodJihyo
    Oct 5, 2023 at 15:13
  • 2
    \$\begingroup\$ Well, even though resistors in LTspice have a direction, it will at least tell you which way it thinks a resistor is oriented: if you hover over it when you have a run open, you get the current probe symbol with an arrow in it. \$\endgroup\$
    – harold
    Oct 6, 2023 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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