Need help with op-amp/comparator circuit

A

Anthony Fremont

Guest
Hello all,

Danny got me thinking about my op-amp stuff, so I resurrected it for
another application/experiment. Now what I'm doing is that I'm trying
to "hear" some tapping type noises (actually an antique clock
tick-tock). What I want to do is to measure the spacing between the
beats. I'm sure to be in violation of someone's patent, but this is for
personal use so on to the show. ;-)

I am currently using the circuit below. The 10K voltage dividers were
empirically picked so that the idle output voltage of the 741 is 2.52V,
the divider on the 393 is at 2.50V leaving a 20mV difference.
Everything works pretty much as expected (i.e. the 393's output rides at
+5V until a loud enough noise causes the comparator output to flip) A
"loud enough noise" is anything that causes the 741's output to shift by
more than about 20mV. What I'm seeing on the scope peaks at about 500mV
on the output of the 741.

The 393 then swings low on the peaks of the tick sound like I want, but
the the comparator's output swings high again between the peaks of the
audio waves (every couple of mS) giving me a stream of pulses. What I
want is for the output to pull low and stay low until the tick sound
decays a bit (interpret this as about 50mS'ish ;o). IOW, I want to low
pass filter the output of the 393. The base pitch of the sound seems to
be around 600Hz or so. The sharp intial attack is all I'm really after,
the main jist of the sound is between 40 and 60mS in length.

I tried putting a 1uF cap to ground on the output of the 393. This
helps, but I still get allot of ripple on the low signal. Bigger caps
do better, but they also lead to real slow rise times even with the
fairly stout pullup (2K). What do I do now? I think I need to add some
RC time constant somewhere, but not sure where.



VCC +5V VCC +5V VCC +5V
+ + +
| | |
| | |
.-. .-. .-.
| |10K | |10K | |
| | ___ 100K | | | |2K
'-' .---|___|----. '-' '-'
| | | | |
| | | | |
10uF 1K | | LM741 | | LM393|\| |
|| ___ | | |\| | o--------|-\ |
|\ __ .--||--|___|---(---o-------|-\ | | | >--o--->OUT
| | |- || | | >-o----(--------|+/
| |__|---------------o-----------|+/ | |/|
|/ | |/| |
.-. .-.
Speaker IN | |10K | |10K
| | | |
'-' '-'
| |
| |
=== ===
GND GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)
 
"John Popelish" <jpopelish@rica.net> wrote in message
news:41E896FE.17B02C96@rica.net...
Anthony Fremont wrote:

Hmm, like this?

Except for the words "speaker in", yes.
If you have signal schottky diodes, they would work with less lost
voltage than silicon junction diodes. I think both caps can be .1uf.
Oops, I just downloaded that program and am still trying to figure it
out. I think it has a couple of "issues". At least with people that
don't know how to use it yet. ;-)

Thanks, I haven't tried your suggestion yet, but it is interesting. Am
I correct in that it still only "captures" half of the signal coming out
of the 741? Or does the negative going side of the signal get captured
as well?
 
"Jamie" <jamie_5_not_valid_after_5_Please@charter.net> wrote in message

you need something like a non reset able one shot timer.
i do think the out of the 741 could be used to trigger
a 555 for a one shot mode.
i think your trying to get a clean logic pulse.
Hello Jamie and thanks for the reply,

I was seriously considering doing something like that, but the RC
feedback on the comparator is doing a nice job of cleaning up the
signal. I now have it feeding into a PIC and two LEDs to indicate the
"tick" and the "tock". It looks kinda neat. :)
 
"John Popelish" <jpopelish@rica.net> wrote in message
news:41E94E93.92B2AFDB@rica.net...
Anthony Fremont wrote:
(snip)
Thanks, I haven't tried your suggestion yet, but it is interesting.
Am
I correct in that it still only "captures" half of the signal coming
out
of the 741? Or does the negative going side of the signal get
captured
as well?

It uses the whole signal. It adds the magnitude of the negative peaks
ot the magnitude if the positive peaks to produce DC that is equal to
the peak to peak voltage. But the output doesn't come out till both
peaks have occurred.
Ok, that sounds good. I may implement it to gain some more use of the
signal, but first I need to find something better to replace the 741.
The LM6132 looks like it might be a decent candidate for a jelly bean
device. Do you recommend any others for generic low-voltage
rail-to-rail audio processing? In this particular case I don't want too
much gain, just enough hear the ticking, and not all the ambient noise.
My current "microphone" is a discarded PC speaker (hey it's all I had
"in stock" ;-).

John Jardine's little RC feedback circuit gives me the exact effect that
I was looking for, but the pulse is still a bit longer than I want. I'm
curious how the 47K resistor he suggested fits into the time constant
calculations. His cap suggestion was a bit large so I lowered it to
..1uF and that gives me ok results. NEWSFLASH: I'm now experiencing an
oscillation problem with the 393. I'm fairly sure it was working fine
at first (at least the scope looked right), but now it's self triggering
and I can't seem to make it stop. :-(

The ultimate plan is to feed the cleaned up pulses into a PIC and time
the distance between the beginning edges. The ratio of these two times
will tell me how much out of beat the clock is. I will also be able to
calculate beats per minute etc...
 
Anthony Fremont wrote:
"john jardine" <john@jjdesigns.fsnet.co.uk> wrote in message
I wrote:
VCC +5V VCC +5V VCC +5V
+ + +
| | |
| | |
.-. .-. .-.
| |10K | |10K | |
| | ___ 100K | | | |2K
'-' .---|___|----. '-' '-'
| | | | |
| | | | |
10uF 1K | | LM741 | | LM393|\| |
|| ___ | | |\| | o--------|-\ |
|\ __ .--||--|___|---(---o-------|-\ | | |
--o--->OUT
| | |- || | | >-o----(--------|+/
| |__|---------------o-----------|+/ | |/|
|/ | |/| |
.-. .-.
Speaker IN | |10K | |10K
| | | |
'-' '-'
| |
| |
=== ===
GND GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

Give it a bit of feedback. Adding the C and Rs will (on triggering)
force
the o/p low for about 100ms then the output goes high for about 100ms.
Then
ready and waiting for the next 'tick' soundburst.

LM393
|\|
-|-\ |
___ | >--o---
741 o/p o--|___|-o-------|+/ |
47k | |/| |
| |
| |
| ___ || |
'-|___|---||--'
||
100k 470n

I'm having a bit of trouble with this still, forgive me for being
moronic. First let's see if I'm getting any of this.

After tinkering around with this circuit for a bit, I think I understand
how it works (sorta ;-). When the comparator output goes low (due to
741 output going below divider voltage), it feeds back and drives the +
input even lower, holding it down. This voltage is kind of "stuck" and
helps hold the comparator output low until it bleeds away thru the 47K
resistor. When the 741's output can no longer hold the + input lower
than the voltage divider input (-), it flips back high and does the same
thing again only this time forcing the + input even higher until the
voltage can bleed away thru the 47K resistor. Is that about right? If
that's true, how does the 100K resistor figure in? Is it setting the
gain to roughly 2 (100k/47k)? If so, why? Is it to help prevent signal
degradation from the 47K resistor?

Thanks for all your help, everyone
The instantaneous positive feedback that happens whenever the + input
reaches a match with the - input is determined by the ratio of the
input and feedback resistor, and the voltage swing on the comparator
output. Lets say the - input is held at 2.5 volts and the comparator
produces a full 5 volt swing. So every time the + input approaches
2.5 volts, the positive feedback will swing it to 2.5 + or -
5*47k/(100k+47k)= 2.5 + or - 1.6 volts, driving the + input way past
what it just takes to swing the output. But since there is a
capacitor in series with the positive feedback, the effect fades out
with a (100k+47k)*C time constant. So the overdrive disappears almost
completely after about 5 time constants and the comparator goes back
to looking pretty directly at whatever voltage is coming from the 741
through the 47k resistor.
--
John Popelish
 
"John Popelish" <jpopelish@rica.net> wrote in message

The instantaneous positive feedback that happens whenever the + input
reaches a match with the - input is determined by the ratio of the
input and feedback resistor, and the voltage swing on the comparator
output.
So what you are saying is that the two resistors do act the same as when
in a regular op-amp, they establish gain. Does that mean that the
comparators gain went from its normallly immense value to 2 with the
adition of the feedback/input components? Or does it retain it's huge
voltage gain.

Lets say the - input is held at 2.5 volts and the comparator
produces a full 5 volt swing. So every time the + input approaches
2.5 volts, the positive feedback will swing it to 2.5 + or -
5*47k/(100k+47k)= 2.5 + or - 1.6 volts, driving the + input way past
what it just takes to swing the output.

But since there is a
capacitor in series with the positive feedback, the effect fades out
with a (100k+47k)*C time constant. So the overdrive disappears almost
completely after about 5 time constants and the comparator goes back
to looking pretty directly at whatever voltage is coming from the 741
through the 47k resistor.
5 time constants....hmm.... I'm seeing the comparator flip back after a
bit over 2*RC on the scope. Currently, I'm liking a .22uF cap in there.
It gives me about a 60mS low and a following stiff high for about the
same time I think, for a total of possibly 5*RC. It's pretty nifty, and
it does work, but it seems to make the comparator a bit touchy to things
like fingers, voltmeter probes, etc.

I ran into some problems with noise from the LCD getting into the
system. I was updating the display every 100mS and that perfectly
coincided with the noise I was seeing, so by a stroke of pure genius I
concluded that they might be related. I tried allot of different things
to eliminate the burst of noise. Bypass caps all over (mostly a waste
of time), rerouting the LCD wiring (total waste of time), and finally
installing a .1 ceramic to ground on the 741's mic input (the pin that
leads to the inverting input). Strangely (to me), putting a cap on the
non-inverting input of the comparator had little effect on the noise.
Once I found the right spot, the noise all but disappeared. This made
it seem to me like it was being picked up by the wire leading to my mic,
which would seem very logical. However, moving it around and clasping
my hand over it had no effect on the noise problem. By relocating the
10uF cap and the 1K resistor (now 500 ohms for better gain) and putting
in the bypass cap where the mic wiring connected to the breadboard,
problem solved.

It's accurately giving me the half-beat time intervals in whole mS
instead of 100nS intervals. Not that I didn't like the added precision,
but many clocks vary the balance of the beat by as much as 10% during
one revolution of the escape wheel so the numbers looked erratic since
jumps of several mS per tick are common. Especially when you get to the
part of the wheel that contains the first and last tooth cut during
manufacturing. You can also press a button and it counts whole beats
for one minute and then prints the BPM value. Now to add some kind of
optical sensor ability and data logging and write a bunch more PIC code.
It also needs a serial interface so I can hook it to a computer and
start whipping together some VB code to make it look impressive. ;-)

Thanks for your help, it's greatly appreciated.
 
"Larry Brasfield" <donotspam_larry_brasfield@hotmail.com> wrote in
message news:sxjHd.52
I wrote:
So what you are saying is that the two resistors do act the same as
when
in a regular op-amp, they establish gain. Does that mean that the
comparators gain went from its normallly immense value to 2 with the
adition of the feedback/input components? Or does it retain it's
huge
voltage gain.

You're thinking of the closed loop gain with negative feedback.
In this case, the feedback is positive. Depending on how you
like to define gain, this can be considered to increase the gain
beyond its unfedback value.
Ok, thank you for that. I think I "get it" now. ;-)
 
