Maker Pro
Maker Pro

Looking for two-input comparator with hysteresis

K

Ken Smith

Jan 1, 1970
0
Hi all,

I'm building a digital clock circuit which will use the AC mains
frequency for time keeping. I need a circuit (preferably a single IC)
which can be connected via a transformer to the mains supply, and will
send one output pulse to my TTL for each complete supply cycle. I think
it would be good to include some hysteresis in case the AC mains
waveform is noisy. I'm concerned about using a simple Schmitt trigger,
where the input is taken relative to the lower power rail, in case I
create a loop which causes a large current to flow back through the
linear power supply. So I'm looking for a comparator with two high
impedance inputs and hysteresis. Does such a thing exist as a single IC?

You may want to look at some of the low power comapritors from Linear.

You also can make an LM311 have hysteresis buy feeding back from the
output to the offset trim. Check the data sheet for an example circuit.

You can also do what you want by slightly abusing a quad op-amp such as
the LM324. Three sections can be used ot make a classic dif-amp. The 4th
section can have positive feedback so that it acts as a comparitor.
 
S

Stanislaw Flatto

Jan 1, 1970
0
Christopher said:
I guess what's really puzzling me here is that I can't connect one end
of the transformer winding to logic ground (or at least I don't think I
can). So I need some kind of differential to single-ended convertor, but
with a Schmitt trigger too, so I can't just use a 741 or LM139. I'm
surprised there isn't a single IC for this purpose.

I'm thinking through your ideas - many thanks.

Chris
Hi!
Your 741 and I are friends since the 1970's. In those times it was DC-to
very high audio amplifier so for the 60 or maybe 120Hz don't worry.
But it uses split supply, in what you are doing is a headache.
Try to concentrate on CMOS 3-16V supplies and dual NAND gate can be used
as analog amplifier by using proper feedback and input resistors.

Good luck

Stanislaw
Slack user from Ulladulla.
 
C

Christopher Tidy

Jan 1, 1970
0
Spehro said:
Connect either of the ends of the transformer winding to a circut as
John Larkin suggested. You will get a 50Hz output (not 100Hz as you
might expect) from the ST. It should work okay as I said, but one 10K
resistor from each end of the transformer secondary to ground (the
common in your circuit, not earth) might be prudent. Each end of the
winding (when lightly loaded) has 1/2 cycle of the mains voltage
followed by 1/2 cycle of slight negative voltage relative to your
common.

Thanks Spehro. I think I see what you're saying, though I still need to
have a think to convince myself as to why a resistor is needed at both
ends of the transformer winding. Perhaps when I've drawn a full
schematic I'll post a copy for people to take a look at?

Best wishes,

Chris
 
C

Christopher Tidy

Jan 1, 1970
0
Ken said:
You may want to look at some of the low power comapritors from Linear.

You also can make an LM311 have hysteresis buy feeding back from the
output to the offset trim. Check the data sheet for an example circuit.

You can also do what you want by slightly abusing a quad op-amp such as
the LM324. Three sections can be used ot make a classic dif-amp. The 4th
section can have positive feedback so that it acts as a comparitor.

Thanks for the suggestions, Ken. I'll look into those ideas tomorrow.

Best wishes,

Chris
 
K

krw

Jan 1, 1970
0
Hello Keith,


You just hook up a piezo and count the clicks :)))

I'm surprised you don't sell monster cables to go with the Piezo to
get a crisper time. ;-)

But seriously, if his clock has a uC it might already contain Schmitt
inputs. Or at least a comparator that can be "schmitted". All it then
takes is an RC to get rid of the bulk of the noise issues.

LIkely, but it's not needed with anything this slow. Filter it
with the 99.999999% of the free cycles left after counting to 60 a
few times.
 
F

Fred Bartoli

Jan 1, 1970
0
Spehro Pefhany said:
The really cheap way is to use a CT xfmr and biplex the display using
two 1N4001s as digit drivers. Then the 60Hz input serves two purposes.

He he...
And in case you find the display flickers too much, you can still power your
clock from a 3 phases mains.
 
R

Robert Latest

Jan 1, 1970
0
On Tue, 23 May 2006 14:44:51 -0400,
in Msg. said:
Both. But when people ask these sorts of questions I'm primarily
worried about them, rather than some magic smoke.

That's nuts. If your circuit is directly connected to the transformer's
secondary, an optical isolator (OI) gains nothing in case of transformer
isolation failure.

And if you suggest to use the OI to detect the signal directly off the
line side (this is how I read your post), you're 1) encouraging the OP
to build additional circuitry on the "live" AC mains side, and 2) you're
adding a parallel path for isolation failure.
You can do that because it is isolated (sometimes it's unclear
exactly what someone is intending). I'd still vote for the
suspenders to go along with the belt. Optical isolators are cheap
and may not add anything to the BOM.

