Sound detector issues with 5v 2A wall wart

I'm trying to make a sound reactive LED strip and I'm having trouble when I try to power both the Arduino and LED strip with a 5V 2A wall wart.

My parts are:

  • Arduino Uno R3
  • Sparkfun Sound Detector
  • max9814 microphone
  • WS2812B 5V RGB Addressable LED strip
  • 5V 2A wall wart

I've attached the two different designs I've tried.

  • (works) The first one where the LED strip is powered by the wall wart and the Arduino and Sound Detector is powered by the USB plugged into my computer is producing expected results.
  • (doesn't work) In the 2nd one where I unplug the USB power and use the power supplied by the wall wart to power everything causes the sound detector to provide seemingly random results.

I'm not sure how to debug this, so wanted to see if anyone can provide me more information. Below is the code for the project too.

#include <FastLED.h>

#define NUM_LEDS 100
#define LED_PIN 13
#define minVal 6450
#define maxVal 7000
int reads = 32;
CRGB leds[NUM_LEDS];

#define soundPin A5
#define ctrlPin A0

float soundVal = 0;

void setup () {
  Serial.begin (9600);
  
  pinMode(soundPin, INPUT);
  pinMode(ctrlPin, INPUT);
  
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.clear();
}

void loop () {
  soundVal = 0;
  
  for (int i = 0; i < reads; i = i + 1) {
    soundVal += 1000 * analogRead (soundPin);
  }
  soundVal = soundVal / reads;
  
  //int led_cnt = max(min(fscale(minVal, maxVal, 0, NUM_LEDS - 1, soundVal, -3), NUM_LEDS - 1), 0);
  int led_cnt = max(min(map(soundVal, minVal, maxVal, 0, NUM_LEDS - 1), NUM_LEDS - 1), 0);
  
  Serial.print(soundVal);
  Serial.print(", ");
  Serial.println(led_cnt);

  for (int i = 0; i < led_cnt; i = i + 1) {
      leds[i] = CRGB::Green;
  }
  
  for (int i = led_cnt; i < NUM_LEDS - 1; i = i + 1) {
    leds[i] = CRGB::Black;
  }
  
  FastLED.show();
  delay(5);
}

Your schematic needs work. Red is typically 5V and Black is ground. It appears your grounds are not connected, that would explain your problem. You also have the polarity reversed on the LEDs. Give KiCad a try it is free and a very powerful schematic capture program.

Thanks gilshultz! That was a bug in my digital schematic, so updated it to reflect the actual design. I also included a picture of the implementation.

To me, it looks like I have a common ground connected across the led strip, sound sensor and Arduino. If I'm wrong, then I guess I have more to learn here.

Those leads look like breadboard hook up wires, most aren’t able to handle anything like the
current you are needing. I wouldn’t expect hook up wires like this to handle much beyond 100mA
without dropping significant voltage.

Get decent wire of known gauge for connecting between supply and LED strip. What is the max
current draw of your LED strip btw?

Thanks I got some progress with these questions!

Get decent wire of known gauge for connecting between supply and LED strip.

Thanks - I switched out all the connections to 22 gauge solid wire.

What is the max current draw of your LED strip btw?

Hadn't thought about that (though it's pretty important). According to their website it should be 60 mA/LED.

So to do 100 LEDs, I would need at least 6A. I've switched to my 5V 20A power supply and reduced my example down to 20 LEDs (instead of the original 100 LEDs). Things work without USB!

But going up to 50 LEDs causes the same problem - a seemingly random signal coming from the Sound Detector (plotter attached).

So you see, WS2812 LEDs generate a huge amount of noise on the power rails.

Whatever wire you use, the actual arrangement of wiring is critical. You must wire your power supply for the LEDs directly to the start of the LED strip. As so frequently explained, you need a 470 µF or 1 mF capacitor across the 5 V at the start of that strip to suppress some of the transient noise.

Now you need to connect the data input and ground back to the Arduino from that same place, the start of the strip, and run the wires (as you must have done also for the power wires) together as a pair.

If you actually propose to power the Arduino from the same power supply, which is a bit of an ask for a circuit dealing with audio, then you have to make sure that no part of the LED power supply wiring is common to the audio input which means the LED power supply must itself have no connection to ground. Noting that you are using a “plug pack” which has only two pins to the outlet, it seems yours is indeed isolated.

You can then take the 5 V from the start of the LED strip, again together with those data and ground wires, from there back to the Arduino.

Ok thanks everyone. I took some more time to factor in the feedback and think through this more.

Paul__B:
If you actually propose to power the Arduino from the same power supply, which is a bit of an ask for a circuit dealing with audio, then you have to make sure that no part of the LED power supply wiring is common to the audio input which means the LED power supply must itself have no connection to ground. Noting that you are using a "plug pack" which has only two pins to the outlet, it seems yours is indeed isolated.

So I've updated my schematic below and I think things are working when using only the 5V20A power supply. Oddly I now get the problem in reverse, so there's a lot more noise when both the power supply and USB are plugged in. I'm at a loss for this and will need to find out what to do here since I'd like to keep it plugged into USB while I'm tuning the parameters and testing my lighting algorithms.

I'm going to take a break from this project for a few days to clear my head, but all the feedback today was really helpful.

Ok nevermind - I think it finally clicked. I went ahead and simplified things for now. I'm using a fully separate 12v2A wall wart to power the Arduino and the 5v2A is powering the LED strip. Everything's working perfectly and I can also connect to USB without any noise or issues.

Thanks everyone!

I may post a separate question once I'm further in my project to understand more about cable management since needing to wall outlets (as I now require) seems to take up a lot of space. I'm sure there are other options but that's not relevant to this topic.

Attached is the final schematic that is working.

talkingpizza:
I may post a separate question once I'm further in my project to understand more about cable management

Please do not cross post. This thread describes your project, unless you were to duplicate all the information provided in this thread, your new thread would lack the context and presume people already know your background.

When you add to your thread, it automatically becomes recent in the topic listing anyway.

Sure - if it's preferred to have one topic per project, I can do that. I was used to having one topic per issue to prevent muddying the scope of a topic. Thanks!

talkingpizza:
Sure - if it’s preferred to have one topic per project, I can do that. I was used to having one topic per issue to prevent muddying the scope of a topic. Thanks!

No, it is important to have one topic per project precisely in order to prevent muddying the scope of a topic. :sunglasses:

Hey all - I've made more progress on my sound reactive LED strip, but would now like to learn how to simplify my power supplies. FYI I've also switched from the Sparkfun Sound Detector to a MAX9814.

Right now - I have a 12V 2A wall wart powering the arduino and a 5V 2A wall wart powering the LED strip. Ideally, I can find a way to simplify this such that I only need 1 wall wart that powers both the LED strip and Arduino.

From researching, I believe I can run the power in parallel with a DC to DC converter, but I'm not too sure about determining signal noise and managing for it.

Is the sketch below (modified from an example I saw online) the right direction?

Untitled drawing.png

Untitled drawing.png

You show a connection between the negative input and negative output of the DC-DC converter. That is completely inappropriate. If the connection is made in the converter itself, then you do not need that other connection; you need to constrain the 5 V ground current and noise to the converter itself and keep it as far away from the 9 V side as possible.

If the converter (unlikely) isolates its input and output, that would be great! The only ground connection between the 5 V and 9 V parts would be those paired with actual signal connections between the two and you would avoid problematic ground loops. Unfortunately for a "buck" converter, the grounds are commoned and the ground layout becomes critical as I explained in #5.