phase reversal: can an LM393 do this?

I was tinkering with a circuit that I put together about a year ago. It listens to the tick tock of a clock using an 8 ohm transistor radio type speaker as a microphone. This circuit uses a single 5V supply. I have an LM741 with the + input biased at half of Vcc (2.5V... yeah I know already it's a sucky op-amp for that, but it's what I had on hand). The speaker is connected to both inputs differentially thru 3.3uF caps. Gain is set to 1000 using a 100K feedback and 100R input resistor on the - input. The output is fed thru a 47K resistor to an LM393 comparator's + input. The minus input is biased to about 1/2 Vcc but just a wee bit smaller than the value coming from the 741 so that its output idles high when no sound is being heard. The comparators output is positively fed back thru a .33uF cap and series 100K resistor. This makes the comparators output snap low and stay there for about 120mS after the sharp attack of the tick (or tock as appropriate) decays below the idle offset voltage between the comparators inputs. This all works well and fine, but.

Looking at the scope, with loud ticks, a mS or three after the output of the comparator snaps low, it instantly snaps high for a few mS and then back low again. The PIC chip trying to measure the spacing between ticks and tocks, doesn't like this. It seems that this happens when the output of the 741 exceeds a certain point. Apparently the 393 doesn't like its inputs coming too close to Vcc? Does this sound likely? The reason I suspect this is that I was able to cure the problem by placing some cool blue LEDs on the output of the 741 (before the 47K resistor). One LED between the output and Vcc, and one between the output and ground. The LEDs have a typical Vf of 3.3V, but both light dimly with the 2.5V applied. When the ticks (or tocks) occur, the LEDs flash brightly while keeping the output of the 741 between ~1.8V and ~3.3V above ground. No more funny "phase reversals" on the output of the 393 after that. The 393 didn't seem to care how near the voltage went to ground.

Sorry so long, but I want to be clear. :-)

Reply to
Anthony Fremont
Loading thread data ...

Incidentially, you didn't mention a pull-up for the LM393. It has an open-collector output, not a driven output as most op-amps have, so you need to source current for it to make any signal. It might be using the feedback resistor as a supply resistor, giving even whackier behavior.

Anyway, you can't use an LM393, or 311, or 339 for that. A friend of mine supposedly actually managed to stabilize one linearly, but all my efforts have resulted in a relaxtion oscillator around 3MHz, no matter how much capacitance I put on any pins.

The internal circuit is essentially identical to any other op-amp, although most have more output bits, current sourcing and current limiting for instance. The fundamental difference is the lack of exactly one capacitor, that slows down the amplifier at high frequencies. Without compensation, you get an amplifier that responds "too fast", overshooting where it wants to be, so it compensates by undershooting -- again, too far, too fast. The result is it "hunts" around the average level, but will never stabilize at it.

You should get some NE5532's or something.. 741 is out of production anyway(!).

Tim

-- Deep Fryer: a very philosophical monk. Website:

formatting link

Reply to
Tim Williams

the short answer is YES it can do this. the input common mode range runs from the negative supply rail (usually 0V) to within 1.5V of the +ve supply rail.

you will see a similar thing happen if you yank the input too far below 0V.

Cheers Terry

Reply to
Terry Given

you need

feedback

Yep, I know it's open collector. I forgot to mention that I have a 2K pull-up on the 393's output.

mine

efforts

much

No oscillation problem that I can tell, but I'm not going for anything linear AIUI. I'm using the comparator to square up the output of the

741 for driving the RB0 interrupt on a PIC. Letting it idle high and then snapping low at the start of a tick. The R/C thingy gives a nice effect of holding the output low long enough for the tick to die down, giving me one high to low output transition per tick. The R/C holds it low for about 120mS.

although

capacitor,

compensation,

wants

The

stabilize at

I only want +5 or gnd from the 393, nothing in between.

I think I'm gonna get some MCP6022 op-amps to use instead of the 741. Any suggestions on a different comparator that doesn't mind the inputs going to the rails?

Reply to
Anthony Fremont

runs