Anthony Fremont wrote:
"John Popelish" <jpopelish@rica.net> wrote in message
news:41EDCA7A.72AFBC97@rica.net...
Anthony Fremont wrote:

"John Popelish" <jpopelish@rica.net> wrote in message
(snip)
5 time constants....hmm.... I'm seeing the comparator flip back
after a
bit over 2*RC on the scope.

So you must be comparing the 741 output to a reference voltage offset
more than 1% of 1.6 (the positive feedback voltage) volts from the
bias voltage of the 741 (the zero signal amplifier voltage). The 5
time constants I referred to is how long it takes for the positive
feedback to decay to 1% of its initial value (of 1.6 volts).

I currently have the 741's output at 2.52V and the 393's divider at
2.38V.
Ah. About 8.8% of 1.6 volts.

(snip)

--
John Popelish
 
Anthony Fremont wrote:
Hello all,

Danny got me thinking about my op-amp stuff, so I resurrected it for
another application/experiment. Now what I'm doing is that I'm trying
to "hear" some tapping type noises (actually an antique clock
tick-tock). What I want to do is to measure the spacing between the
beats. I'm sure to be in violation of someone's patent, but this is for
personal use so on to the show. ;-)

I am currently using the circuit below. The 10K voltage dividers were
empirically picked so that the idle output voltage of the 741 is 2.52V,
the divider on the 393 is at 2.50V leaving a 20mV difference.
Everything works pretty much as expected (i.e. the 393's output rides at
+5V until a loud enough noise causes the comparator output to flip) A
"loud enough noise" is anything that causes the 741's output to shift by
more than about 20mV. What I'm seeing on the scope peaks at about 500mV
on the output of the 741.

