Need feedback on what the problem is (smoke appears)

I'm attaching my build and the code below in hopes that someone can find what the problem is. Everything seems to be working, except when I hold down the button to switch between brightness modes and it gets to the "brightness = 200" part, I see smoke coming from the 5V 24LED WS2812B ring. At one point the 10k resistor from the button got fried also. I'm not very good at electronics, this is just a hobby for me, so simple explanations are appreciated.

#include <FastLED.h>
#include <ezButton.h>

#define LED_PIN1    5
#define LED_PIN2    6
#define NUM_LEDS    48
int BRIGHTNESS = 200; // 0 - 255
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];

// IR
int IRpin = 7; // PIN for IR Sensor
int obstacleCheck = HIGH; // HIGH means no obstacle

// BUTTON
const int BUTTON_PIN = 2; // the number of the pushbutton pin
ezButton button(BUTTON_PIN);  // create ezButton object that attach to pin

void setup() {
  delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, LED_PIN1, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<LED_TYPE, LED_PIN2, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 3000);  // 5V 3A limit
  randomSeed(analogRead(0));

  // IR STUFF
  pinMode(IRpin, INPUT);

  // BUTTON STUFF
  button.setDebounceTime(10); // set debounce time
  button.setCountMode(COUNT_FALLING);  
}

void loop()
{
  // MUST call the loop() function first
  button.loop();   

  // Constantly read the IR pin status
  obstacleCheck = digitalRead(IRpin);

  // IF IR SENSOR IS COVERED LEDS GO DARK AND RESET COUNT, ELSE GO THROUGH COUNT MODES
  if (obstacleCheck == LOW)
  {
    button.resetCount();
    for(int i=0; i<NUM_LEDS; i++){
      leds[i] = CHSV(0, 0, 0);
    }    
    FastLED.show();
  }
  else
  {
    // Tracks which button mode we are in
    int count = button.getCount();

    // Counter while button is held down
    int myCount = 1;
    
    // While button is held down
    while(button.getStateRaw() && count == 0){

      myCount++;
      
      if(myCount == 500) {
        BRIGHTNESS = 10;
      }
      if(myCount == 700) {
        BRIGHTNESS = 40;
      }
      if(myCount == 900) {
        BRIGHTNESS = 70;
      }
      if(myCount == 1100) {
        BRIGHTNESS = 100;
      } 
      if(myCount == 1300) {
        BRIGHTNESS = 150;
      }
      if(myCount == 1500) {
        BRIGHTNESS = 200;        
        break;
      }     
      FastLED.setBrightness(BRIGHTNESS);
      FastLED.show();
    }

    if(count == 0){
      fill_solid(leds, NUM_LEDS, CHSV(100, 0, BRIGHTNESS));
      FastLED.show();

    } else if(count == 1){      
      FastLED.clear();
      function_mode1();

    } else if(count == 2){
      FastLED.clear();
      function_mode2();

    } else if(count == 3){
      FastLED.clear();
      function_mode3();

    } else if(count == 4){
      FastLED.clear();
      fill_solid(leds, NUM_LEDS, CHSV(100, 0, BRIGHTNESS));
      FastLED.show();
      button.resetCount();
    }
  }
  
}

void function_mode1(){
  // Some light pattern here
}

void function_mode2(){
  // Some light pattern here
}

void function_mode3(){
  // Some light pattern here
}


Sorry I really can't tell much from your frizzy picture. An annotated schematic drawn as you have wired it would make solving your problem much easier especially if you include links to "Technical" information on the hardware devices. From what you have shown there is no way you could have fried a 10K resistor. Even if you placed it directly across the supply it would only generate 0.0025 watts of heat with 0.5 mA of current, at 12V it would be 0.0144 watts. There is something else. You can try to rotate your button 90 degrees. The LEDs draw about 60mA each or 20mA per color.

For that a very high voltage (>100V) is required. Replace your power supply by some more reliable one. That voltage can have killed everything connected to it.

maybe the 10k resistor wasn't 10k

1 Like

If your circuit is wired as shown in the photo then the only way to damage the components are:

  1. input is not 5V. Note there is an adjustment control on your supply. If it reflects the board you actually have the output could not be the 5V you think you have.

  2. Accidentally shorting something,

I would start piece by piece.

  1. get your arduino working without any other devices (i.e. no pot ....)
    Verify operation with the on board LED running the example Blink without delay.

  2. Slowly add components one at a time and prove they work before moving on.

If you pushbutton is toasted you definitely have something mis-wired.

Resistor on the button says it's 10k but colours show 10R.
Similar on LEDs...text says 220k ...colour code says 220R...latter may or may not be correct size.

Good point. I'd like to see images of the actual hardware. 220R would be correct for the NeoPixel drive, 220k definitely not.

I have worked with several people that did not know they were color blind until the tried to read resistor color codes. In addition, trying to read them in other than color neutral artificial light is always going to be trouble.
Check the resistors with the Ohmmeter to be sure.

1 Like

Thanks to all your feedback! I think you were right about the resistors. The resistor next to the button turned out to be 10R instead of 10K. I must have pulled it out of the wrong section of my folder where I keep all my resistors. I swapped it out and no longer see any smoke. Much appreciated!

Use the INPUT_PULLUP method with no resistor, and you will never again have this problem.

Use a meter to check your R's! I bought a large screen DMM that reads ohms, caps, and will even light an LED. I bought it because it had an audible ohms function but it does much more:

I too want a Muitmeter. :slight_smile: But it has to measure microMuits.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.