How does this circuit work?

Audioguru

Joined Dec 20, 2007
11,248
An audio amplifier opamp is designed for low noise but an LM358 is designed for low idle current which produces a lot of noise and crossover distortion. An opamp cannot drive a speaker, yours was severely overloaded and maybe the noise was overload distortion. You need a power amplifier to drive a speaker with plenty of current.

Since your comparator input is biased at 0V instead of at half the supply voltage then its output will be far from being symmetrical and it might not work. See post #4.
 

Thread Starter

line_code

Joined Aug 8, 2018
24
An audio amplifier opamp is designed for low noise but an LM358 is designed for low idle current which produces a lot of noise and crossover distortion. An opamp cannot drive a speaker, yours was severely overloaded and maybe the noise was overload distortion. You need a power amplifier to drive a speaker with plenty of current.

Since your comparator input is biased at 0V instead of at half the supply voltage then its output will be far from being symmetrical and it might not work. See post #4.
I wasn't directly driving the speaker. Its actually an iPod dock with audio input jacks which I'm pretty sure has its own amplification circuitry.

Should I use a voltage divider like post #4 said or no like #5 said? Since I don't know much about analog circuity, as I've mentioned, I have no clue who is right and why.
 

Audioguru

Joined Dec 20, 2007
11,248
If you used a positive and negative power supply for the comparator opamp then its input biased at 0V is at half the supply voltage like the voltage divider in post #4.
 

sghioto

Joined Dec 31, 2017
8,634
The comparator circuit only requires 50 mv to reliably operate. How and where are you taking this VCL audio from the laptop to the preamp or comparator?
SG
 

ebp

Joined Feb 8, 2018
2,332
It might perform better if a second diode were added in inverse parallel with D1. As it is, the clipping of the AC-coupled input signal is very asymmetric, if it occurs at all - negative going is clipped at about -0.7 V but the positive will not be clipped unless it is in excess of 32 volts, which should not be allowed (the LM324/358 has an somewhat unusual input structure that employs lateral PNP transistors with exceptionally high base-emitter breakdown voltage which also means it has no diodes between the inverting and non-inverting inputs which makes it better suited for use as a comparator than many other op amps). With low input signal level, there probably is no clipping.

