Prevent audio distortion in arduino LED strip VU-meter project with TRS splitter


I'm working on a DIY VU meter using an Arduino Uno and a 1m 144 led WS2812B led strip.

The idea is to plug a 2.5mm audio jack output (from my PC for now) into a splitter, then feed one end to my speakers, and the other to an audio jack input which feeds to the arduino to be processed into signals to the LED strip based on left/right audio levels.

Visually, it works great and it looks absolutely spectacular! Here's my code (gitlab), I also attached the current version to this post. As I'm a C/Arduino/electronics noob, I'm actually quite proud 8)

But... It sounds awful, because as soon as I connect my PC mobo audio out to both the arduino and the speakers, the audio gets quite distorted. My guess is that it has something to do with the fact that the audio out is coming from the same machine as the USB connection and it's all connected to itself one way or another.

I'm hoping for suggestions about where/how to start troubleshooting this, or which components to add to battle the audio issues.

Thanks for bearing with me :slight_smile:


  • ino code (for completeness, though I guess it's not very relevant)
  • I tried drawing a real electronics diagram but I guess have a lot to learn before I get those right, so here's my toddler attempt
  • photo of my actual functional noob experimental setup

... and finally, here is an awkwardly one-handed filming of the functioning product and the audio distortion issues that happen as soon as I connect the end of the audio splitter to the Arduino loop.

VU-RGB.ino (5.45 KB)

Most likely the problem is the negative half of the AC audio signal. The Arduino can be damaged by negative voltages and/or the audio signal can be "damaged" (distorted).

Try a ~10K "current limiting" resistor in series with the Arduino's analog input.

...The Atmega chip has small (Low current) internal protection diodes the conduct when an input goes negative (by more than about 0.5V) or above Vcc (by about 0.5V). These are mainly to provide some protection against static discharge. The diode on the ground side "shorts out" the negative half of the audio signal. The series resistor limits the current so the signal on the other side of the resistor is not damaged.

It's also a good idea to add a resistor to ground (10K or greater) on the a "audio-side" of the current-limiting resistor. Some audio devices don't provide a DC current path to ground and without it, the ADC input can float-up.

Try a ~10K "current limiting" resistor in series with the Arduino's analog input.

And presto! Works like a charm. Was looking for much deeper issues where USB power differed from Arduino power delivery, and/or ground loops with different frequencies and such :slight_smile:

Could you validate my noob understanding of what's happening now? AFAICT, with this change, almost all current is now flowing to my speakers, only a little bit is now flowing to my Arduino. Which is enough for the analog input to read the same voltage, but not so much that it is stealing half the actual sound signal going to my speakers/headphones.

Final question: you suggested "add a resistor to ground (10K or greater) on the a "audio-side" of the current-limiting resistor". I don't understand what you mean by "the audio side". I now have:

jack-tip --1--> breadboard --2--> 10kΩ --3--> arduino A0 (for left audio)
jack-ring --4--> breadboard --5--> 10kΩ --6--> arduino A1 (for right audio)
jack-sleeve --7--> arduino GND

Where do you suggest injecting resistor(s) to arduino GND, and do I still want to do that if current results are pretty awesome already?

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