So I'm working for a project to control RGB Led Strip using microphone or sound sensor with Arduino Nano. I'm using 5050 RGB Led Strip around 120 LEDs, and I control them using simple transistor circuit to each channel R, G, and B, then I connect the base of the transistors to the resistors and PWM Outputs of the Arduino. And then I'm using KY-038 Sound Sensor (I'm using the Analog Output pin) and connect it to Arduino A0.

The problem is when I didn't connect the LEDs, the microphone worked correctly. I processed the analog input, put filter and threshold. When I connected the LEDs, the reading of the A0 is disturbed by the transition of the LED (for example from 0% PWM to 50% PWM or ON). As the result, my analog read detected it as a voltage swing and recognize it as a sound, and trigger the LEDs, then oscillating without any external sound. If I disconnected the LEDs, it worked correctly, for example I change it to Arduino Built-In LED, it turned on according to the external sound.

Why does this happen? I don't think they share the same timer, and I also use proper Power Supply and Capacitor to provide the enough power.

My project is similar to this project.

  • try using mosfets instead of bjt; they don't draw any/(ok, as much) current from the MCU.
    – dandavis
    Apr 20, 2020 at 19:43

2 Answers 2


I think it is because of power consumption.

If the LEDs consume lots of power, the LED on Arduino(typically mini red LED) will be off or faded. So before you connect the LEDs, check the mini red LED which is on Arduino and after connection the LEDs, check ones again. If the red LED is faded or off, the problem must be power consumption.

Connect 12v or 5v to vin to powering the Arduino, and also to LEDs The important thing is you should not connect LEDs to Arduino 5v.


Which model of LED are you using? 5050 is just the form factor. However, I think the problem is related to power consumption. The well-known WS2812B (a.k.a. Neopixel from Adafruit), may consume about 50mA. Considering 120LEDs, you can reach an important level of current (circuit supporting more than 1A should be properly designed). The sudden change of current can easily change introduce noise on the entire circuit. The solution should use an external power supply dedicated for LED, sharing GND with your Arduino.

  • Not the WS2812B, only RGB LED 5050 with current limiting resistor, so it only has 4 pin for common anode, R, G, and B. I'm using 5v Power Supply with maximum 2A I believe, and I added Capacitor 100uF (didn't calculate this, only hope that it works, but it didn't). So the connection is from PC (for Serial Monitor) to Mini USB, and then VIN to 5V Power Supply. Does the use of breadboard also affect this?
    – juliussin
    Apr 18, 2020 at 10:58
  • 1
    Try removing the 5V from the power supply from the VIN pin. 5V is too low a voltage for the linear regulator anyway. And you already provide 5V via USB.
    – Gerben
    Apr 18, 2020 at 12:31
  • Yes Vin should be between 6-12V, otherwise, the regulator cannot work Apr 18, 2020 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.