[Closed]Switching 12V lamp with BC337 transistor.

Hello everybody. My name is Andrea, I'm italian and this is my first post in this forum.

As you can read in the subject I am trying to switch a 12V lamp with a BC337 transistor.

I tryed to do what you can see in the attachment.
(instead of batteries there is a 12V transformer and instead of the resistor on the top there is the lamp)

this is the code I am using:

#define TRANSISTOR 8


void setup () {

  pinMode (TRANSISTOR,OUTPUT);
  pinMode (13,OUTPUT);
}

void loop () {

        digitalWrite(TRANSISTOR,HIGH);
        digitalWrite(13,HIGH);
        delay(1000);
        digitalWrite(TRANSISTOR,LOW);
        digitalWrite(13,LOW);
        delay(1000);
        
}

The code works because the led 13 blinks but my 12V light doesn't blink.

What should I do? Where do you think I'm wrong?

Thanks to all of you.

Is the lamp stuck-on or stuck-off?

What is the current (or wattage) rating of the lamp? The BC337 is rated for 800mA maximum, and you should leave a good safety margin. 12V @ 800mA is 9.6 Watts. If your lamp is more than a couple of Watts, you need a "bigger" transistor (probably with a heatsink) or a MOSFET with the appropriate current rating.

(instead of batteries there is a 12V transformer and instead of the resistor on the top there is the lamp)

Is that an AC transformer or a DC power supply? A single transistor won't work properly with AC.

In most places you use the name "TRANSISTOR" to designate Pin 8 but when you go to set the pin LOW you use the name "TRANS" instead. That is unlikely to be defined as 8 so I would expect your light to stay on.

Goodmorning to everybody and thanks for your answers.

The little 55W bulb I am using is taken from a car.
The transformer I am using is a AC-DC adaptor.
I wrote TRANS in the code I posted but I wanted to write TRANSISTOR. Sorry for my error that I have just corrected.

Maby (V/W)=(55/12)=4.58A are too mutch current for my transistor, as I can understand from what you are saying.
Can I connect more transistor in parallel to have less current on a single transistor?

randre:
The little 55W bulb I am using is taken from a car.
The transformer I am using is a AC-DC adaptor.

Maybe it's just me, but I'm having trouble reconciling "55W" and "little".
Is this an incandescent headlight or something?

What's the labelling on this adapter (Volts, Amps -wise) ?

You can see in the attachments my lamp and my adaptor.

I tried to switch on the lamp directly with the transformer and it works.
I tried with 6 parrallel transistors (without any resistances connected to collectors) and i burt one of them. I only saw a little light from the lamp.

Andrea,
the lamp is 4.58A but your power adapter give only 1A. Your lamp is too big or your power is too little.

Ok thanks. Now I am trying with a 12V, 5W lamp.

The light is always on even if my pin 8 is LOW and HIGH every second. What should I do? (thanks for all the answers)

Get a new (as in "not previously used") transistor.

I guess the resistor at the top of the drawing is there in place of the lamp?
Your picture doesn't show any connection between the breadboard common rail and the Arduino Ground.

Still, the cold resistance of such a lamp is going to be very low at start-up (resistance increases with temperature), perhaps enough to strain the transistor anyway.
Depending what your goal is, maybe you should consider a relay.

Hi Runaway Pancake!

The resistor at the top of the drawing is the lamp.
I didn' connect the adaptor ground to the arduino ground but then I realised that i had to do it (even if i don't know why).
I also used a new transistor. Now the lamp "blinks" but when it should be off there is a lot of light and when it should be on there is more of light so the lamp is never off.

1 Like

You Replied while I was Replying.

The cold resistance of such a lamp is going to be very low at start-up (resistance increases with temperature), perhaps enough to strain the transistor anyway.
Depending what your goal (simply On/Off?) is, maybe you should consider a relay.

My goal is learning how to manage higher voltages than 5V.
I also wanted to do something like a "fade-in / fade-out" but my light does not turn off completely. :frowning:
What do you mean when you say "strain the transistor"?

randre:
What do you mean when you say "strain the transistor"?

Too much collector current!

Do you have an ohmmeter?
If so, measure the lamp's resistance (out of circuit). That's approximately the resistance the collector is seeing at start up.

No I'm sorry, I haven't got it.
The light is also on when i disconnect arduino from my pc..

So far as being "on" with the Arduino disconnected goes, that makes me think the transistor has been damaged.

Try to add a resistor (10K to 47K) from the base to Ground. [Leave the 220? base resistor as it is.)

I tried adding the other resistence and i changed the transistor but nothing changed. (transistor always get very hot after a few seconds)

Well then that appears to cinch it.
You need a better transistor.
You need a "logic-level" MOSFET.
Maybe, eventually, a few. (They can be paralleled for more current.)

Ok. Thanks for helping me. Goodbye!