# Issue with NPN transistor as a switch

I am working on this simple circuit, which uses a BC547 transistor to switch ON a LED when trigged by a switch.

The scenario is the switch is connected after a long wire about 20 meters.

Issue: When I connect the long wire, even though the switch is in the off state or not connected, the LED starts glowing with lower brightness.

Later when I checked if I am touching the base side of the switch wire with bare hands the LED glows with full brightness.

Can anyone understand why this is happening and how can I avoid it?

• Is there a reason for the 1k resistor from collector to +12V? Commented Jul 6, 2022 at 18:52
• @PStechPaul Absolutely... Without the 1k resistor the LED starts glowing with lower brightness though the switch is in off state. I don't know what the logic behind is called in terms of electronics. Commented Jul 7, 2022 at 7:15
• Apparently the transistor has enough leakage current to produce a visible glow of the LED. The spec sheet* shows a maximum leakage current (Icbo) of 15 nA, which is negligible, so there is probably enough base current from leakage or capacitive coupling to EMI to cause current flow. The resistor shunts this current to a point where the voltage is less than the forward voltage threshold of the LED. But adding a resistor base to emitter is a better fix. * onsemi.com/pdf/datasheet/bc550-d.pdf Commented Jul 7, 2022 at 22:09

simulate this circuit – Schematic created using CircuitLab
The added R4 should help to keep the transistor OFF when SW2 is open-circuit.
But why not lose the transistor, and keep it simple? (circuit at right)

As Tony says, the long wires between battery and LED should be twisted-pair, or "zip" cord.

• It worked using 10k as R1 and 1k as R4. Thanks for the guidance. Commented Jul 7, 2022 at 16:06

Add a 10K resistor from the transistor base to emitter.

The problem is that when the switch is open, but base is "floating" - not connected to anything. The long wire connected to the base is an antenna picking up all kinds of electrical noise. That noise is enough to create a potential difference between the base and emitter. The available noise current is very low, but when the voltage difference is above about 0.45 V, the transistor just barely begins to conduct. A 10 K resistance is low enough to shunt away the noise currents without affecting the transistor's normal operation.

Also, to extend battery life you can increase the base resistor to 4.7K.

• I tried adding a 10k resistor but it didn't work. Thanks Commented Jul 7, 2022 at 15:52
• It worked using 10k as base resistor and 1k between base and emitter. Thanks Commented Jul 7, 2022 at 16:08
• Surprisingly low value, but not a problem. Commented Jul 7, 2022 at 19:10

When you touch a 10:1 scope probe you can see the E-field with only uA of current in 10MOhm. The same radiated voltage fields exist couple to your Vbe so that is enough 50Hz to flicker the LED dimly.

Using twisted pair or STP cable helps. But since wall currents and voltages act like antenna at 50 Hz and your wires also or like an air core transformer with a very low coefficient of coupling , we call this parasitic leakage current. The base-emitter impedance is very high when < +/-0.5V so the quick design rule is to load and attenuate this "stray voltage" with a resistor on base to ground such as 10k.

The 1k to base from 12V is relatively low for what is needed to drive 500 Ohms + LED (~10 ohms) and often a 10:1 ratio for Rb/Rc ~ = Ic/Ib as minimum so 10k would be fine also.

ok?