Wait -- you're arguing for the inclusion of a superflous part but at the
same time encourage the replacement of something as cheap, simple and

robert
 
R

Robert Latest

Jan 1, 1970
0
On Wed, 24 May 2006 03:26:12 +0000,
in Msg. said:
Thanks for the suggestions, Ken. I'll look into those ideas tomorrow.

Look, Chris, I don't know why people are suggesting all this complicated
stuff -- software filtering, offset trim, optical insulators, diff amp,
additional transformer windings.

Just look at the voltage of the "top" AC input node of the bridge
rectifier with respect to logic ground. It varies between a small
negative voltage (~ -0.7V) to roughly 17 V with line frequency (50 Hz).

So all you need is a large (100k) resistor from the rectifier AC input
node to the input of a schmitt trigger, and a capacitor (22nF) from
there to ground to filter spikes. The output of the schmitt trigger is
used to drive your counter.

The voltage swing of -0.7 to 17 V will not damage the circuit because
the current is limited by the 100k resistor to about .1 mA which can be
safely handled by the input protection diodes of the schmitt trigger
(check the data sheet).

Don't make the mistake of omitting the schmitt trigger (as I have, many
years ago on an identical circuit) and feeding the signal directly into
the counter. Synchronous counters need quick level transitions to work
properly.

robert
 
F

Fred Bloggs

Jan 1, 1970
0
I'm building a digital clock circuit ...

Any suggestions would be much appreciated.

Any old fool can tap into that transformer to pulse a Schmitt trigger or
comparator or what have you, but tapping into the timing in such a way
that the resulting reference clock is not cumulatively "pulled" by the
DC loading of the circuit or mains variation is an entirely different
story. What is the periodicity of the mechanicals, and what is the logic
loading and its long term cycling profile? What kind of timing accuracy
are you looking for over a 24 hour period? The answer to your problem
may be much deeper than you expect.
 
J

John Larkin

Jan 1, 1970
0
Any old fool can tap into that transformer to pulse a Schmitt trigger or
comparator or what have you, but tapping into the timing in such a way
that the resulting reference clock is not cumulatively "pulled" by the
DC loading of the circuit or mains variation is an entirely different
story. What is the periodicity of the mechanicals, and what is the logic
loading and its long term cycling profile? What kind of timing accuracy
are you looking for over a 24 hour period? The answer to your problem
may be much deeper than you expect.

If the schmitt is squaring up 60 Hz cycles, how can DC offsets or
"mains variations" affect clock accuracy? If you count each line cycle
exactly once (not zero times, and not twice) where's the error?

The 60 Hz line is sort of the definition of clock time.

John
 
J

Jim Thompson

Jan 1, 1970
0
J

John Larkin

Jan 1, 1970
0
The clock hands move once per minute. I would consider a 5 minute error
in 6 months to be acceptable accuracy, and from what I know the UK power
grid should be capable of providing this.

Best wishes,

Chris

I doubt that the national power grid will be, at any instant, much
more than a second ahead or behind, and longterm it's perfect.

John
 
C

Christopher Tidy

Jan 1, 1970
0
Robert said:
On Wed, 24 May 2006 03:26:12 +0000,



Look, Chris, I don't know why people are suggesting all this complicated
stuff -- software filtering, offset trim, optical insulators, diff amp,
additional transformer windings.

Just look at the voltage of the "top" AC input node of the bridge
rectifier with respect to logic ground. It varies between a small
negative voltage (~ -0.7V) to roughly 17 V with line frequency (50 Hz).

So all you need is a large (100k) resistor from the rectifier AC input
node to the input of a schmitt trigger, and a capacitor (22nF) from
there to ground to filter spikes. The output of the schmitt trigger is
used to drive your counter.

The voltage swing of -0.7 to 17 V will not damage the circuit because
the current is limited by the 100k resistor to about .1 mA which can be
safely handled by the input protection diodes of the schmitt trigger
(check the data sheet).

Don't make the mistake of omitting the schmitt trigger (as I have, many
years ago on an identical circuit) and feeding the signal directly into
the counter. Synchronous counters need quick level transitions to work
properly.

Thanks for the very useful advice. I'm looking for something simple
which just works reliably, and this seems to fit the bill. If I've done
my calculations right a potential divider consisting of a 100k ohm
resistor and 22 nF capacitor gives a maximum voltage of around 10 V
between the Schmitt trigger input and logic ground (for a 50 Hz signal).
Are the 100 k ohm and 22 nF standard values, or did you and John
calculate them specially? Should I connect another resistor between
logic ground and the "bottom" node of the bridge rectifier?

Many thanks,

Chris
 
C

Christopher Tidy

