Help needed with a project

Hey there. I want to ask for your help. I'm trying to build a project for underbed LED light. I already damaged 3 boards so that any help will be much appreciated.

My wiring
ESP32 Wroom devkit
2x 3PIN PIR sensor
5V 70W power supply
5m long DC5V WS2812B Individually Addressable 5050 RGB Led Strip

I'm using a breadboard. The same power supply is used for powering the LED strip, and it's also connected to the breadboard +/-. PIR sensors are connected to +/- on the breadboard, and data pins to GPIO 33 and 32 on ESP32 (I'm using two sensors). ESP32 is connected to the breadboard for power via VIN and GND PIN. GPIO12 is connected to the data pin on the LED strip.

I want to light up the LED strip when motion is detected and gradually light up the LEDs. The cloud variable sets the maximum brightness. The code worked for a short time, but then the board burned. I tried to add a 1k resistor between the LED strip and ESP32, but the second board burned as well. I tried some code tuning but burned 3rd board.

From what I know, it should not be a problem to power ESP32 with 5V power supply via VIN. I'm lost here, can someone please give me a hint what I'm doing wrong?

Thanks a lot!

My code:

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include <FastLED.h>
#include "thingProperties.h"

#define LED_PIN     12
#define NUM_LEDS    150
#define MOTION_PIN1 32
#define MOTION_PIN2 33

CRGB leds[NUM_LEDS];

bool motionDetected1 = false;
bool motionDetected2 = false;

unsigned long lastMotionTime = 0;
const unsigned long timeoutDuration = 5000;  // 5 seconds

void setup() {
  Serial.begin(9600);
  pinMode(MOTION_PIN1, INPUT);
  pinMode(MOTION_PIN2, INPUT);
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

  initProperties();
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
}

void loop() {
  ArduinoCloud.update();
  unsigned long currentTime = millis();
  
  motionDetected1 = digitalRead(MOTION_PIN1);
  motionDetected2 = digitalRead(MOTION_PIN2);

  if(motionDetected1 || motionDetected2) {
    lastMotionTime = currentTime;
    if (motionDetected1) {
      for(int i = 0; i < NUM_LEDS; i++) {
        leds[i] = CRGB::Red; // Hardcoded Red color
        FastLED.show();
        delay(10);
      }
    } else {
      for(int i = NUM_LEDS - 1; i >= 0; i--) {
        leds[i] = CRGB::Red; // Hardcoded Red color
        FastLED.show();
        delay(10);
      }
    }
  }

  if(currentTime - lastMotionTime >= timeoutDuration) {
    // Turn off LEDs
    for(int i = 0; i < NUM_LEDS; i++) {
      leds[i] = CRGB::Black;
      FastLED.show();
      delay(10);
    }
  }
}

void onColorChange() {
  // This function will be called whenever the color value changes
}

void onBrightnessChange() {
  // Update the global brightness of the LEDs
  FastLED.setBrightness(map(brightness, 0, 100, 0, 255));
}

/*
  Since LightLevelTrigger is READ_WRITE variable, onLightLevelTriggerChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onLightLevelTriggerChange()  {
  // Add your code here to act upon LightLevelTrigger change
}

Welcome. Thank you for properly posting the code in a code block. So many new members do not read the guide lines and must be asked to post code properly. Good job.

What board? The ESP32?

Those WS2812 LEDs use about 60mA each when at full white brightness. 0.06 * 150 = 9A. You cannot run that kind of current through a solderless breadboard.

Please post a schematic or wiring diagram. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.

A 5 foot strip should have power connected to more than one place. For instance connect at both ends. No more than, say, 3 feet without a power connection and the strip should be powered right off the external 5V supply.

It is really really important to post a schematic how you have things wired together.

What did you observe in detail when

Did you see the "magic smoke"?
Did you smell too hot plastic?
something else?

Do you have a digital multimeter for measuring voltages and current?
if the microcontroller is dis-connected
If the LED-strip is connected to the power-supply

What voltage do you measure between ground and data-wire?

As the LED-strip works on 5V and the ESP32 works on 3.3V It might be nescessary to use a voltage-level-shifter between LED-strip-data and ESP32-IO-pin

best regards Stefan

There is no reason for the Arduino to fail unless the Arduino are connected incorrectly. Show how you are connecting the Arduino and the power supply.

Hello treble

Welcome to the worldbest Arduino forum ever.

I assume that you have written the programme by yourself, then it is quite easy to find the error.

There's a trick to figuring out why something isn't working:

Use a logic analyzer to see what happens.
Put Serial.print statements at various places in the code to see the values of variables, especially ones that control the motors, and determine whether they meet your expectations.

Have a nice day and enjoy coding in C++.

Thank you for your replies.

I'm sending a schematic (sorry, hand-drawn, but it was easier than finding a tool for this).

By "the board burned" I mean:

  • once, I saw a small "puff" and a small amount of smoke
  • in all cases, the chip was really hot, and I smelled melting plastic

Do I have a multimeter? Yes, I do, but I didn't do the measurement as I'm not sure what to measure (I have very little experience, and this is my third project; so far, I haven't run into any issues with my previous, also very simple projects)

Components:
PIR sensor - HC-SR501 Module
Board - ESP32 Development Board TYPE-C USB CH340C WiFi+Bluetooth Ultra-Low Power Consumption Dual Core ESP32-DevKitC-32 ESP-WROOM
LED - 5m long DC5V WS2812B Individually Addressable 5050 RGB Led Strip
Power supply - TLPZ-5-70 5V 70W 14A power supply

Which chip?

There should be a 470R resistor in series between the output pin and the WS2812 Din to limit the current into Din.

image

Chip on the ESP32 board. I ran into this same issue (= I damaged another board) even when I added a 1k resistor (that was the lowest I had at home).

Have you checked the output of that power supply to make sure it's actually 5V?

So the ESP32 chip? USB chip? Voltage regulator? It helps if you can be specific instead of using ambiguous pronouns.

The ESP processor only provides a 3V3 signal. You are providing a path from 5V into the output signal of the ESP. Therefore you are likely to blow things up.

You can either drive the LED strip with 3V3 if you have a 10A capable supply. Or you can add a circuit to boost the signal from the ESP from 3V3 to 5V, like this one:-

Yes, I did. It was 5,02V

Sorry for not being precise. I didn't realize there could be more things to refer to as a chip on the board.

Not sure what's going on but I do know one thing for sure, you shouldn't use pin D12.
It needs to be LOW during boot otherwise unpredictable things can happen

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