(09-18-2016, 12:39 PM)kresty Wrote: Hmm, I wonder - if you only used one channel instead of both, then you could ditch the resistor to the analog input, or maybe make it smaller - then you'd have a broader range?
I didn't understand your question at first (I wasn't sure what you meant by "if you only used one channel" since I AM only using one left/right audio channel). But that confusion got me to looking at things in more detail rather than merely describing what I was currently using.
It turns out that, yes, I have been doing something really stupid.
I assembled this circuit out of a few different circuits I'd found. I stuck it into Artie's wiring plan, but due to the way Fritzing represented the original sound board, I didn't actually put in the entire circuit (the "ground" connections for the audio were omitted, or rather non-obvious, and the labeling didn't specify what connected to the inputs). Since I had no way to test this setup at that point, I then ignored the circuit for awhile and worked on other things. I also changed sound board plans. I subsequently lost track of the original circuits I'd found and their sources, leaving me to work only from what I'd put into Artie's wiring diagrams.
As I had little time to spare by the time I got around to building it, I just fiddled around until I got something that more or less worked, and didn't think very deeply about what was going on (especially with the resistors in the input section).
Now that I'm looking in more detail, I can see that the input side of the circuit is just another voltage divider structure. What it does depends on what you connect to it. It was
supposed to be connected as a stereo-to-mono converter. I don't have it wired that way, and couldn't easily sort that problem out from the (incomplete) schematic that I was using. Here's a better one:
Instead of averaging between the left and right channels as the above version does (which mixes them to mono), I've wired the input side as a straight up voltage divider, literally halving whatever voltage comes in from the ONE audio channel I have hooked up.
The circuit
will actually work that way, but it obviously reduces the range of voltages available for the Arduino to interpret, thus reducing the granularity of the lights and making the signal to noise ratio even worse than it already was. That explains why debugging wasn't showing the range of values I'd expected to see.
I'll work on revising the wiki article. Thanks for pointing it out in a way that forced me to actually think about it.
Edit: As far as adjusting the values of R1 and R2 goes, as long as they are equal (including if both are removed) then the capacitor will always see a voltage halfway between the inputs. It you change their
relative values or eliminate
one of them (but keep the input itself), that will weight the value that the capacitor sees more toward one input's value or the other. In no event will changing those resistors
increase the voltage range from what the audio source supplies. After all, it's a voltage divider setup, not a voltage multiplier. If I wire the inputs properly, I'll get a broader range than what I have now. But still no broader than ± 1 volt or ±0.2 volts, depending on the signal being supplied. I need to add an
amplifier to the circuit if I want to alter that.
I suspect that the exact values for R1 and R2 relate to the desired impedance of the circuit. If the impedance is lower than the audio source was designed to handle, then my understanding is that the audio source will essentially be shorting out, which could damage it. I didn't calculate those values and don't understand impedance well enough to do so, or even decide which values are good and which are not. So I'm loathe to alter them.