Jan 1, 1970
0
Fred said:
Any old fool can tap into that transformer to pulse a Schmitt trigger or
comparator or what have you, but tapping into the timing in such a way
that the resulting reference clock is not cumulatively "pulled" by the
DC loading of the circuit or mains variation is an entirely different
story. What is the periodicity of the mechanicals, and what is the logic
loading and its long term cycling profile? What kind of timing accuracy
are you looking for over a 24 hour period? The answer to your problem
may be much deeper than you expect.

The clock hands move once per minute. I would consider a 5 minute error
in 6 months to be acceptable accuracy, and from what I know the UK power
grid should be capable of providing this.

Best wishes,

Chris
 
C

Christopher Tidy

Jan 1, 1970
0
Spehro said:
Connect either of the ends of the transformer winding to a circut as
John Larkin suggested. You will get a 50Hz output (not 100Hz as you
might expect) from the ST. It should work okay as I said, but one 10K
resistor from each end of the transformer secondary to ground (the
common in your circuit, not earth) might be prudent. Each end of the
winding (when lightly loaded) has 1/2 cycle of the mains voltage
followed by 1/2 cycle of slight negative voltage relative to your
common.

I've thought about this a bit more. If you connect the "top" end of the
transformer winding to the Schmitt trigger input through a 100k ohm
resistor, then connect the Schmitt trigger input to logic ground through
a 22 nF capacitor, you form a potential divider which also acts as a low
pass filter. Presumably you are suggesting connecting the logic ground
to the "bottom" end of the transformer winding through a 10k ohm
resistor in order to remove the unknown which is the resistance of the
rectifier diode, and place an upper limit on this resistance? But I
can't see why you suggest connecting the "top" end of the transformer
winding to logic ground through a 10k ohm resistor. Perhaps you could
explain? I'm missing something here.

Best wishes,

Chris
 
D

Don Lancaster

Jan 1, 1970
0
Christopher said:
Hi all,

I'm building a digital clock circuit which will use the AC mains
frequency for time keeping. I need a circuit (preferably a single IC)
which can be connected via a transformer to the mains supply, and will
send one output pulse to my TTL for each complete supply cycle. I think
it would be good to include some hysteresis in case the AC mains
waveform is noisy. I'm concerned about using a simple Schmitt trigger,
where the input is taken relative to the lower power rail, in case I
create a loop which causes a large current to flow back through the
linear power supply. So I'm looking for a comparator with two high
impedance inputs and hysteresis. Does such a thing exist as a single IC?

Any suggestions would be much appreciated.

Best wishes,

Chris Tidy
And the problem with a CMOS schmidt trigger is...?


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
K

Ken Smith

Jan 1, 1970
0
On Wed, 24 May 2006 03:26:12 +0000,
Look, Chris, I don't know why people are suggesting all this complicated
stuff -- software filtering, offset trim, optical insulators, diff amp,
additional transformer windings.

My complicated suggestion was because of what was requested.
So all you need is a large (100k) resistor from the rectifier AC input
node to the input of a schmitt trigger, and a capacitor (22nF) from
there to ground to filter spikes. The output of the schmitt trigger is
used to drive your counter.

This might work. I'd worry about the turn off spike though. I'd prefer
to add a couple of real diodes of the 1M400X type.
 
J

Jim Thompson

Jan 1, 1970
0
And the problem with a CMOS schmidt trigger is...?

Not much, really, except for crappy predictability.

And, in the OP's case, some risk of sending a signal that's over-rail,
making the predictability problem even tighter.

...Jim Thompson
 
J

John Larkin

Jan 1, 1970
0
Not much, really, except for crappy predictability.

Exactly one square output cycle per sine input cycle, forever, sounds
fairly predictable to me.
And, in the OP's case, some risk of sending a signal that's over-rail,
making the predictability problem even tighter.

Some day I'll explain ESD diodes to you, if you ask real nice.

John
 
K

krw

Jan 1, 1970
0
On Tue, 23 May 2006 14:44:51 -0400,


That's nuts. If your circuit is directly connected to the transformer's
secondary, an optical isolator (OI) gains nothing in case of transformer
isolation failure.

It's not nuts. Who knows what their skills are. Given that they
have to ask...
And if you suggest to use the OI to detect the signal directly off the
line side (this is how I read your post), you're 1) encouraging the OP
to build additional circuitry on the "live" AC mains side, and 2) you're
adding a parallel path for isolation failure.

NO, I'm saying that an isolation must be used (think series). It
wasn't clear that he was tapping off an isolated secondary. Even
so an isolator is a good idea and may not add to the parts court at
all (given that he was looking at comparitors and other schmitt
triggers). Optical isolators are cheap insurance.
Wait -- you're arguing for the inclusion of a superflous part but at the
same time encourage the replacement of something as cheap, simple and

Yes. He was suggesting a schmitt trigger or comparitor doing the
filtering. In that case the isolator is *not* an additional
component. He's building *ONE*. Yes, I am worried about his
safety over the cost of an optical isolator. (yikes! you really
can't be that dumb)
 
Top