The 393 then swings low on the peaks of the tick sound like I want, but
the the comparator's output swings high again between the peaks of the
audio waves (every couple of mS) giving me a stream of pulses. What I
want is for the output to pull low and stay low until the tick sound
decays a bit (interpret this as about 50mS'ish ;o). IOW, I want to low
pass filter the output of the 393. The base pitch of the sound seems to
be around 600Hz or so. The sharp intial attack is all I'm really after,
the main jist of the sound is between 40 and 60mS in length.

I tried putting a 1uF cap to ground on the output of the 393. This
helps, but I still get allot of ripple on the low signal. Bigger caps
do better, but they also lead to real slow rise times even with the
fairly stout pullup (2K). What do I do now? I think I need to add some
RC time constant somewhere, but not sure where.

VCC +5V VCC +5V VCC +5V
+ + +
| | |
| | |
.-. .-. .-.
| |10K | |10K | |
| | ___ 100K | | | |2K
'-' .---|___|----. '-' '-'
| | | | |
| | | | |
10uF 1K | | LM741 | | LM393|\| |
|| ___ | | |\| | o--------|-\ |
|\ __ .--||--|___|---(---o-------|-\ | | | >--o--->OUT
| | |- || | | >-o----(--------|+/
| |__|---------------o-----------|+/ | |/|
|/ | |/| |
.-. .-.
Speaker IN | |10K | |10K
| | | |
'-' '-'
| |
| |
=== ===
GND GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)
The 741 is almost comatose if it is powered from only 5 volts. An
LM324 quad would have more input and output swing capability with a
low voltage supply.

I would also connect the amplifier to the comparator through a voltage
doubling rectifier to convert the audio to DC, for a cleaner pulse out
of the comparator.

This would consist of a series capacitor on the opamp output, with a
diode connecting that to a 2.5 volt reference divider (say, cathode to
capacitor) and also a second diode (anode to capacitor) connecting to
a second capacitor and the comparator input, with the other end of
that cap to ground. When the amplifier swings negative, the diode to
the 2.5 volt reverence voltage keeps the series cap from going more
negative than about 2 volts, and then on the positive swing, the
voltage rises from that to a more positive voltage that is 2 + the
peak to peak of the audio, the positive peaks of that passing through
the second diode to the low pass filter cap. You will also need a
high value resistor from the comparator input to the 2.5 volt
reference to fade the positive voltage out after the pop is over.
--
John Popelish
 
Sorry if this appears twice, it didn't show up on my ISP's server for
some reason. :-/
"John Popelish" <jpopelish@rica.net> wrote in message
Anthony Fremont wrote:

The 741 is almost comatose if it is powered from only 5 volts. An
LM324 quad would have more input and output swing capability with a
low voltage supply.
Thanks for the reply John. Yeah, I'll have to get some of those next
time I'm at the store. The 741 is all I've got right now, and it's
giving me a decent enough output.

I would also connect the amplifier to the comparator through a voltage
doubling rectifier to convert the audio to DC, for a cleaner pulse out
of the comparator.

This would consist of a series capacitor on the opamp output, with a
diode connecting that to a 2.5 volt reference divider (say, cathode to
capacitor) and also a second diode (anode to capacitor) connecting to
a second capacitor and the comparator input, with the other end of
that cap to ground. When the amplifier swings negative, the diode to
the 2.5 volt reverence voltage keeps the series cap from going more
negative than about 2 volts, and then on the positive swing, the
voltage rises from that to a more positive voltage that is 2 + the
peak to peak of the audio, the positive peaks of that passing through
the second diode to the low pass filter cap. You will also need a
high value resistor from the comparator input to the 2.5 volt
reference to fade the positive voltage out after the pop is over.
Hmm, like this?


+2.5V from divider
.
|
|
o----.
| |
V |
10uF ? - |
| .-.
|| | | |47K ?
741 -||-----o | |
|| | '-'
| |
V |
- |
| |
o----o---> 393
|
|
--- .1uF ?
---
Speaker IN |
|
===
GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)
 
"Anthony Fremont" <spam@anywhere.com> wrote in message
news:glXFd.3432$Ta2.1413@fe2.texas.rr.com...
Hello all,

Danny got me thinking about my op-amp stuff, so I resurrected it for
another application/experiment. Now what I'm doing is that I'm trying
to "hear" some tapping type noises (actually an antique clock
tick-tock). What I want to do is to measure the spacing between the
beats. I'm sure to be in violation of someone's patent, but this is for
personal use so on to the show. ;-)

