Maker Pro
Maker Pro

Looking for two-input comparator with hysteresis

K

Keith

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?

Any suggestions would be much appreciated.

Use an optical isolator to connect to the line, even if there is an
isolation transformer inbetween.

Depending on your clock circuit, it may be eaiser to do the
filtering in the digital domain. After the isolator turns on wait
1/119th of a second to look for it to go off, then 1/119th of a
second for it to turn back on...
 
C

Christopher Tidy

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?

Any suggestions would be much appreciated.

Best wishes,

Chris Tidy
 
J

Joerg

Jan 1, 1970
0
Hello Chris,
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?

Huh? Which current? Which not just take a 74HC14 and use a nice large
resistor value in series with its input if you are afraid to fry
something? Although I am still puzzled about that frying process you
described ;-)

The main issue here is a lowpass. After all, you don't want the spikes
from a starting vacuum cleaner to create a dozen pulses within one 60Hz
cycle.

Regards, Joerg
 
J

Joerg

Jan 1, 1970
0
Hello Keith,
Use an optical isolator to connect to the line, even if there is an
isolation transformer inbetween.

Depending on your clock circuit, it may be eaiser to do the
filtering in the digital domain. After the isolator turns on wait
1/119th of a second to look for it to go off, then 1/119th of a
second for it to turn back on...

That only works for a nearly perfect since wave, like if you'd tap into
the output of one of the generators at Hoover dam. It could fail in very
common situations where the since wave is distorted. That is common
these days because of all the switch mode supplies and dimmers in
households. A brief distortion can also be caused by a large AC motor
spooling up (air conditioner, pool pump etc.).

I'd go with a nice analog filter. Being an analog guy I am, of course, a
bit biased here :)

Regards, Joerg
 
J

John Larkin

Jan 1, 1970
0
The transformer has a tapped winding. The first part of the winding is
connected to a linear power supply which provides the 5 V for the TTL.
The second part provides the 50 Hz signal which is to be counted. I'm
proposing to connect one end of the second part of the winding to the
Schmitt trigger input, and the other end to the lower TTL power rail.
Current could flow from the first part of the winding, through the
linear power supply, through the lower power rail, and back into the
second part of the winding.


Do your transformer thing into a CMOS schmitt trigger, but insert a
100K resistor in series, then a 22 nF cap to logic ground. That will
both limit schmitt input current and filter spikes.

John
 
K

Keith

Jan 1, 1970
0
Hello Keith,


That only works for a nearly perfect since wave, like if you'd tap into
the output of one of the generators at Hoover dam. It could fail in very
common situations where the since wave is distorted. That is common
these days because of all the switch mode supplies and dimmers in
households. A brief distortion can also be caused by a large AC motor
spooling up (air conditioner, pool pump etc.).

No, it simply works. Once an endge is sensed one ignores any more
for some time. If there are multiple edges, no one cares. If the
waveform is *really* distorted where the sensing is done may shift,
but it'll soon find an "edge", rather like a phase detector.
I'd go with a nice analog filter. Being an analog guy I am, of course, a
bit biased here :)

If it's a digital problem, stay digital. Unlike analog, digital
transistors are free.
 
K

Keith

Jan 1, 1970
0
Is this for safety reasons or to protect the logic?

Both. But when people ask these sorts of questions I'm primarily
worried about them, rather than some magic smoke.
I just opened my
cheap Morphy Richards digital alarm clock and it seems to feed the 50 Hz
signal from the transformer directly into an LM8562 chip.

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.
I think I see what you mean. Once it has turned on, you wait a while
because you know that signals received during this period are irrelevant?

Yep. You know you're not going to see a negative transition for a
half-cycle after a positive transition. If there are several
transitions together you ignore 'em. If you delay a little too
long, you'll still see the negative level and restart your counter
waiting for the positive level.

Depending on the accuracy of the oscillator the delays can be tuned
close to the anticipated half-cycle the line. Then if the power
is lost (assuming backup) the clock will still run, though drift
off somewhat.
 
C

Christopher Tidy

Jan 1, 1970
0
Joerg said:
Hello Chris,


Huh? Which current? Which not just take a 74HC14 and use a nice large
resistor value in series with its input if you are afraid to fry
something? Although I am still puzzled about that frying process you
described ;-)

The transformer has a tapped winding. The first part of the winding is
connected to a linear power supply which provides the 5 V for the TTL.
The second part provides the 50 Hz signal which is to be counted. I'm
proposing to connect one end of the second part of the winding to the
Schmitt trigger input, and the other end to the lower TTL power rail.
Current could flow from the first part of the winding, through the
linear power supply, through the lower power rail, and back into the
second part of the winding. I think the circuit might still work if I
just connected one end of the second part of the transformer winding to
the Schmitt trigger input, and left the other end unconnected, but this
doesn't seem quite right as one end is left floating. Taking the signal
from one end of the winding only doesn't seem quite right.
The main issue here is a lowpass. After all, you don't want the spikes
from a starting vacuum cleaner to create a dozen pulses within one 60Hz
cycle.

This is exactly what I'm concerned about.

Many thanks,

Chris
 
C

Christopher Tidy

Jan 1, 1970
0
Keith said:
Use an optical isolator to connect to the line, even if there is an
isolation transformer inbetween.

Is this for safety reasons or to protect the logic? I just opened my
cheap Morphy Richards digital alarm clock and it seems to feed the 50 Hz
signal from the transformer directly into an LM8562 chip.
Depending on your clock circuit, it may be eaiser to do the
filtering in the digital domain. After the isolator turns on wait
1/119th of a second to look for it to go off, then 1/119th of a
second for it to turn back on...

