LED Current Indicator for Speaker Wire

dl324

Joined Mar 30, 2015
18,326
Yes, I just tried it at max volume, and the LED still fluttered. That also fried my LM393 -- oops, good thing I got spares!
The inverting input needs some overvoltage protection.
what should my shopping list be, you reckon?
Some caps in the 22-100pF range.
Also, I considered hysteresis, but knew it wouldn't work with my old prototype due to the bias voltage. My research indicated that you accomplish hysteresis by connecting the LM393 output to the non-inverting input and the 5V supply with resistors (Schmitt Trigger). You're saying I can accomplish the same thing with just a cap between the inverting and non-inverting pins?
I've used it on a slope detector.
 

Thread Starter

ljmccon

Joined Nov 27, 2015
35
Sounds like I'll also need to add parts for the overvoltage protection to the list. Would that be a zener diode from the inverting input down to ground? If so, I guess I need to find one rated at 30V. What wattage should I shoot for? Any need for a fuse?
 

AnalogKid

Joined Aug 1, 2013
12,129
what range of capacitance should I buy? (And what voltage rating?)
Anything will be better than what you have now. Somewhere between 100 uF and 470 uF, 10 V or above. My guess is that with 220 uF the LED will be out in less than 0.5 sec after the music stops. So a small package of 100 uF caps should give you a range.

ak
 

Thread Starter

ljmccon

Joined Nov 27, 2015
35
This new circuit is really starting to bug me. Hooking the speaker wire leads directly to the comparator just isn't working. With the speakers on, the LED flutters (as we discussed and which I will try to fix with caps). But when I turn the speakers off, the LED will either:
  1. Come on solid at full brightness -- until I turn the speakers back on, and it begins to flutter.
  2. Turn off as it should, but then slowly come back on within 10 seconds, returning to full brightness. Turning the speakers back on causes it to flutter, again.
How could the speakers being OFF cause the LED to light? In other words, how is the comparator seeing a greater voltage in the inverting input when there's no signal there at all?

Also, if anyone could enlighten me on how to create overvoltage protection for my circuit, I would really appreciate it. If it's just a zener diode to ground, that's easy enough. But my reading indicates that that would only work well at very low power/current (i.e., less than a few mA). I imagine this is a very low current situation, although I could use an education on that, too. With this circuit in parallel with one of my speakers, what percentage of the current/power is going to the comparator input?
 

wayneh

Joined Sep 9, 2010
18,104
The Pioneer has an auto-power-down on each zone. Does that not solve the problem? I also wonder if you could use the 12v "control" signal. My Yamaha AVR has that but it's poorly documented. Maybe the Pioneer docs are better.

Just looking for alternative ideas. I can't see how any circuit you build can differentiate between "off" and "on with no signal".
 

dl324

Joined Mar 30, 2015
18,326
How could the speakers being OFF cause the LED to light? In other words, how is the comparator seeing a greater voltage in the inverting input when there's no signal there at all?
Is there any possibility of using an oscilloscope to look at the signals? It could be that the speaker wires are picking up enough signal to trigger the comparator, or it could be oscillating.

One option might be to raise the reference voltage, but I have no idea how much without knowing what the inverting input looks like.
Also, if anyone could enlighten me on how to create overvoltage protection for my circuit, I would really appreciate it. If it's just a zener diode to ground, that's easy enough.
That could be tricky. Without AC coupling the speaker to the comparator, any input protection could cause distortion. If the signal is AC coupled, you're back to the offset problem. I'd start with a high value series resistor with a clamp diode from the input to the positive supply.
 

Thread Starter

ljmccon

Joined Nov 27, 2015
35
Okay, more things I've now tried:

Add an electrolytic capacitor from LED+ to GND.
Adding this capacitor had no effect on the LED. In hindsight, this makes sense to me: if the fluttering in the LED is caused by the comparator's output opening and closing due to fluctuations around the reference voltage, adding a capacitor in this way wouldn't help. The comparator's output is the LED circuit's path to ground. When it shuts off, no current -- whether from the power supply or the capacitor -- passes through the LED because there is no path to ground for that split second before the output turns back on.