I am currently using the circuit below. The 10K voltage dividers were
empirically picked so that the idle output voltage of the 741 is 2.52V,
the divider on the 393 is at 2.50V leaving a 20mV difference.
Everything works pretty much as expected (i.e. the 393's output rides at
+5V until a loud enough noise causes the comparator output to flip) A
"loud enough noise" is anything that causes the 741's output to shift by
more than about 20mV. What I'm seeing on the scope peaks at about 500mV
on the output of the 741.

The 393 then swings low on the peaks of the tick sound like I want, but
the the comparator's output swings high again between the peaks of the
audio waves (every couple of mS) giving me a stream of pulses. What I
want is for the output to pull low and stay low until the tick sound
decays a bit (interpret this as about 50mS'ish ;o). IOW, I want to low
pass filter the output of the 393. The base pitch of the sound seems to
be around 600Hz or so. The sharp intial attack is all I'm really after,
the main jist of the sound is between 40 and 60mS in length.

I tried putting a 1uF cap to ground on the output of the 393. This
helps, but I still get allot of ripple on the low signal. Bigger caps
do better, but they also lead to real slow rise times even with the
fairly stout pullup (2K). What do I do now? I think I need to add some
RC time constant somewhere, but not sure where.



VCC +5V VCC +5V VCC +5V
+ + +
| | |
| | |
.-. .-. .-.
| |10K | |10K | |
| | ___ 100K | | | |2K
'-' .---|___|----. '-' '-'
| | | | |
| | | | |
10uF 1K | | LM741 | | LM393|\| |
|| ___ | | |\| | o--------|-\ |
|\ __ .--||--|___|---(---o-------|-\ | | | >--o--->OUT
| | |- || | | >-o----(--------|+/
| |__|---------------o-----------|+/ | |/|
|/ | |/| |
.-. .-.
Speaker IN | |10K | |10K
| | | |
'-' '-'
| |
| |
=== ===
GND GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)
Give it a bit of feedback. Adding the C and Rs will (on triggering) force
the o/p low for about 100ms then the output goes high for about 100ms. Then
ready and waiting for the next 'tick' soundburst.

LM393
|\|
-|-\ |
___ | >--o---
741 o/p o--|___|-o-------|+/ |
47k | |/| |
| |
| |
| ___ || |
'-|___|---||--'
||
100k 470n
 
Anthony Fremont wrote:
Sorry if this appears twice, it didn't show up on my ISP's server for
some reason. :-/
"John Popelish" <jpopelish@rica.net> wrote in message
(snip)
I would also connect the amplifier to the comparator through a voltage
doubling rectifier to convert the audio to DC, for a cleaner pulse out
of the comparator.

This would consist of a series capacitor on the opamp output, with a
diode connecting that to a 2.5 volt reference divider (say, cathode to
capacitor) and also a second diode (anode to capacitor) connecting to
a second capacitor and the comparator input, with the other end of
that cap to ground. When the amplifier swings negative, the diode to
the 2.5 volt reverence voltage keeps the series cap from going more
negative than about 2 volts, and then on the positive swing, the
voltage rises from that to a more positive voltage that is 2 + the
peak to peak of the audio, the positive peaks of that passing through
the second diode to the low pass filter cap. You will also need a
high value resistor from the comparator input to the 2.5 volt
reference to fade the positive voltage out after the pop is over.

Hmm, like this?

+2.5V from divider
.
|
|
o----.
| |
V |
10uF ? - |
| .-.
|| | | |47K ?
741 -||-----o | |
|| | '-'
| |
V |
- |
| |
o----o---> 393
|
|
--- .1uF ?
---
Speaker IN |
|
===
GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)
Except for the words "speaker in", yes.
If you have signal schottky diodes, they would work with less lost
voltage than silicon junction diodes. I think both caps can be .1uf.

--
John Popelish
 
"john jardine" wrote

Give it a bit of feedback. Adding the C and Rs will (on triggering)
force
the o/p low for about 100ms then the output goes high for about 100ms.
Then
ready and waiting for the next 'tick' soundburst.

LM393
|\|
-|-\ |
___ | >--o---
741 o/p o--|___|-o-------|+/ |
47k | |/| |
| |
| |
| ___ || |
'-|___|---||--'
||
100k 470n
Thanks allot John! It really works, though I don't really understand it
all. I tried it without the 47K in between the 741 and 393, no effect
at all. But when I did it right, it gave me long pulses. I eventually
lowered the cap value to .1uF and the pulse length is about 60mS. I
can't really tell, but is the pulse length determined from the start of
the tick sound, or after it decays to the point that it's no longer
triggering the 393? How does the 47K resistor figure in?
 
Anthony Fremont wrote:
(snip)
Thanks, I haven't tried your suggestion yet, but it is interesting. Am
I correct in that it still only "captures" half of the signal coming out
of the 741? Or does the negative going side of the signal get captured
as well?
It uses the whole signal. It adds the magnitude of the negative peaks
ot the magnitude if the positive peaks to produce DC that is equal to
the peak to peak voltage. But the output doesn't come out till both
peaks have occurred.

--
John Popelish
 
Anthony Fremont wrote:
"John Popelish" <jpopelish@rica.net> wrote in message
news:41E94E93.92B2AFDB@rica.net...

It uses the whole signal. It adds the magnitude of the negative peaks
ot the magnitude if the positive peaks to produce DC that is equal to
the peak to peak voltage. But the output doesn't come out till both
peaks have occurred.

Ok, that sounds good. I may implement it to gain some more use of the
signal, but first I need to find something better to replace the 741.
Yes.

The LM6132 looks like it might be a decent candidate for a jelly bean
device. Do you recommend any others for generic low-voltage
rail-to-rail audio processing?
Almost any rail to rail opamp will work much better than the 741.

The LM358 in not a rail to rail design, but can work with both inputs
and outputs from the negative rail to 1.5 volts below the positive
rail, and they are dirt common. This is the dual version of the LM324
quad. It also has the same input circuit used in your comparator. So
if you use this, you should change your reference divider from 2.5
volts to (5V - 1.5V)/2= 1.75 volts, to center the reference voltage in
the middle of both the input and output range.
http://cache.national.com/ds/LM/LM158.pdf

In this particular case I don't want too
much gain, just enough hear the ticking, and not all the ambient noise.
You can easily add a trim pot between your input and feed back
resistor on the opamp, with the wiper going to the - input to vary the
gain. That way you get the biggest possible range of the ratio of
feedback to input resistance for a given pot resistance.

My current "microphone" is a discarded PC speaker (hey it's all I had
"in stock" ;-).
Nothing wrong with that.

John Jardine's little RC feedback circuit gives me the exact effect that
I was looking for, but the pulse is still a bit longer than I want. I'm
curious how the 47K resistor he suggested fits into the time constant
calculations. His cap suggestion was a bit large so I lowered it to
.1uF and that gives me ok results. NEWSFLASH: I'm now experiencing an
oscillation problem with the 393. I'm fairly sure it was working fine
at first (at least the scope looked right), but now it's self triggering
and I can't seem to make it stop. :-(
You need to move the reference voltage on the other input of the
comparator ot a slightly different voltage compared to the center line
of the audio signal, so the comparator can lock up.

The ultimate plan is to feed the cleaned up pulses into a PIC and time
the distance between the beginning edges. The ratio of these two times
will tell me how much out of beat the clock is. I will also be able to
calculate beats per minute etc...
--
John Popelish
 
"john jardine" <john@jjdesigns.fsnet.co.uk> wrote in message

Give it a bit of feedback. Adding the C and Rs will (on triggering)
force
the o/p low for about 100ms then the output goes high for about 100ms.
Then
ready and waiting for the next 'tick' soundburst.

LM393
|\|
-|-\ |
___ | >--o---
741 o/p o--|___|-o-------|+/ |
47k | |/| |
| |
| |
| ___ || |
'-|___|---||--'
||
100k 470n
I'm now experiencing an oscillation problem with the 393. I'm fairly
sure it was working fine at first (at least the scope looked right
comparing the output of the 741 with the output of the 393 and
triggering on the 393, things were lining up correctly), but now it's
self triggering and I can't seem to make it stop. :-( The oscillation
is at the RC time constant rate. It doesn't even seem to need a trigger
pulse to get it going. I tried playing with the 47K and the cap, and it
doesn't seem to help any. How can I get less feedback, but not screw up
the time constant?
 
"Anthony Fremont" <spam@anywhere.com> wrote in message
news:5ReGd.16898$Ta2.4392@fe2.texas.rr.com...
"john jardine" <john@jjdesigns.fsnet.co.uk> wrote in message

Give it a bit of feedback. Adding the C and Rs will (on triggering)
force
the o/p low for about 100ms then the output goes high for about 100ms.
Then
ready and waiting for the next 'tick' soundburst.

LM393
|\|
-|-\ |
___ | >--o---
741 o/p o--|___|-o-------|+/ |
47k | |/| |
| |
| |
| ___ || |
'-|___|---||--'
||
100k 470n

I'm now experiencing an oscillation problem with the 393. I'm fairly
sure it was working fine at first (at least the scope looked right
comparing the output of the 741 with the output of the 393 and
triggering on the 393, things were lining up correctly), but now it's
self triggering and I can't seem to make it stop. :-( The oscillation
is at the RC time constant rate. It doesn't even seem to need a trigger
pulse to get it going. I tried playing with the 47K and the cap, and it
doesn't seem to help any. How can I get less feedback, but not screw up
the time constant?

With a constant input, and absent noise effects, and
assuming the input is not within the small range for
which the comparator's output is non-saturated,
the above circuit should not oscillate. This leads
me to believe that you input is near enough to that
small active range, with enough noise on it that an
output transition is triggered by the noise. Due to
the AC positive feedback, once triggered, the
input is dominated by the feedback, and that is why
you see "oscillation" at about the 1/RC frequency.

I skimmed your earlier post on the circuit preceding
the above, and thought that the manner in which the
near-threshold bias was achieved could not be too
reliable or stable. So I would look into that.

--
--Larry Brasfield
email: donotspam_larry_brasfield@hotmail.com
Above views may belong only to me.
 
"John Popelish" <jpopelish@rica.net> wrote in message
news:41E97660.36CFEECC@rica.net...
Anthony Fremont wrote:

Almost any rail to rail opamp will work much better than the 741.
Alright, I get the hint. ;-)

