Need help with op-amp/comparator circuit

"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
 
"Anthony Fremont" <spam@anywhere.com> wrote in message news:xljHd.39902$Z%.24928@fe1.texas.rr.com...
"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.
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.

--
--Larry Brasfield
email: donotspam_larry_brasfield@hotmail.com
Above views may belong only to me.
 
Anthony Fremont wrote:
"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.
No. The gain is not 2. Positive feedback raises gain. Sufficient
positive feedback (and this ratio of resistors is definitely
sufficient) raises the gain beyond infinity. An infinite gain
produces a finite output from zero input. This feedback produces so
much gain that it produces an output in spite of opposing input. In
other words, once the output begins its swing, that swing is
reinforced by the feedback, even if the input signal changes direction
and backs down a significant amount. The positive feedback makes a
decision to begin swinging the output essentially irrevocable without
a really big reversal in the direction of the input voltage.

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.
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).

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.
The tiniest moment that the two inputs of the comparator approach
equality produces the same output as a big pop on the input. Once the
output starts to move, it becomes the input signal, overwhelming the
input from the opamp.

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.
That node has gain. Try putting small caps in parallel with the opamp
feedback resistor, to roll the high frequency gain of the amplifier.

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.
Averaging successive periods is probably best done in software.

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.
--
John Popelish
 
"John Popelish" <jpopelish@rica.net> wrote in message
news:41EDCA7A.72AFBC97@rica.net...
Anthony Fremont wrote:

"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.

No. The gain is not 2. Positive feedback raises gain. Sufficient
positive feedback (and this ratio of resistors is definitely
sufficient) raises the gain beyond infinity. An infinite gain
produces a finite output from zero input. This feedback produces so
much gain that it produces an output in spite of opposing input. In
other words, once the output begins its swing, that swing is
reinforced by the feedback, even if the input signal changes direction
and backs down a significant amount. The positive feedback makes a
decision to begin swinging the output essentially irrevocable without
a really big reversal in the direction of the input voltage.

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.

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.

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.

The tiniest moment that the two inputs of the comparator approach
equality produces the same output as a big pop on the input. Once the
output starts to move, it becomes the input signal, overwhelming the
input from the opamp.
Looks pretty odd on the scope, something like an inductive kickback in a
motor supply line.

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.

That node has gain. Try putting small caps in parallel with the opamp
feedback resistor, to roll the high frequency gain of the amplifier.
Ok, I'll try that and see how it looks on the scope without the cap I
added. This was so weird at first because it only caused a problem when
you pushed the button to calculate BPM. That made it seem like the
software was somehow screwing up the beat detection making it count
extra ticks. The reason that the display didn't cause problems before
was because I was only writing to it immediately after detecting a tick.
When doing the BPM calculation I kept a running total on the display
that was updated every 100mS. Sometimes this led to extraneous triggers
causing the LEDS to be out of sync with the pendulum. I was fortunate
that I spotted it on the scope.

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.

Averaging successive periods is probably best done in software.
Phase II involves a PC interface and a serial eeprom.

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.
Thanks again. :)
 

Welcome to EDABoard.com

Sponsor

Back
Top