I think I see what you mean. Once it has turned on, you wait a while
because you know that signals received during this period are irrelevant?

Chris
 
J

Joerg

Jan 1, 1970
0
Hello John,
Do your transformer thing into a CMOS schmitt trigger, but insert a
100K resistor in series, then a 22 nF cap to logic ground. That will
both limit schmitt input current and filter spikes.

That's pretty much how I have seen it done. Also, it is not necessary to
provide a "personal winding" to the Schmitt input (although it might
make the Schmitt feel really important, if Schmitts have feelings...).
Most of the time both sides of the transformer are used for power, for a
more efficient rectification. Then the 100K just goes to one winding
before the diode.

Regards, Joerg
 
J

Joerg

Jan 1, 1970
0
Hello Keith,
No, it simply works. Once an endge is sensed one ignores any more
for some time. If there are multiple edges, no one cares. If the
waveform is *really* distorted where the sensing is done may shift,
but it'll soon find an "edge", rather like a phase detector.

If you'd run it in a PLL fashion it can work. You'd have to because a
spooling motor might cause a phase that wanders a bit for quite a few
cycles. But wait until uncle Leroy pushes the button on his vintage
margarita blender, the one from the days when the letters EMI were
recognized as a record label :)
If it's a digital problem, stay digital. Unlike analog, digital
transistors are free.

Hmm, haven't seen many uCs under 20c and those were 4-bitters. Plus a
crystal, plus some house-keeping parts.

Let's see, in the analog world we'd need one Schmitt inverter. That's
about 1.5c. If you can't rent out the other five it'll be 9c. Then we
need a resistor to the tune of 1c and a cap for another cent.

Ok, the Schmitt is semi-digital unless you take a vacant opamp or
comparator.

Regards, Joerg
 
S

Spehro Pefhany

Jan 1, 1970
0
Hello John,


That's pretty much how I have seen it done. Also, it is not necessary to
provide a "personal winding" to the Schmitt input (although it might
make the Schmitt feel really important, if Schmitts have feelings...).
Most of the time both sides of the transformer are used for power, for a
more efficient rectification. Then the 100K just goes to one winding
before the diode.

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.


Best regards,
Spehro Pefhany
 
K

Keith

Jan 1, 1970
0
Hello Keith,


If you'd run it in a PLL fashion it can work. You'd have to because a
spooling motor might cause a phase that wanders a bit for quite a few
cycles. But wait until uncle Leroy pushes the button on his vintage
margarita blender, the one from the days when the letters EMI were
recognized as a record label :)

If it can be done in the analog domain it can also be done in the
digital domain, given a few billion transistors. ;-)
Hmm, haven't seen many uCs under 20c and those were 4-bitters. Plus a
crystal, plus some house-keeping parts.

The OP is building a _digital_ clock. He's already got the
*DIGITAL* part. Any additional transistors needed for a
(*digital*) filter are now free.
Let's see, in the analog world we'd need one Schmitt inverter. That's
about 1.5c. If you can't rent out the other five it'll be 9c. Then we
need a resistor to the tune of 1c and a cap for another cent.

Yow does your Schmitt inverter tell time? ;-)
Ok, the Schmitt is semi-digital unless you take a vacant opamp or
comparator.

It's still digital. ;-)
 
S

Spehro Pefhany

Jan 1, 1970
0
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

Show us a schematic of your power supply and we can show you how to do
it.


Best regards,
Spehro Pefhany
 
J

John Larkin

Jan 1, 1970
0
Thanks for the suggestion, John. This is a potential divider which acts
as a low pass filter, is that right? In this case, where should I
connect the second end of the transformer winding?

Like you said, to the logic common.

Do the component
values change if I use a TTL Schmitt trigger instead of CMOS?

Yes, and it gets trickier. Use cmos to avoid the complications.

John
 
J

Joerg

Jan 1, 1970
0
Hello Keith,
Yow does your Schmitt inverter tell time? ;-)

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

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.

Regards, Joerg
 
C

Christopher Tidy

Jan 1, 1970
0
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
 
C

Christopher Tidy

Jan 1, 1970
0
John said:
Do your transformer thing into a CMOS schmitt trigger, but insert a
100K resistor in series, then a 22 nF cap to logic ground. That will
both limit schmitt input current and filter spikes.

Thanks for the suggestion, John. This is a potential divider which acts
as a low pass filter, is that right? In this case, where should I
connect the second end of the transformer winding? Do the component
values change if I use a TTL Schmitt trigger instead of CMOS?

Many thanks,

Chris
 
C

Christopher Tidy

Jan 1, 1970
0
Spehro said:
Show us a schematic of your power supply and we can show you how to do
it.

Here's a schematic of the power supply I intend to use:
http://www.mythic-beasts.com/~cdt22/clock_circuit1.jpg

Note that it will be powering a mechanical clock dial which moves each
minute, not an LED display (perhaps I should have explained this at the
start). I'm concerned about connecting the lower power rail back to the
transformer winding - surely they won't be at the same voltage because
of the rectifier voltage drop?

Best wishes,

Chris
 
S

Spehro Pefhany

Jan 1, 1970
0
Here's a schematic of the power supply I intend to use:
http://www.mythic-beasts.com/~cdt22/clock_circuit1.jpg

Note that it will be powering a mechanical clock dial which moves each
minute, not an LED display (perhaps I should have explained this at the
start). I'm concerned about connecting the lower power rail back to the
transformer winding - surely they won't be at the same voltage because
of the rectifier voltage drop?

Best wishes,

Chris

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.



Best regards,
Spehro Pefhany
 
Top