The LM358 in not a rail to rail design, but can work with both inputs
and outputs from the negative rail to 1.5 volts below the positive
rail, and they are dirt common. This is the dual version of the LM324
quad. It also has the same input circuit used in your comparator. So
if you use this, you should change your reference divider from 2.5
volts to (5V - 1.5V)/2= 1.75 volts, to center the reference voltage in
the middle of both the input and output range.
http://cache.national.com/ds/LM/LM158.pdf

In this particular case I don't want too
much gain, just enough hear the ticking, and not all the ambient
noise.

You can easily add a trim pot between your input and feed back
resistor on the opamp, with the wiper going to the - input to vary the
gain. That way you get the biggest possible range of the ratio of
feedback to input resistance for a given pot resistance.
Yes, I can see room for a couple of "tweaking knobs". ;-) Adjustable
gain on the amp stage and a tweak for the voltage divider on the
comparator would be perfect.

My current "microphone" is a discarded PC speaker (hey it's all I
had
"in stock" ;-).

Nothing wrong with that.
It actually works pretty decently so far, but I could use a bit more
sensitivity now.

John Jardine's little RC feedback circuit gives me the exact effect
that
I was looking for, but the pulse is still a bit longer than I want.
I'm
curious how the 47K resistor he suggested fits into the time
constant
calculations. His cap suggestion was a bit large so I lowered it to
.1uF and that gives me ok results. NEWSFLASH: I'm now experiencing
an
oscillation problem with the 393. I'm fairly sure it was working
fine
at first (at least the scope looked right), but now it's self
triggering
and I can't seem to make it stop. :-(