Ok thanks, good to know. That really blows. :-( What's a cheap comparator that doesn't act like that?

below 0V.

I won't be doing that here. Well, at least I haven't yet. ;-)

Reply to
Anthony Fremont

dunno, but now you know what to look for - Vicm

your fix is OK though, it slices enough off the opamp voltage that it doesnt annoy the comparator

Cheers Terry

Reply to
Terry Given

Really ! That's a very big cap to use in that application.

Graham

Reply to
Pooh Bear

I don't recall who recommended this setup to me, but I did play around with the values until I liked the way it looked on the scope. It seems to give me about 120mS of "snap time" hysteresis where the comparator output stays low. It seems to work very well now, is there a better/easier way?

Reply to
Anthony Fremont

What do you mean by 'snap time hysteresis' ?

AC coupled hysteresis like this is normally used only to avoid oscillations on the output when the input has a slow slew rate.

Oh - btw. The series R on the input is kinda unwise. I recently noticed with an LM339 that the input current changes when the comparator switches ( obvious when you think about it ) so there can be an effective shift in threshold as it switches. Drive the inputs from low-Z !

Graham

Reply to
Pooh Bear

For lack of the correct term. Because the tick sound is actually a bunch of cycles, I needed something to keep the comparator output from following every cycle of each tick sound. I only wanted it to go low on the first cycle and stay that way until the sound pulse died down. The cap and resistor give me exactly that. They seem to keep the output low for about 100-120mS and then (presumably) force it to remain high for the same amount of time before the next tock pulse can trigger it again.

oscillations

I'm just trying to create an envelope surrounding the entire length of the pulse. I suppose that a diode into a cap with a resistor to bleed it down slowly would have given me something similar to work with.

noticed

switches (

in

Hmm....I don't recall how I picked the resistor value, but I did want the DC level to be present into the comparator. I do know that I was intrigued by the slight but noticeable voltage drop across the resistor. I'll try a smaller resistance to see if anything different happens. ;-)

Reply to
Anthony Fremont

You could use an MMV like the 4538 instead of the LM393 setup. That way you have easier control over the length of the output pulse. You'll have to adjust the output of the 741 a bit to make it work (Vlo=1.35V Vhi=3.15V (@5V, TI datasheet)).

--DF

Reply to
Deefoo

Well- you're not all that clear, leaving the reader to guess at more than few of the interconnections. And you can skip the ":-)" ploy used by the NG hucksters, con artists, trolls, and posers. No one will be asking you to give a presentation any time soon. The LM393 comparators do not phase invert when a single input goes above the Vcc rail- even as high as 36V- as long as the other input remains within the CMR range, which is -0.3V to Vcc-2V worst case. So you have something else going on- probably noise and errant feedback issues. Lastly, there is no need for a 120ms one shot drive of the PIC input. All you need is maybe a few

10's of microseconds and use the PIC to lock out responding for the 120ms. Your analog timing slew rates will then be 10,000x faster which vastly simplifies the comparator monostable layout and design. And there's no need for a 741 either, when at most a single 2N3904 CE is all that's required.
Reply to
Fred Bloggs

"Fred Bloggs"

If you are confused, then please ask for clarification.

:-/ Hmmhp Giving your "bedside manner", I'm guessing that many don't ask you for much of anything.

as

need

Well one thing is for sure, clipping the output of the 741 solved the problem. Perhaps, given that, you can further elaborate on what you think the problem might really be.

few

My slew rate is nowhere near as bad as you seem to think. It certainly isn't significant in the grand scheme of things here. As a former boss used to remind me; when it comes to the details of the code, it's my pencil.

all

Speaking of leaving someone to guess at connections. And I can get a voltage gain of 1000 this way?

Reply to
Anthony Fremont

way you

to

Vhi=3.15V

Thanks for the tip, it looks like a good way to go. I may pick a couple up and tinker around with them.

Reply to
Anthony Fremont

As a rough aproximation you can get a gain of 20*vcc for a simple CE bjt stage, wich is 100 for 5v.

