Electronic – arduino – Dimmer effect (fade) on 12v LED using transistor and Arduino

arduinobrightnessledtransistors

I am working on a project on which I want to control the brightness of a 12v LED using a transistor and an Arduino board. So far I have used the 2N3906 resistor connecting the collector to the 12v Power supply, the base to the PWM of the Arduino (in which I am using the "Fade" example where it increases and decreases the value indefinitely) and the emitter to a resistor followed by the LED. As a result, the LED was lit on a very low voltage which was received ONLY from the PWM of the Arduino. I have also used a BC327 transistor connecting the collector to the 12v Power supply, the base to the PWM of the Arduino and the emitter to the LED. On this result, the LED was lit brighter than the previous but not on as much as it should.

My question is, am I doing something wrong? Are the transistors that I used not capable of performing this job? What should I do for the LED to be lit on maximum and control its brightness via the value of the PWM of the Arduino?

The PWM voltage of the Arduino is 5v.

Feedback to your answers:
I have ordered each sensor that each one suggested and I will try out your solutions. Once I am done, I will let you know about the results.

Best Answer

You are using PNP transistors in a situation where NPN would be much more suitable.

For that matter I would personally choose an N-channel MOSFET instead of BJT.

schematic

simulate this circuit – Schematic created using CircuitLab

R1 needs sizing for the current flow for your LED. R2 is used to keep the MOSFET turned off while the Arduino isn't actively driving the IO (it starts in INPUT mode while the bootloader runs for 2 seconds).

Make sure you choose a MOSFET that can a) handle the current you need, and b) is a logic level MOSFET with a \$V_{GS}\$ of no more than a couple of volts.