You need to move the reference voltage on the other input of the
comparator ot a slightly different voltage compared to the center line
of the audio signal, so the comparator can lock up.
You're right, problem appears to be solved (or at least identified).
;-) Aparently, the 47K resistor upsets the voltage coming from the 741
a little bit. On the 741 side, the voltage is still the 2.52 I wanted,
but the 393 side of the resistor seems to be a bit lower. I guess the
input impedance to the comparator isn't quite infinite and led to a
voltage drop accross the 47K resistor. ;-)

I put a 340K (it's what I found first ;-) accross the 10K-to-ground on
the 393's input voltage divider. That stopped the oscillation and it
still triggers, just with a bit less sensitivity. When I touch my
voltmeter probe (or finger) the junction of the divider it starts
self-triggering again. I'm guessing thats off the stray 60Hz AC voltage
present in the air, more than the added capacitance of the probe or
finger. What do you think?

The ultimate plan is to feed the cleaned up pulses into a PIC and
time
the distance between the beginning edges. The ratio of these two
times
will tell me how much out of beat the clock is. I will also be able
to
calculate beats per minute etc...
Thanks for all your help, this has been quite educational. Next up,
writing some PIC code.
 
"Larry Brasfield" <donotspam_larry_brasfield@hotmail.com> wrote in
message news:fZeGd.7

I skimmed your earlier post on the circuit preceding
the above, and thought that the manner in which the
near-threshold bias was achieved could not be too
reliable or stable. So I would look into that.
That appears to be correct (see my post in the thread with John
Popelish). The 47K resistor gives a little voltage drop that put things
too close to the gray area. Yeah, I know the hand-selected voltage
divider is a bit cheesy, but it's just a breadboard project right now.
I may actually solder up a permanent version of this project though.
I'll add some "knobs" for tweaking. I'm also adding two leds so that
you can tell when it's synced to both the "tick" and the "tock".
That'll be easier than dragging the scope around. ;-D
 
Anthony Fremont wrote:

Hello all,

Danny got me thinking about my op-amp stuff, so I resurrected it for
another application/experiment. Now what I'm doing is that I'm trying
to "hear" some tapping type noises (actually an antique clock
tick-tock). What I want to do is to measure the spacing between the
beats. I'm sure to be in violation of someone's patent, but this is for
personal use so on to the show. ;-)

