[sci.electronics] 1Hz signals

rzh@lll-lcc.llnl.gov (Roger Hanscom) (10/13/88)

   This question should be really easy for you guys!  I do OK with
digital stuff, but most things in the analog domain are "mysteries
of the universe".  I'm building a TTL digital counter, and I need a
1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
power transformer, and a MINIMUM of components to condition it and
divide it down.  The transformer I'm using is nominally a 9v
wall-plug type.  How can I convert that to some thing I can work
with (read reduce the ~20v p-p to something like 5v p-p).  I know
how to divide it with TTL, if I could just make the AC more well
behaved to feed it to TTL.  I tried a 4566 IC like this (working
from memory here, pls forgive lapses):

                               o---o
                               |   |
                        ---------------------
                        |      14  2      16|--Vcc (5v)
  60Hz o----100K--o--o--|15?                |
		  |  |  |          CD4566   |
		  |  |  |    2,8,?          |
		  C  Z  ---------------------
		  |  |         |       C is 1Mfd 25v tant.
     G  <|--------o--o---------|       Z is 5.1v, 1w zener

but both the 10Hz and 1Hz outputs of the 4566 are dead.  Should
Vcc be closer to the p-p voltage of the 60Hz signal?? How can I
reduce the p-p voltage on the 60Hz signal??  Is there a better
way?  Comments appreciated.
Roger
<------------>
   {ucbvax,ames,lll-crg,....}!lll-lcc!freedom!rzh
   or {ucbvax,ames,lll-crg,....}!lll-lcc!rzh
   or rzh%freedom.llnl.gov@lll-lcc.llnl.gov

henry@utzoo.uucp (Henry Spencer) (10/15/88)

In article <2006@lll-lcc.llnl.gov> rzh@lll-lcc.llnl.gov (Roger Hanscom) writes:
>...I'm building a TTL digital counter, and I need a
>1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
>power transformer, and a MINIMUM of components to condition it and
>divide it down.  The transformer I'm using is nominally a 9v
>wall-plug type.  How can I convert that to some thing I can work
>with (read reduce the ~20v p-p to something like 5v p-p)...

What I'd probably try is like this:

                                     |\
        ---->|-R--o-----o------------|+\
                  |     v            |  \
                  R     |      +5V   |   >-------------
                  |     v       R    |  /
                  o-----o       o----|-/
                  |             v    |/
              	ground----------o

where the "v"s and the thing on the input are diodes (1N4148), the Rs are
resistors of maybe, oh, 10k, and the op amp is a 3130.  The first diode
rectifies the input, the first R current-limits it, the pair of diodes
clips it to 1.2V, and the parallel R pulls it down to zero when the input
diode is in cutoff on the reverse cycle.  The op-amp is run as a comparator,
comparing a voltage fixed at one diode drop above ground (on the - input)
to one that's either two diodes above ground or zero.  Presto, a CMOS-level
square wave.  Note also that the clipping diodes protect things against
spikes and such -- the AC line is a noisy place and the transformer will
pass much of the crud through.  If you want a TTL square wave, use a
different op-amp, maybe an LM324.  Either way, you should probably run
the signal to a Schmitt trigger, since the rise and fall times will
probably be a bit slow for normal digital inputs.

There are probably more elegant ways.  I'm not really at home with this
analog stuff...  Improvements and corrections welcome.
-- 
The meek can have the Earth;    |    Henry Spencer at U of Toronto Zoology
the rest of us have other plans.|uunet!attcan!utzoo!henry henry@zoo.toronto.edu

sukenick@ccnysci.UUCP (SYG) (10/16/88)

In article <2006@lll-lcc.llnl.gov> rzh@lll-lcc.llnl.gov (Roger Hanscom) writes:
>...I'm building a TTL digital counter, and I need a
>1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
>power transformer, and a MINIMUM of components to condition it and

How about this:

Take the signal, limit it, schmitt trigger it, then pull it out -

all you need is one chip, a couple of diodes, resistors and a cap.  :

a) resistor series with input;

b) 5.1V zener between signal and ground ( to clamp to ttl levels when +;
   clamp to  -.7v when negative.  resistor a) limits current)

c) This is input to one input of an inverter in a  74..132  Schmitt trigger.
   There are 4 nand gates in the ..132.
   Now you have a relatively clean 60 Hz signal.

