I'm trying to build a PWM led dimmer with Arduino using this circuit:


simulate this circuit – Schematic created using CircuitLab

Everything works fine until the pin PWM 3 drops below the analog value 50 (more or less) the LEDs starts blinking fast and noticeably. However, if I touch with my finger the metal cup of the BJT transistor the LEDs do not blink anymore and they work as I assumed. The test program is below, and I've tested it with an Arduino UNO and an Arduino MEGA and they both have the same problem. The DC supplier is a transformer I bought from an electronics shop and it works properly if directly attached to the strip.

Test Program:

void setup(){
  pinMode(3, OUTPUT);

void loop(){
  for(int i = 0;i<=255;i++){
    delay( i<=40 ? 300 : 50);

  for(int i = 255;i>=0;i--){
    delay( i<=40 ? 300 : 50);

I tried searching my problem on the internet and I've found a schematic which uses a P2N2222 transistor in this article, which is equivalent to mine, except for the fact that it uses a P2N2222. I also tried changing the transistor to a new one (in case the one I'm using is broken), but it did not help.

So I don't see what I did wrong, could you please help me in finding it out?

  • 2
    Did you write the program yourself? That is okay. The schematic is wrong, when you connect it that way, the transistor, the arduino board and perhaps the ledstrip as well are blown. When using 24v, you could damage your computer as well via the usb cable. Tell us more about the led strip. Can you give a link to it? How much voltage and current does it need? – Jot Mar 16 at 10:35
  • The led strip requires 24V and 500mA of current. I have no links for that because I bought it from an electronics store a long time ago. I've already tried the schematic shown and it did not damage anything... why should it damage a component? – LuxGiammi Mar 16 at 11:14
  • Looking at the schematic, it seems like the LED and the transistor are upside down. – Gerben Mar 16 at 11:48
  • Your diagram has the transistor wired backwards. It should not work that way. – Duncan C Mar 16 at 11:48
  • 1
    As DataFiddler says, the LED strip may well have electronics in it that get confused when you feed it pulsed power at too low a duty cycle. Without more info about the LED strip it’s impossible to tell for sure. – Duncan C Mar 17 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.