I am currently using the circuit below. The 10K voltage dividers were
empirically picked so that the idle output voltage of the 741 is 2.52V,
the divider on the 393 is at 2.50V leaving a 20mV difference.
Everything works pretty much as expected (i.e. the 393's output rides at
+5V until a loud enough noise causes the comparator output to flip) A
"loud enough noise" is anything that causes the 741's output to shift by
more than about 20mV. What I'm seeing on the scope peaks at about 500mV
on the output of the 741.

The 393 then swings low on the peaks of the tick sound like I want, but
the the comparator's output swings high again between the peaks of the
audio waves (every couple of mS) giving me a stream of pulses. What I
want is for the output to pull low and stay low until the tick sound
decays a bit (interpret this as about 50mS'ish ;o). IOW, I want to low
pass filter the output of the 393. The base pitch of the sound seems to
be around 600Hz or so. The sharp intial attack is all I'm really after,
the main jist of the sound is between 40 and 60mS in length.

I tried putting a 1uF cap to ground on the output of the 393. This
helps, but I still get allot of ripple on the low signal. Bigger caps
do better, but they also lead to real slow rise times even with the
fairly stout pullup (2K). What do I do now? I think I need to add some
RC time constant somewhere, but not sure where.



VCC +5V VCC +5V VCC +5V
+ + +
| | |
| | |
.-. .-. .-.
| |10K | |10K | |
| | ___ 100K | | | |2K
'-' .---|___|----. '-' '-'
| | | | |
| | | | |
10uF 1K | | LM741 | | LM393|\| |
|| ___ | | |\| | o--------|-\ |
|\ __ .--||--|___|---(---o-------|-\ | | | >--o--->OUT
| | |- || | | >-o----(--------|+/
| |__|---------------o-----------|+/ | |/|
|/ | |/| |
.-. .-.
Speaker IN | |10K | |10K
| | | |
'-' '-'
| |
| |
=== ===
GND GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

you need something like a non reset able one shot timer.
i do think the out of the 741 could be used to trigger
a 555 for a one shot mode.
i think your trying to get a clean logic pulse.
 

Welcome to EDABoard.com

Sponsor

Back
Top