d) set up a one shot with the remaining gates with cap/resistors/diode
   (perhaps one diode, two resistors, one or two caps)
   such that it will stay on for 59.5 cycles (when the one shot
   is on, block the input pulses by feeding the output back to
   the second input of the first gate).

   If there is too much jitter in the timing, you may have to
   set the one shot for a shorter time and then add a divider -
   but then  the parts count goes up.

   If the duty cycle is not acceptable, then you can feed the output into
   another gate set up as a one shot.

dale (Dale Wlasitz) (10/17/88)

>......I'd like to use the 60Hz signal on the
>power transformer, and a MINIMUM of components to condition it and
>divide it down. 
>....

Since you are using the 4566 you're off and running! Just before we
get to that point though an easy method (cheap too) to isolate, drop
voltages etc and get a nice clean sharp edged signal as input to the 
4566 is as follows:

	1. Use an opto-isolator tied to your signal source. The bias
	   for the diode can be checked from your spec. books. On the
	   output tie the collector with a pullup to your +5v or
	   whatever your interface circuitry runs on.

	2. Square it up! use the output off the collector of the opto
	   as input to a 4093 or similar schmitt device to create nice
	   squared edges.

	3. Drive this to your 4566 and your off!!


It's only a couple of parts.........

Dale

Oh sorry, I've used Motorola opto's with the greatest of success,
that's not to say the HP or other brands are not as good or better.
The Motorola publication is #DL118R1.

jimc@iscuva.ISCS.COM (Jim Cathey) (10/17/88)

In article <2006@lll-lcc.llnl.gov> rzh@lll-lcc.llnl.gov (Roger Hanscom) writes:
>...I'm building a TTL digital counter, and I need a
>1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
>power transformer, and a MINIMUM of components to condition it and

The power line is a noisy place, and grunge on it will screw up your timing
if it's for anything critical.  Just clipping the raw line is not the best
thing to do.  I saw a design idea in a magazine once that addressed this
problem.  What he did was to design a simple 60 Hz RC-Schmitt trigger
oscillator that was synchronized to the line with a high-value resistor.
The power line only had a limited effect on the oscillator -- high-frequency
junk couldn't sway this oscillator very much.  A rather simple bandpass filter
combined with the output conditioning circuit all in one neat circuit!  
Unfortunately I can no longer find the article, but the circuit itself used 
about a half-dozen components.  

+----------------+
! II      CCCCCC !  Jim Cathey
! II  SSSSCC     !  ISC Systems Corp.
! II      CC     !  TAF-C8;  Spokane, WA  99220
! IISSSS  CC     !  UUCP: uunet!iscuva!jimc
! II      CCCCCC !  (509) 927-5757
+----------------+
			"With excitement like this, who is needing enemas?"

strong@tc.fluke.COM (Norm Strong) (10/19/88)

}In article <2006@lll-lcc.llnl.gov> rzh@lll-lcc.llnl.gov (Roger Hanscom) writes:
}>...I'm building a TTL digital counter, and I need a
}>1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
}>power transformer, and a MINIMUM of components to condition it and

This is your lucky day, Roger Hanscom.  The semiconductor industry has read
your mind and made an IC just for you!  It's called the 74LS57, and contains a
trigger, divide by 6, divide by 5 and divide by 2, all in one 8-pin package.

If you move to England, use the 74LS56, which divides by 50.
-- 

Norm   (strong@tc.fluke.com)

steve@ivucsb.UUCP (Steve Lemke <steve>) (10/20/88)

In article <2006@lll-lcc.llnl.gov> rzh@lll-lcc.llnl.gov (Roger Hanscom) writes:
}
}   This question should be really easy for you guys!  I do OK with
}digital stuff, but most things in the analog domain are "mysteries
}of the universe".  I'm building a TTL digital counter, and I need a
}1Hz pulse train to feed it.  I'd like to use the 60Hz signal on the
}power transformer, and a MINIMUM of components to condition it and
}divide it down.  The transformer I'm using is nominally a 9v
}wall-plug type.  How can I convert that to some thing I can work
}with (read reduce the ~20v p-p to something like 5v p-p).  I know
}how to divide it with TTL, if I could just make the AC more well
}behaved to feed it to TTL.  I tried a 4566 IC like this (working
}from memory here, pls forgive lapses):