I assume Vcc is 5 volts. The amount of hysteresis is small - about 40 mV (it would be about 60 mV if the output could swing to Vcc, but it can't. At risk of making it too sensitive, the hysteresis can be reduced by increasing R6 (somewhat preferable to reducing R3 in terms of input offset error due to bias current).
 

Thread Starter

line_code

Joined Aug 8, 2018
24
The comparator circuit only requires 50 mv to reliably operate. How and where are you taking this VCL audio from the laptop to the preamp or comparator?
SG
It's going straight from my computer's speaker plug, through a 3.5mm to RCA adapter, through an RCA cable, right into the comparator or preamp, and out to the rest of the circuit. Nothing weird going on there as far as I can tell.


It might perform better if a second diode were added in inverse parallel with D1. As it is, the clipping of the AC-coupled input signal is very asymmetric, if it occurs at all - negative going is clipped at about -0.7 V but the positive will not be clipped unless it is in excess of 32 volts, which should not be allowed (the LM324/358 has an somewhat unusual input structure that employs lateral PNP transistors with exceptionally high base-emitter breakdown voltage which also means it has no diodes between the inverting and non-inverting inputs which makes it better suited for use as a comparator than many other op amps). With low input signal level, there probably is no clipping.

I assume Vcc is 5 volts. The amount of hysteresis is small - about 40 mV (it would be about 60 mV if the output could swing to Vcc, but it can't. At risk of making it too sensitive, the hysteresis can be reduced by increasing R6 (somewhat preferable to reducing R3 in terms of input offset error due to bias current).
Interesting information you provided, and yes VCC is 5V. So, you think I should try adding another 1N4149 in parallel with the one in the circuit, but with reverse polarity and also increase the value of R6? How much should I increase it?
 

Thread Starter

line_code

Joined Aug 8, 2018
24
Do you have the "speaker" level from the computer turned all the way up?
The comparator circuit is fine that's not where the problem lies.
SG
I don't have access to that computer at the moment to check, but I'm pretty sure it is. I'll check tomorrow.

Do you think uploading a sample of the signals would help solve the problem? If yes, I'll generate some fresh signals so we can see what the ideal waveform would look like.
 

sghioto

Joined Dec 31, 2017
8,634
Do you think uploading a sample of the signals would help solve the problem? If yes, I'll generate some fresh signals so we can see what the ideal waveform would look like
Couldn't hurt. Which begs the question "how are you generating these signals"? While I'm at it just how in % does the VCL volume go and do you have a link to the original circuit?
SG
 

Thread Starter

line_code

Joined Aug 8, 2018
24
Couldn't hurt. Which begs the question "how are you generating these signals"? While I'm at it just how in % does the VCL volume go and do you have a link to the original circuit?
SG
There's a program out there designed to generate the signals, though I can't get into too much detail because the manufacturer of the animatronic controllers is still in business and I may be getting into proprietary information.

I'm not sure what you mean by "just how in % does the VCL volume go". If you are asking about the range of percentages, it can go from 0% (muted) to 200% which is, I guess, twice the volume of the file. When you adjust the volume using the scroll wheel of the mouse, it increments by 5's, but you can also move the slider manually to get even more ranges of volumes. By the way, there's no particular reason I'm using VLC. Its just my media player of choice.

The circuit I posted is the original circuit, but with the rest of it removed due to it possibly being proprietary. I found it in an old manual for the controllers.

I also uploaded a sample of the signals. They don't really do anything but cycle some of the bits on and off, which makes me think that this isn't really a type of time code at all, but I guess that's an irrelevant issue I'll have to tinker with on my own.
 

Attachments

sghioto

Joined Dec 31, 2017
8,634
Well it's a clean looking signal with a constant output of 1 volt peak to peak which is equal to about 350mv with the output from WMP and the computer at 100%.
SG
 

sghioto

Joined Dec 31, 2017
8,634
OK, I took your sound bite from the output of my computer and connected it to the comparator -no preamp. Minimum signal level require using the speaker volume control was 50% which measure at 50 mv, exactly what I said the comparator required. Using the preamp the minimum level was 7% of the speaker volume or about 3 mv.
Remember the output was 350 mv at 100%. Volume levels in analog or audio are generally not linear but logarithmic.
All I can say from this end is that both circuits are operating at specs. If you require 40% with the preamp from the VCL then the output from your computer is below 350mv.
SG
 
Last edited:

Thread Starter

line_code

Joined Aug 8, 2018
24
OK, I took your sound byte from the output of my computer and connected it to the comparator -no preamp. Minimum signal level require using the speaker volume control was 50% which measure at 50 mv, exactly what I said the comparator required. Using the preamp the minimum level was 7% of the speaker volume or about 3 mv.
Remember the output was 350 mv at 100%. Volume levels in analog or audio are generally not linear but logarithmic.
All I can say from this end is that both circuits are operating at specs. If you require 40% with the preamp from the VCL then the output from your computer is below 350mv.
SG
The signal I uploaded was generated with software, so its pretty much flawless with equal volume the whole time. I just generated that file so I haven't personally tested it yet. There's lots of other waveforms I've encountered which all need to be usable; I've attached samples of two of them. One looks like it was put through a squaring type circuit, perhaps even the one I've uploaded, and then recaptured. The other one came off reel to reel tape and seems to be decent, but the relative volume seems to be lower, plus there's some points where the volume randomly falls due to tape degradation, I guess. This is where the low volume compatibility really would be handy. When you get low volume spots in older tapes like this, the controller doesn't know what to do since the squaring circuit isn't passing it a readable waveform, so it just clears everything until it receives a signal its happy with again. The dropouts can really degrade the quality of the animatronic's performances because you have at minimum like 30 milliseconds of all the movements resetting until valid data is found again. Its sort of aggravating to have dropouts resulting from the circuit just not being able to detect low volume signals that are otherwise perfectly acceptable (even though this circuit should apparently be able to detect these low volume signals, especially with the preamp).

I really don't know what to do at this point other than find a multimeter that can measure AC millivolts to determine why the circuit is failing to work when it seems like it should work just fine. If I uploaded an audio sample of the waveform I'm getting when the volume is too low, would that help?
 

Attachments

sghioto

Joined Dec 31, 2017
8,634
I really don't know what to do at this point other than find a multimeter that can measure AC millivolts to determine why the circuit is failing to work when it seems like it should work just fine.
It's all about the signal level. An oscilloscope would be a better option, then you can actually see the waveform. There's not much you can do about dropouts. Trying to get this system to work at 5% volume is probably not practical if not impossible. You can increase the gain of the preamp by increasing the value of the 22K resistor, that might help. Good Luck.
SG
 

Thread Starter

line_code

Joined Aug 8, 2018
24
It's all about the signal level. An oscilloscope would be a better option, then you can actually see the waveform. There's not much you can do about dropouts. Trying to get this system to work at 5% volume is probably not practical if not impossible. You can increase the gain of the preamp by increasing the value of the 22K resistor, that might help. Good Luck.
SG
I've considered buying an oscilloscope a few times before but all the ones I saw seemed to be a bit too expensive. Maybe its time to re-look into it.

Today, I decided to try something a little different to see if it would make a difference. Instead of adjusting VLC's volume, I decided to try adjusting my PC's system volume. With VLC’s volume set to 125%, I was able to get the circuit to work as low as 3-5% system volume without the preamp. I wonder if VLC adjusts the volume in some abnormal manner (is that even possible?). Maybe I need to switch to WMP or Winamp or something else.
 

Thread Starter

line_code

Joined Aug 8, 2018
24
Maybe, that's what I was using. I always suspected that the PC volume was too low. Besides the speaker volume there are usually other level controls in the sound properties. So are you satisfied with the operation?
SG
My PC's volume was up all the way the whole time. This last test was the first time the PC's volume was less than 100%. For some reason, adjusting VLC's volume to around 40% while leaving the PC volume at 100% doesn't work, but putting VLC's volume at 125% and adjusting the PC's volume to 5% does work. Super weird to me.

I suppose I am satisfied with this circuit, though I wish I could get a new, better, "smarter" circuit that could really amplify the tiniest of signals (within the realm of possibility) while filtering out the unwanted frequencies/noise.
 

sghioto

Joined Dec 31, 2017
8,634
putting VLC's volume at 125% and adjusting the PC's volume to 5% does work.
That's when it's nice to have a scope to see exactly what the levels are.
I wish I could get a new, better, "smarter" circuit
I suppose it's possible, an amp with a band pass filter followed by a compander. Or just the compander circuit.
I would love to help with this but I'm currently out in the "boonies" of Colorado and do not have access to my electronics workshop.
SG
 
Top