Can't turn on 12v lamp with npn transistor

Hello, i'm currently working on project that require 12v led lamp with 120mA current draw to be turned off and on with vibration sensor. While i dont have any issue with logic (it's basicly turning led with button) i got some issue with lamp itself. I'm using npn 2n3904 transistor with 1k resistor on base to control it, and it doesn't work. I've tried using it in darlingotn but it didnt change anything, should i change transistor ? I used bc547 before but the colector current is to low for it to work properly.

Can you please post a circuit diagram and if possible a picture of your project?
Is the LED in the collector circuit of the BJT?

What is your power supply?

Thanks... Tom... :smiley: :+1: :coffee: :australia:

I'm no transistor guru, and that's why I tend to use logic level mosfets rather than bjts. It works on voltage, and I don't have to worry about current gain and stuff, which keeps it simple for my simple mind.

lamp that i'm using : Flashing light - LED 12V_ Botland - Robotic Shop
Power suply : Buy Switch-mode power supply 12V/2,5A - 100V-240V Botland - Robotic Shop

Is the 12V supply gnd connected to the Arduino controller gnd?
A complete schematic would have shown this.

What model Arduino are you using?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Sorry, i'm using my work laptop right now and dont have acces to full schematic. And yes, i'm using same supply to power up arduino, i'm using uno r3.

What happens if you drop R3 to 470R, that will give.

( 5 - 0.6 ) / 470 = 9mA of drive, well within the current limit of the UNO output pin.
Try putting another 1K in parallel with R3.

Do you have a DMM?
Can you please post your code?

Tom... :smiley: :+1: :coffee: :australia:

the 1k resistor will give you about 4mA of base current.
The 3904 has a gain of around 30 so 4 * 30 = 120mA Ic

You need more base drive to ensure Vces is low, I'd suggest about a 390 ohm to give Ib=10mA

However unless you have blown the transistor it SHOULD have done something. (probably dim led and transistor getting hot)
Its rated 625mW so 120mA * 5V Vce would still be OK.

Check you have the pin connections correct.

To minimise the voltage drop of the transistor and minimise it's heat dissipation, you need to saturate the transistor with plenty of base current. In this state, the gain will be lower, perhaps only around 10. So I would recommend 330R or even 220R.

But I agree with @johnerrington: you should have seen at least some flickering of the lamp with the transistors you have tried up to now, so something else may be wrong here.

Have you tested the lamp by connecting it directly to the 12V supply, for example?

The current gain of a transistor only applies to the active region (analog amplification), not to switching transistor between saturation and cutoff (which is what happens for switching a load).

For proper saturation most transistors require the base current to be around 5% to 10% of the collector current, as the physics of the saturated state are different from the transistor action in the active region. In saturation current flows backwards across a forwards-biased base-collector junction, due to concentration gradients and thermal diffusion, not the electric field. Put simply the high base current is required to build up sufficient concentration of carriers in the base to defy the electric field.

In analog uses of a transistor the base-collector junction is reverse biased, and the electric field created by this sweeps charge carriers away from the base to the collector before they can escape via the base electrode (except for a tiny minority) - hence current gains can be many hundred for this mode of operation.


True; however in this case saturation is not a requirement. The data sheet gives HFE as 30 for Ic = 100mA and fig 16 on the data sheet shows at Ib = 3mA Ic=100mA Vbe = 1V
which for the OP's requirement would be fine (1v 120mA = 120mW)

The presence of this whole discussion about BJT gain and wotnot is exactly why I use logic level mosfets :wink:


You won't usea BJT because of the maths and experimentation that may need to be done in the real world???

Tom.... :smiley: :+1: :coffee: :australia:

Not in my real world, no.

I bought a couple of packets of logic level mosfets years ago, not the best resistance value when on, but they work for me.

If I ever have to use a bjt for whatever reason, I did do 3y of maths at uni so could probably manage the sums. Remember that not all people use or dabble in Arduino for the same reasons.

Thank you all for your help, i end up following @sionaggutraidh advice and switched to logical mosfet (i know it's taking the easiest route but it works). Topic can bo closed :slight_smile:

I don't call calculating 10% of a current to be taxing! And MOSFETs have issues too, like the fact most people are misled by the threshold voltage.