Comparators can oscillate when the two inputs are at about the same voltage or the input is changing slowly around the reference voltage. The usual way to deal with this is to add some hysteresis. That be as simple as putting a small cap between the inverting and non-inverting inputs.
This also had no effect on the LED fluttering.

Is there any possibility of using an oscilloscope to look at the signals? It could be that the speaker wires are picking up enough signal to trigger the comparator, or it could be oscillating.
Unfortunately, I don't have access to an oscilloscope. It's strange, though, that errant signal transfer when the speakers are off would create enough of a voltage differential across the comparator that it would allow the LED to light solidly at full brightness...but turning the speakers on (i.e., actually putting some real voltage in the line, albeit fluctuating) causes the LED to dim and flutter regardless of volume. This doesn't make sense to me.

Returning to my original circuit design will solve this particular problem; and it sounds like it will also help me to protect my circuit from overvoltage, since that design already had the speaker input AC decoupled. So, maybe that's the best way to go.

But that takes us back to the beginning: any other ideas on how to get this LED to stop fluttering when my speakers come on? (FYI, the major difference between the two circuits I have tried with respect to LED fluttering is this: my original design was very dependent on volume -- the lower the volume, the more flutter in the LED. Wayne's design fluttered pretty much the same at any volume.)


The Pioneer has an auto-power-down on each zone ... I can't see how any circuit you build can differentiate between "off" and "on with no signal".
wayneh: I'm not sure you understand the problem I'm trying to solve. I want the circuit to tell me if there is any noise coming from my outdoor speakers. I want an LED to light up if there is any voltage/current going to the outdoor speakers. So, I'm not trying to differentiate between "off" and "on with no signal" -- I'm trying to differentiate between "off" and "on with a signal." That said, I would be even more pleased with a circuit that could simply differentiate between "off" and "on," full stop.
 

AnalogKid

Joined Aug 1, 2013
12,129
Adding this capacitor had no effect on the LED. In hindsight, this makes sense to me: if the fluttering in the LED is caused by the comparator's output opening and closing due to fluctuations around the reference voltage, adding a capacitor in this way wouldn't help. The comparator's output is the LED circuit's path to ground. When it shuts off, no current -- whether from the power supply or the capacitor -- passes through the LED because there is no path to ground for that split second before the output turns back on.
Yes, there is. When the comparator is "on", its output is basically a shorted path to GND. This provides a path for the LED current and shorts out the added cap. When it is off, its ope collector output is - open. You are correct that there is no current path through the comparator. But the LED current limiting resistor charges up the capacitor through the LED. The LED brightness should decrease exponentially until the cap is charged up to around 3 V. At that point the voltage across the LED is less than the diode's forward voltage and it goes out. If the flickering is because there is a clipped-audio square wave at the comparator output, the cap will filter that by turning it into a low amplitude sawtooth wave, ripple at the audio frequency. This sawtooth wave can be less than 0.5 V with the correct cap size, and that residual flickering is much less noticeable.

ak
 

wayneh

Joined Sep 9, 2010
18,104
Oh, okay. I got confused by #19.

One concern I have is that we seem to be assuming that speaker ground is the same as power supply ground for the comparator. Are we sure this is true? Where is the 5V for the comparator coming from? You need a bypass capacitor (0.1µF ceramic is typical) across the power pins and you should also stabilize the unused comparators in the package.

I agree with the suggestion in #12. The reference voltage of ~2.5V in #11 could allow a fair amount of signal before the comparator would switch. You want to detect the smallest thing possible without false triggering, so you want to use ground for the reference. I believe you should also add a diode in series to protect the input from a negative speaker signal. Maybe I'm wrong, but doesn't the AC signal going to the speaker go positive and negative relative to "ground"?

You could put a 5V zener onto the inverting input of the LM393 to limit the voltage there, but you need a current limiter to limit the maximum current through the zener. The far left trim pot in #11 would provide this function, but it's dangerous to rely on the pot since it could get set to zero ohms. Murphy's law demands that this WILL happen eventually. Put a resistor in series to protect the zener no matter where the pot gets set.
 

Thread Starter

ljmccon

Joined Nov 27, 2015
35
Yes, there is. When the comparator is "on"...
Aha, that makes perfect sense! Thank you for the education. I was under the impression that the capacitor charged even when it was shorted...then would discharge through the LED when the comparator output shut off, attenuating the fluttering. For that reason, I added the cap between the LED and the resistor. It did nothing of course, and I realized that wouldn't work without a path to ground. But what you're telling me is that the cap remains uncharged when shorted, then charges when the comparator output shuts off...so the cap should be between the LED and the comparator. Yes, that does improve the fluttering markedly. But it still flutters a bit, damn it. Can one just keep adding higher and higher capacitance to fix that, or is there a point at which adding more does nothing? (I ask because I couldn't see a difference between 470 µF and 770 µF, for example.)

You need a bypass capacitor (0.1µF ceramic is typical) across the power pins and you should also stabilize the unused comparators in the package.
I presume by "power pins" you mean the V+ and GND pins in the corners of the chip. I tried this, but noticed no difference. How would one stabilize the unused comparator?


One concern I have is that we seem to be assuming that speaker ground is the same as power supply ground for the comparator. Are we sure this is true? Where is the 5V for the comparator coming from?
The 5V is coming from a cell phone charger -- standard 5V, 200mA wall-wart transformer.

I agree with the suggestion in #12.
Agreed that it's ideal to have 0V as the reference voltage. But the circuit in #11 isn't working for me -- not just because of the fluttering, but more pressingly for the reasons mentioned in #24. In short, using that circuit as drawn, the only time the LED is fully on (totally steady and at full brightness) is when the speakers are OFF.
 

AnalogKid

Joined Aug 1, 2013
12,129
Aha, that makes perfect sense! Thank you for the education. I was under the impression that the capacitor charged even when it was shorted...then would discharge through the LED when the comparator output shut off, attenuating the fluttering. For that reason, I added the cap between the LED and the resistor. It did nothing of course, and I realized that wouldn't work without a path to ground. But what you're telling me is that the cap remains uncharged when shorted, then charges when the comparator output shuts off...so the cap should be between the LED and the comparator.
No. Read post #18 again. The cap goes between the LED cathode (LED-) and GND. It is discharged by the comparator when the LED is on, and its charging up provides a path for LED current when the comparator is off. That works only if the cap is in parallel with the comparator output.

What you are building is called a missing pulse detector, but since your input is not a pulse stream already at a constant amplitude you are trying to get one comparator to do two things, both amplitude and frequency detection. The "right" way is to use the 2nd half of the LM393 to detect the voltage level on the cap with some added hysteresis, and have its output drive the LED. In this way the LED will have a constant current when it is on. This is a net increase of exactly 1 resistor (R7) over your current circuit. Schematic is attached. I added two resistors to your input threshold adjustment to make it easier to set the trip point, plus 1 cap to the reference divider so there is no interaction between the two comparators. If the tunn-off delay is too long, decrease C3.

Note that the schematic uses parts in my design library. There is no need to 1% resistors or 50 V capacitors.

ak
Audio-LED-1-c.gif
 

Attachments

Last edited:

AnalogKid

Joined Aug 1, 2013
12,129
Agreed that it's ideal to have 0V as the reference voltage. But the circuit in #11 isn't working for me -- not just because of the fluttering, but more pressingly for the reasons mentioned in #24. In short, using that circuit as drawn, the only time the LED is fully on (totally steady and at full brightness) is when the speakers are OFF.
That sounds like the trip point adjustment is on the wrong side of the reference voltage (Vcc/2).

ak
 

wayneh

Joined Sep 9, 2010
18,104
The 5V is coming from a cell phone charger -- standard 5V, 200mA wall-wart transformer.
OK, and you connected the charger ground to speaker ground? Sorry if this seems like a stupid question, but it matters a lot.

I found an opinion from TI about how to immobilize unused comparator inputs. This partly explains why there are so many opinions on the topic. Seems there is not a single solid recommendation.
 
Last edited:

Thread Starter

ljmccon

Joined Nov 27, 2015
35
The cap goes between the LED cathode (LED-) and GND.
Yes, that's what I meant and what I did -- when I said, "the cap should be between the LED and the comparator," I meant that the positive leg should go between the LED and the comparator; the negative leg was always going to ground. Sorry for the confusion -- gotta work on my circuit lingo!

What you are building is called a missing pulse detector ... schematic is attached.
AnalogKid, you ROCK! This works great! It's definitely a bit over my head, but I can follow a schematic. This gives me a nice, steady light at extremely low volumes...even lower than the volumes I was testing the previous prototypes on (and that was already pretty low). Just gotta work on dialing in C3: 10µF is pretty good -- the LED is 99% steady, and goes out fast enough to be acceptable. Maybe I'll try 20µF to see if I can get rid of that last, teensy bit of barely noticeable flutter. On the other hand, I tried a 470µF capacitor, and that allows a buffer of 3-4 seconds -- which means the LED doesn't go out between songs. I really like that...but it's a tradeoff. A steady light or a responsive light? I'll have to ponder...and of course, now that you've shown me the way, I can change it whenever I want. Did I mention how much I appreciate this? Thank you!

Okay, now for the final few details:
  • How do I protect my circuit from too much voltage? Should I just run a Zener diode to ground from input #2 on the LM393, like in the picture attached below? Do I also need to put a resistor in the line between the Zener and the speaker +? What ratings should I look for on the Zener? (I bought a 24V/5W, since I understand the LM393 can take up to 35V. But I also have a 5.1V/5W on hand.)
Zener Placement.jpg
  • Since I'm not fully comprehending the ins and outs of this circuit, can you help me understand how much current is flowing through this thing from the receiver? I don't really understand what happens to the current after it flows into input #2 on the comparator. What percentage of current from the receiver is going to the comparator (as opposed to the speaker which is wired in parallel)? Is the resistance inside the comparator really high? I'm just trying to understand how this circuit affects sound quality if it's in parallel with an 8-ohm speaker. Is having this hooked up to my speaker technically bad for sound quality (due to the circuit robbing current from the speaker)?
  • What adjustments would I have to make to the circuit if I wanted to power 6 LEDs in parallel? I imagine I'd have to size up on C3? Anything else?
  • And now the greedy question: is there any way you can think of to keep the LED lit during brief periods of silence (like between songs) but have it immediately go out when the speakers are turned off? (It may be a silly question, so I'll accept a silly answer. ;))

you connected the charger ground to speaker ground?
Yes, each of the circuit designs I have tried have tied the charger ground and the speaker ground together. But it seems to be working great with AnalogKid's design! Thank you for linking me to that information from TI -- interesting stuff.
 
Last edited:

cmartinez

Joined Jan 17, 2007
8,761
Is having this hooked up to my speaker technically bad for sound quality (due to the circuit robbing current from the speaker)?
The circuit will rob a little bit of current from your amplifier. But think of it this way, your speaker (most probably) has an impedance of 8 ohms, whereas the input impedance of the circuit (which, btw, is decoupled by C1) is enormous compared to that. In all honesty I don't know how to make the proper calculations, but in my estimation this would be like attaching a child's kite to a 747 Jetliner and then try to measure how much slower it's causing it to fly.
 

dl324

Joined Mar 30, 2015
18,326
I breadboarded the single comparator circuit from post #12 and it works as expected. I lowered the input to a few mV and the LED was on constantly; no problems at higher voltages. When I decreased input to 0V, the LED went off.

The only flickering I saw was when I fed in very low frequencies; but I wasn't expecting the music to be composed of only low frequencies.

I drove the comparator input from a signal generator and used a pot to get accurate mV signals. If I applied a negative DC offset, the LED was off when the signal was completely negative.

I didn't even put a decoupling cap on the supply.
 

dl324

Joined Mar 30, 2015
18,326
To satisfy my curiosity, I fiddled with the circuit and think the behavior you saw when you were connecting and disconnecting the B speakers was probably a combination of a floating comparator input and coupling into the speaker wires. This is my solution for that:
upload_2015-12-11_8-33-22.png
R2 will pull down the input when the speaker is disconnected and help with low level signal coupling into the speaker wire. R3 is added so a diode can be used to clamp the inverting input. I tried larger values for R2, but saw slight illumination; the values above shouldn't cause noticeable distortion.

I tried using a zener diode clamp, but it didn't play well with R2 and didn't provide any pull down resistance when it was floating.

The simplest circuit works. You just needed to know how to troubleshoot it.
 

AnalogKid

Joined Aug 1, 2013
12,129
is there any way you can think of to keep the LED lit during brief periods of silence (like between songs) but have it immediately go out when the speakers are turned off?
No. One of the things they teach in high school math is that you cannot solve one equation with two unknowns. This is a version of that. The circuit detects silence. If there is only one cause of silence, it can be tuned for that. But if there are two causes and you want two different responses, a simple go/no-go detector doesn't have mystic vision to see the difference. In fact, neither do you. When listening to an unfamiliar song, if that song goes silent for 2 seconds, is it dramatic art of the end of the song? If you don't know, neither does an LM393.

Yes. There is a way, depending on what "off" means. If off means disconnected from the power amp outputs by a mechanical switch or relay, then a second circuit can look at the speaker connections and determine if they are connected or not, and drive an LED without caring what the audio content or loudness is.

Maybe.

ak
 

wayneh

Joined Sep 9, 2010
18,104
I agree with AK's answer.

But I also think there's a chance that an amp, while on and quiet, still puts enough of a signal on the speaker wires that a comparator might detect it. In my mind it would be directly coupled instead of capacitively coupled, so that it could detect mV DC levels. Maybe I'm all wet, but it seems like it would be difficult for an amp to not put out a few mV. Experimentation would be required to validate this approach.

You've got multiple comparators onboard already. Put another one to work.
 

Thread Starter

ljmccon

Joined Nov 27, 2015
35
this would be like attaching a child's kite to a 747 Jetliner
Ha, I like this analogy. :D That's what I figured since I couldn't hear a difference; but I also know I'm no audiophile, so my ears aren't that attuned. It sounds like impedence through the LM393's inverting input must be pretty high.

the behavior you saw when you were connecting and disconnecting the B speakers was probably a combination of a floating comparator input and coupling into the speaker wires. This is my solution for that...
I'll have to pick up a 1N4148 next time I'm at Fry's to give this a try. Thanks!

No...Yes...Maybe.
Perfectly reasonable answer and in line with what I thought.

So, back to the Audio Detector LED Circuit you hooked me up with:
  1. What did you think of my suggestion for overvoltage protection? Would simply adding a 25V Zener diode between input #2 on the LM393 and ground do the trick? Or do I need an extra resistor in there? (If the impedance through the comparator is already so high, I'm guessing additional current protection for the Zener is not necessary.)
  2. With regard to my previous question about putting several LEDs in parallel: Having taken another look at your schematic, I'm thinking no modification to the circuit will be necessary to accomplish that (since C3 is essentially holding the comparator's output closed for a short period of time, giving all LEDs connected in parallel a path to ground). Correct?
 
Top