Looking for two-input comparator with hysteresis

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...
--
  Keith
Reply to
Keith
Loading thread data ...

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

Reply to
Christopher Tidy

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

formatting link

Reply to
Joerg

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

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

Regards, Joerg

formatting link

Reply to
Joerg

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

Reply to
John Larkin

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 it's a digital problem, stay digital. Unlike analog, digital transistors are free.

--
  Keith
Reply to
Keith

Both. But when people ask these sorts of questions I'm primarily worried about them, rather than some magic smoke.

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.

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.

--
  Keith
Reply to
Keith

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.

This is exactly what I'm concerned about.

Many thanks,

Chris

Reply to
Christopher Tidy

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.

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

Reply to
Christopher Tidy

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.

Regards, Joerg

formatting link

Reply to
Joerg

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

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

formatting link

Reply to
Joerg

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

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

If it can be done in the analog domain it can also be done in the digital domain, given a few billion transistors. ;-)

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.

Yow does your Schmitt inverter tell time? ;-)

It's still digital. ;-)

--
  Keith
Reply to
Keith

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

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Like you said, to the logic common.

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

John

Reply to
John Larkin

Hello Keith,

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

formatting link

Reply to
Joerg

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

Reply to
Christopher Tidy

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

Reply to
Christopher Tidy

Here's a schematic of the power supply I intend to use:

formatting link

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

Reply to
Christopher Tidy

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

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

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.