I think the idea here was that you just supplied a raw signal into the pic and cleaned it up in software and did away with the comparator wich is acting like a retrigerable monostable. ie. looking for periods of PIC input activity interspersed with periods of quiteness rather than single transitions.

I found it easy follow your description btw.

If you want an op amp or comparator to be able to handle inputs upto the + rail you need to look for rail to rail input devices (RRI), but usualy its easy to limit the input to less than +ve.

Colin =^.^=

Reply to
colin

You never did explain the details of the '393 (-) input circuit. And you never did explain the full details of the 741 circuit with the coupling capacitors.

Which is fine, I am self-supervised and will not be distracted by lusers who can't keep up.

The diodes are doing two things: lowering the impedance of the 741 output node, and increasing the peak negative excursion on '393 IN(+). Without the diode, the capacitor is charges to roughly 1V and with the diode it charges to 5-3.3=1.7V which produces an additional

0.7*47/147=200mV positive feedback on the negative excursion.

Oh yes it is- coming out the timing cycle you are roughly 20V/us versus

200,000uV/us with a 12us timeout.

Yes- a Miller capacitance of 10p at a gain of 1000 makes for 10n input shunt which at 8 ohm drive means 1/(2pi*8*10n)=2MHz BW- your tick and tock can be supported at gains much higher than x1000. You would want to integrate the CE into the '393 biasing for economy.

Reply to
Fred Bloggs

bjt

I originally used an op-amp because, at the time, I was tinkering with op-amps specifically. At any rate, it still sounds like one transistor isn't really going to be enough gain.

pic

periods of

I understand, but in my original tinkerings I was looking for a hardware solution to clean up the pulse. I'm still glad that I've seen how to do this, whether it's the best way or not. I've been writing software for more than 25 years, and I'd like to learn to solve a few problems by using hardware only. :-)

Thanks. In retrospect, I suppose that if I wanted to be more clear I could have used more words. I was only trying to include a reasonable amount of detail with the least amount of verbiage.

the +

its

I'm looking at tinkering with the Microchip MCP6022 when they arrive. Seems like a cheap and decent enough op-amp for a 5V supply. I really hadn't considered that the 393 wouldn't like its inputs brought all the way to Vcc, until I saw it in the datasheet. Fred wasn't very descriptive as to how he knows that the 393 won't invert when driving the inputs too close to Vcc, and I can't find anything in the datasheet or internet on it. I would just like to know why limiting the input to the 393 fixes the problem.

I'm really not trying to design for mass production, this is all just for my own education.

Reply to
Anthony Fremont

That assumes bias at Vcc/2- comment is not applicable.

Possible if the PIC input is Schmitt triggered, otherwise no good.

The '393 will handle RRI, you just have to pay attention to where the other input is.

Reply to
Fred Bloggs

You keep saying "inputs"- I told you INPUT- singular; and the datasheet does tell you all about it. Only a negative input causes phase inversion with that part.

Reply to
Fred Bloggs

used

you

coupling

The - input of the 393 is biased at 1/2 Vcc, but just a wee bit less than the idle output of the 741 so that the 393s output idles high when no sound is present. Just like I said in my post.

As for the speaker to 741 coupling caps, I was playing around with different ways of connecting that up. The current incarnation has 4.7uF caps in both speaker leads. One cap connects to the voltage divider (+ input) of the 741. The other cap connects to a 100R series resistor. The loose end of this resistor connects to the - input of the 741. There is a 100K feedback resistor from the 741 output to its - input. AIUI, this sets the voltage gain to 1000. Back when I first put this together I tried various methods of connecting the speaker to the op-amp inputs. This seemed to give me the most gain with the best noise rejection.

comparators

don't

lusers

To bad we can't all be a genius, huh Fred?

even

range,

going

the

I understand about lowering the load impedance for the 741, but I don't understand how that leads to higher voltages coming from the comparator. Where do the 47 and 147 come from in your math?

which

certainly

boss

versus

We're talking about timing an event that varies by mS per tick, I don't think it's a problem.

a

input

to

Thanks for all the circuit detail. :-?

Reply to
Anthony Fremont

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.