Wouldn't it be easier to just use a simple, two (or three?) component RC
network to generate your pulse train?  Actually, now that I think about
it, perhaps it takes a Schmidt Trigger or something like that - but I do
remember building a circuit like that to generate a stream of TTL level
pulses for a class project last year.  If you're interested, I can look it
up and send you (email, usenet, or USPS) the circuit.

 
----- Steve Lemke ------------------- "MS-DOS (OS/2, etc.) - just say no!"
----- Internet: steve@ivucsb.UUCP; lemke@apple.COM   AppleLink:  LEMKE
----- uucp:     pyramid!comdesign!ivucsb!steve       CompuServe: 73627,570
----- alt.uucp: {decwrl!}sun!apple!lemke             GEnie:      S.Lemke
----- Quote:    "What'd I go to college for?"   "You had fun, didn't you?"

henry@utzoo.uucp (Henry Spencer) (10/23/88)

In article <2080@iscuva.ISCS.COM> jimc@iscuva.ISCS.COM (Jim Cathey) writes:
>The power line is a noisy place, and grunge on it will screw up your timing
>if it's for anything critical.  Just clipping the raw line is not the best
>thing to do...

Very true.  The diodes-and-opamp circuit I posted will probably have this
problem.  I finally dug out the circuit I used a couple of years ago when
I had to deal with this issue.  It's a bit more complex.  It is meant to
work off the raw 110V AC, but shouldn't be too hard to modify for a low-
voltage transformer output.  I won't try to draw this one -- drawing with
ASCII is too much of a hassle.

We start with two input lines carrying the AC, and work from left to right.
First, 100k resistor from the top line down to a 1N4148 diode pointing
up, the bottom of which is on the lower line.  Then a 68k resistor in the
top line.  Then, down from the top line, a 100k resistor leading to the
collector of a 2N3904 transistor, with emitter on the lower line and base
connected to the top of the 1N4148.  Then, 0.1uF across the two lines.
(I assume everyone realizes that this should be rated for at least 200V.)
Finally, the top line runs down into the LED of a 4N27 optoisolator,
pointing down, then through a 1.5k resistor, then through a 2N5062 (small
SCR) pointing down, to the lower line.  The gate input of the 2N5062 is
connected to the 2N3904 collector.

On the other side of the 4N27, the base is unconnected (and you might want
to clip the lead off to minimize noise pickup).  The emitter is grounded.
The output is from the collector, with a 10k pullup to +5.  It's probably
wise to put a 0.1uF bypass capacitor between +5 and ground nearby.  The
output is TTL and CMOS compatible, is thoroughly isolated from the AC, and
produces one low-going pulse per downward zero-crossing of the AC line.
The pulse trailing edge is pretty sloppy, but the leading edge is fairly
sharp; however, "fairly sharp" probably isn't good enough for a normal
digital input, so best use a Schmitt to clean it up.

How does it work?  The series 68k resistor makes the voltage on the 0.1uF
lag behind the AC line, so it's still 30-40V as the top line falls past
zero.  (All voltages with respect to the lower line.)  The 2N3904, which
is on when the top line is positive, turns off.  The second 100k pulls
the SCR's gate electrode up, and the SCR fires, dumping the charge on the
capacitor through the optoisolator.  The 1.5k limits the current.  I'm
not sure of the exact purpose of the 1N4148, but it may be to protect the
transistor when the top line goes negative.  (Digital logic I understand,
and op amps I can usually puzzle out, but these #@#%$# transistors are
still a mystery to me at times.)

The advantage of this circuit is that it's essentially noiseproof.  For
one thing, noise isn't common precisely at the zero crossing.  More
important, this circuit is guaranteed to give only one pulse per cycle,
because once the SCR has fired, it can't do it again until the next cycle
has recharged the capacitor.

I used this as the AC-line sensor for a fancy digitally-controlled dimmer.
It worked fine.

Credits:  this appeared in the 27 May 1981 issue of Electronics, contributed
by Peter Lefferts of Versatec.
-- 
The meek can have the Earth;    |    Henry Spencer at U of Toronto Zoology
the rest of us have other plans.|uunet!attcan!utzoo!henry henry@zoo.toronto.edu