Electronics-Related.com
Forums

Zero Cross Detection circuit for review

Started by Douglas Beeson June 10, 2014
Hello all,

I'm back again with an audio zero-cross detection circuit that I have desig=
ned based on valuable feedback from some of you (notably Jim Thompson and J=
ohn Fields). I am trying to gate an audio signal while avoiding clicks as i=
t switches on and off.

I'm submitting the LTSpice file here for your comments and also to ask why =
one thing does not seem to be working as intended:

The output from the two LM339 comparators seems to go all to hell once some=
 part of input frequency goes over 1000 Hz or so. It all works fine at lowe=
r frequencies, and if there is just one comparator instead of two (but I ne=
ed two to handle zeroes at rising and falling). I haven't built the actual =
circuit in real parts (lab is a bit of a mess at the moment), but LTSpice i=
s usually far wiser than me, so I must have a flaw in the logic somewhere!

Thanks for your comments and help.  =20

doug beeson=20

PS: Links for the referenced libraries are here:
https://dl.dropboxusercontent.com/u/2156133/lm324.lib
https://dl.dropboxusercontent.com/u/2156133/LM339.lib
https://dl.dropboxusercontent.com/u/2156133/PMV31XN.lib
https://dl.dropboxusercontent.com/u/2156133/PMV33UPE.lib


Version 4
SHEET 1 1752 2420
WIRE -384 208 -384 192
WIRE -224 256 -224 240
WIRE -112 256 -112 240
WIRE 0 256 0 240
WIRE -384 288 -384 208
WIRE -224 288 -224 256
WIRE -112 288 -112 256
WIRE 0 288 0 256
WIRE -384 448 -384 368
WIRE -224 448 -224 368
WIRE -224 448 -384 448
WIRE -112 448 -112 368
WIRE -112 448 -224 448
WIRE 0 448 0 368
WIRE 0 448 -112 448
WIRE -112 480 -112 448
WIRE 624 672 624 640
WIRE 976 704 976 672
WIRE 320 736 320 720
WIRE 320 784 320 736
WIRE 784 784 768 784
WIRE 880 784 784 784
WIRE 1088 784 1072 784
WIRE -384 800 -448 800
WIRE -240 800 -304 800
WIRE 112 800 64 800
WIRE 288 800 192 800
WIRE 416 816 352 816
WIRE 624 816 624 752
WIRE 624 816 496 816
WIRE 672 816 624 816
WIRE 880 816 672 816
WIRE 288 832 208 832
WIRE -368 896 -368 864
WIRE 320 896 320 848
WIRE -704 912 -720 912
WIRE -624 912 -704 912
WIRE -448 912 -448 800
WIRE -448 912 -544 912
WIRE -400 912 -448 912
WIRE 320 912 320 896
WIRE -240 928 -240 800
WIRE -240 928 -336 928
WIRE -192 928 -240 928
WIRE -48 928 -112 928
WIRE 48 928 -48 928
WIRE 208 928 208 832
WIRE 208 928 48 928
WIRE -400 944 -416 944
WIRE -48 976 -48 928
WIRE 48 976 48 928
WIRE -704 1008 -720 1008
WIRE -624 1008 -704 1008
WIRE -448 1008 -544 1008
WIRE -416 1008 -416 944
WIRE -416 1008 -448 1008
WIRE 320 1008 320 992
WIRE 976 1008 976 928
WIRE -368 1024 -368 960
WIRE 976 1024 976 1008
WIRE -448 1072 -448 1008
WIRE -48 1072 -48 1040
WIRE 48 1072 48 1056
WIRE 48 1072 -48 1072
WIRE 48 1088 48 1072
WIRE 320 1088 320 1008
WIRE 48 1104 48 1088
WIRE 208 1104 208 928
WIRE 288 1104 208 1104
WIRE 416 1120 352 1120
WIRE 560 1120 496 1120
WIRE 624 1120 624 816
WIRE 624 1120 560 1120
WIRE 288 1136 208 1136
WIRE 128 1168 128 1136
WIRE 624 1184 624 1120
WIRE -448 1200 -448 1152
WIRE 320 1200 320 1152
WIRE 320 1216 320 1200
WIRE 128 1264 128 1248
WIRE 208 1264 208 1136
WIRE 208 1264 128 1264
WIRE 128 1280 128 1264
WIRE 624 1360 624 1248
WIRE 128 1408 128 1360
WIRE -496 1552 -704 1552
WIRE 528 1552 -496 1552
WIRE 768 1552 528 1552
WIRE 768 1600 768 1552
WIRE 992 1616 928 1616
WIRE -32 1648 -32 1616
WIRE 528 1648 528 1552
WIRE 528 1648 384 1648
WIRE 656 1648 528 1648
WIRE 384 1664 384 1648
WIRE 656 1664 656 1648
WIRE 992 1664 992 1616
WIRE 272 1680 272 1632
WIRE 384 1680 384 1664
WIRE 768 1680 704 1680
WIRE 832 1680 768 1680
WIRE 928 1680 928 1616
WIRE 928 1680 912 1680
WIRE -32 1696 -32 1648
WIRE 272 1728 272 1680
WIRE 272 1728 192 1728
WIRE 336 1728 272 1728
WIRE -704 1744 -704 1552
WIRE 336 1744 336 1728
WIRE 944 1744 864 1744
WIRE 1024 1760 992 1760
WIRE -32 1824 -32 1776
WIRE 32 1824 -32 1824
WIRE 192 1824 192 1728
WIRE 192 1824 112 1824
WIRE 384 1824 384 1760
WIRE 656 1824 656 1760
WIRE 656 1824 384 1824
WIRE 1024 1824 1024 1760
WIRE 1024 1824 656 1824
WIRE 1168 1824 1024 1824
WIRE -32 1872 -32 1824
WIRE 1168 1872 1168 1824
WIRE -704 1888 -704 1824
WIRE 1024 1888 1024 1824
WIRE 1024 1888 992 1888
WIRE 384 1904 384 1824
WIRE 656 1904 656 1824
WIRE 944 1904 864 1904
WIRE -304 1920 -320 1920
WIRE -224 1920 -304 1920
WIRE -96 1920 -144 1920
WIRE 192 1920 192 1824
WIRE 272 1920 192 1920
WIRE 336 1920 272 1920
WIRE 768 1984 704 1984
WIRE 832 1984 768 1984
WIRE 928 1984 912 1984
WIRE -32 2000 -32 1968
WIRE 272 2000 272 1920
WIRE 528 2000 384 2000
WIRE 656 2000 528 2000
WIRE -32 2016 -32 2000
WIRE 272 2016 272 2000
WIRE 928 2032 928 1984
WIRE 992 2032 992 1984
WIRE 992 2032 928 2032
WIRE -704 2048 -704 1968
WIRE 528 2144 528 2000
WIRE 768 2144 768 2064
WIRE 768 2144 528 2144
WIRE 528 2224 528 2144
WIRE -704 2384 -704 2128
WIRE -512 2384 -704 2384
WIRE 528 2384 528 2304
WIRE 528 2384 -512 2384
FLAG -112 480 0
FLAG -112 256 9V
FLAG 0 256 -9V
FLAG 320 736 9V
FLAG 320 896 -9V
FLAG 672 816 OUT
FLAG -224 256 5V
FLAG 624 640 5V
FLAG 624 1360 0
FLAG 320 1008 9V
FLAG 320 1200 -9V
FLAG 560 1120 OUT
FLAG 128 1408 0
FLAG 128 1136 5V
FLAG 64 800 0
FLAG -368 864 9V
FLAG -368 1024 -9V
FLAG -448 1200 0
FLAG 1168 1872 0
FLAG 272 1680 B1
FLAG 272 2000 B2
FLAG 864 1744 B1
FLAG 864 1904 B2
FLAG 192 1824 155
FLAG -32 1648 9V
FLAG -32 2000 0
FLAG -496 1552 AC+
FLAG -512 2384 AC-
FLAG -704 912 AC+
FLAG -704 1008 AC-
FLAG 784 784 ucout
IOPIN 784 784 In
FLAG 976 672 0
FLAG 976 1008 CLR
FLAG -384 208 ucout
IOPIN -384 208 Out
FLAG -304 1920 GATE
IOPIN -304 1920 In
FLAG 1088 784 GATE
IOPIN 1088 784 Out
FLAG 48 1088 0
FLAG 528 2144 ACGATE
SYMBOL Comparators/LM339 320 816 R0
SYMATTR InstName U1
SYMBOL voltage -704 1728 R0
SYMATTR InstName V1
SYMATTR Value SINE(0 7 2 0.1 0 0 8)
SYMBOL voltage 0 272 R0
SYMATTR InstName V2
SYMATTR Value -9
SYMBOL voltage -112 272 R0
SYMATTR InstName V3
SYMATTR Value 9
SYMBOL res 608 656 R0
SYMATTR InstName R2
SYMATTR Value 7.5k
SYMBOL voltage -224 272 R0
SYMATTR InstName V4
SYMATTR Value 5
SYMBOL schottky 640 1248 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D2
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 512 800 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 1k
SYMBOL Comparators/LM339 320 1120 R0
SYMATTR InstName U2
SYMBOL res 512 1104 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R4
SYMATTR Value 1k
SYMBOL res 112 1152 R0
SYMATTR InstName R5
SYMATTR Value 511K
SYMBOL res 112 1264 R0
SYMATTR InstName R6
SYMATTR Value 511
SYMBOL ind 512 2208 R0
SYMATTR InstName L1
SYMATTR Value 0.7mH
SYMATTR SpiceLine Rser=3D5.5 Cpar=3D1nF
SYMBOL res -640 928 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R1
SYMATTR Value 1K
SYMBOL res -528 992 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R7
SYMATTR Value 1K
SYMBOL res -288 784 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 -26 0 VTop 2
SYMATTR InstName R8
SYMATTR Value 1K
SYMBOL Opamps/UniversalOpamp2 -368 928 R0
WINDOW 3 16 -10 Left 2
SYMATTR Value LM324
SYMATTR InstName U3
SYMATTR SpiceModel lm324
SYMBOL res -464 1056 R0
WINDOW 0 46 40 Left 2
SYMATTR InstName R9
SYMATTR Value 1K
SYMBOL nmos 336 1664 R0
SYMATTR InstName M1
SYMATTR Value PMV31XN
SYMATTR Prefix X
SYMBOL res 128 1808 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R10
SYMATTR Value 100
SYMBOL nmos 336 2000 M180
SYMATTR InstName M2
SYMATTR Value PMV31XN
SYMATTR Prefix X
SYMBOL res 752 1584 R0
SYMATTR InstName R11
SYMATTR Value 10k
SYMBOL res 752 1968 R0
SYMATTR InstName R12
SYMATTR Value 10k
SYMBOL res 928 1664 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R13
SYMATTR Value 100
SYMBOL res 928 1968 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R14
SYMATTR Value 100
SYMBOL nmos 944 1664 R0
SYMATTR InstName M3
SYMATTR Value PMV31XN
SYMATTR Prefix X
SYMBOL nmos 944 1984 M180
SYMATTR InstName M4
SYMATTR Value PMV31XN
SYMATTR Prefix X
SYMBOL pmos 704 1760 R180
SYMATTR InstName M5
SYMATTR Value PMV33UPE
SYMATTR Prefix X
SYMBOL pmos 704 1904 M0
SYMATTR InstName M6
SYMATTR Value PMV33UPE
SYMATTR Prefix X
SYMBOL npn -96 1872 R0
SYMATTR InstName Q1
SYMATTR Value 2N2222
SYMBOL res -128 1904 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 -26 0 VTop 2
SYMATTR InstName R15
SYMATTR Value 10K
SYMBOL res -16 1792 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R16
SYMATTR Value 1000
SYMBOL voltage -384 272 R0
WINDOW 3 -545 45 Left 2
SYMATTR Value PULSE(0 5 0.1 0.000001 0.000001 0.13 .79 5)
SYMATTR InstName V5
SYMBOL CD4000/cd4013b 976 704 R0
SYMATTR InstName U4
SYMBOL voltage -704 1872 R0
SYMATTR InstName V6
SYMATTR Value SINE(0 4 515 0.1 0 20 1000)
SYMBOL res 32 960 R0
SYMATTR InstName R17
SYMATTR Value 1k
SYMBOL res -96 912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 -26 0 VTop 2
SYMATTR InstName R18
SYMATTR Value 20K
SYMBOL voltage -704 2032 R0
SYMATTR InstName V7
SYMATTR Value SINE(0 3 800 0.5 0 5 2000)
SYMBOL schottky -32 1040 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D1
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 208 784 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R19
SYMATTR Value 511
TEXT -920 256 Left 2 !.tran 3 startup uic
TEXT 632 1520 Left 2 ;P-Channel
TEXT 376 1520 Left 2 ;N-Channel
TEXT 664 1656 Left 2 ;S
TEXT 664 1880 Left 2 ;D
TEXT 360 1648 Left 2 ;D
TEXT 360 1776 Left 2 ;S
TEXT 360 1872 Left 2 ;S
TEXT 664 1768 Left 2 ;D
TEXT 360 2008 Left 2 ;D
TEXT 664 2008 Left 2 ;S
TEXT 880 1520 Left 2 ;P-Channel driver
TEXT -928 384 Left 2 !.inc PMV31XN.lib
TEXT -928 424 Left 2 !.inc PMV33UPE.lib
TEXT -928 464 Left 2 !.inc lm324.lib
TEXT -1040 960 Left 2 ;ZCD and gate trigger
TEXT -1144 1600 Left 2 ;Audio and NPN-PNP gate circuit
TEXT -712 744 Left 2 ;unit gain difference amp
TEXT -184 840 Left 2 ;ensure V > -0.6
TEXT 688 1208 Left 2 ;clamp to GND
TEXT 712 608 Left 2 ;John Field=19s idea to use D-type flip flop for gate c=
ontrol
TEXT -632 136 Left 2 ;uController will signal gate ON/OFF but actual switch=
ing will be subject to ZCD.
TEXT -1304 2088 Left 2 ;*** ZCD output goes wonky when f > 1000Hz or so
TEXT 40 1256 Left 2 ;5 mV




--=20
Douglas Beeson <c.difficile@gmail.com>
On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson
<c.difficile@gmail.com> wrote:

>Hello all, > >I'm back again with an audio zero-cross detection circuit that I have designed based on valuable feedback from some of you (notably Jim Thompson and John Fields). I am trying to gate an audio signal while avoiding clicks as it switches on and off. > >I'm submitting the LTSpice file here for your comments and also to ask why one thing does not seem to be working as intended: > >The output from the two LM339 comparators seems to go all to hell once some part of input frequency goes over 1000 Hz or so. It all works fine at lower frequencies, and if there is just one comparator instead of two (but I need two to handle zeroes at rising and falling). I haven't built the actual circuit in real parts (lab is a bit of a mess at the moment), but LTSpice is usually far wiser than me, so I must have a flaw in the logic somewhere! > >Thanks for your comments and help. > >doug beeson > >PS: Links for the referenced libraries are here: >https://dl.dropboxusercontent.com/u/2156133/lm324.lib >https://dl.dropboxusercontent.com/u/2156133/LM339.lib >https://dl.dropboxusercontent.com/u/2156133/PMV31XN.lib >https://dl.dropboxusercontent.com/u/2156133/PMV33UPE.lib > > >Version 4 >SHEET 1 1752 2420 >WIRE -384 208 -384 192 >WIRE -224 256 -224 240 >WIRE -112 256 -112 240 >WIRE 0 256 0 240 >WIRE -384 288 -384 208 >WIRE -224 288 -224 256 >WIRE -112 288 -112 256 >WIRE 0 288 0 256 >WIRE -384 448 -384 368 >WIRE -224 448 -224 368 >WIRE -224 448 -384 448
[snip, full asc listing at...] [Message-Id:<20140610175714.c9fe263bc96a36dd90f7ef8b@gmail.com>]
>TEXT 712 608 Left 2 ;John Fields idea to use D-type flip flop for gate control >TEXT -632 136 Left 2 ;uController will signal gate ON/OFF but actual switching will be subject to ZCD. >TEXT -1304 2088 Left 2 ;*** ZCD output goes wonky when f > 1000Hz or so >TEXT 40 1256 Left 2 ;5 mV
Missing symbols: LM339, cd4013b. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Tue, 10 Jun 2014 16:59:15 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

>On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson ><c.difficile@gmail.com> wrote: > >>Hello all, >> >>I'm back again with an audio zero-cross detection circuit that I have designed based on valuable feedback from some of you (notably Jim Thompson and John Fields). I am trying to gate an audio signal while avoiding clicks as it switches on and off. >> >>I'm submitting the LTSpice file here for your comments and also to ask why one thing does not seem to be working as intended: >> >>The output from the two LM339 comparators seems to go all to hell once some part of input frequency goes over 1000 Hz or so. It all works fine at lower frequencies, and if there is just one comparator instead of two (but I need two to handle zeroes at rising and falling). I haven't built the actual circuit in real parts (lab is a bit of a mess at the moment), but LTSpice is usually far wiser than me, so I must have a flaw in the logic somewhere! >> >>Thanks for your comments and help. >> >>doug beeson >> >>PS: Links for the referenced libraries are here: >>https://dl.dropboxusercontent.com/u/2156133/lm324.lib >>https://dl.dropboxusercontent.com/u/2156133/LM339.lib >>https://dl.dropboxusercontent.com/u/2156133/PMV31XN.lib >>https://dl.dropboxusercontent.com/u/2156133/PMV33UPE.lib >> >> >>Version 4 >>SHEET 1 1752 2420 >>WIRE -384 208 -384 192 >>WIRE -224 256 -224 240 >>WIRE -112 256 -112 240 >>WIRE 0 256 0 240 >>WIRE -384 288 -384 208 >>WIRE -224 288 -224 256 >>WIRE -112 288 -112 256 >>WIRE 0 288 0 256 >>WIRE -384 448 -384 368 >>WIRE -224 448 -224 368 >>WIRE -224 448 -384 448 >[snip, full asc listing at...] >[Message-Id:<20140610175714.c9fe263bc96a36dd90f7ef8b@gmail.com>] >>TEXT 712 608 Left 2 ;John Fields idea to use D-type flip flop for gate control >>TEXT -632 136 Left 2 ;uController will signal gate ON/OFF but actual switching will be subject to ZCD. >>TEXT -1304 2088 Left 2 ;*** ZCD output goes wonky when f > 1000Hz or so >>TEXT 40 1256 Left 2 ;5 mV > >Missing symbols: LM339, cd4013b. > > ...Jim Thompson
Also, I'd guess you aren't getting fast enough risetime out of the LM339's ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Tuesday, June 10, 2014 5:57:14 PM UTC-4, Douglas Beeson wrote:
> Hello all, >=20 >=20 >=20 > I'm back again with an audio zero-cross detection circuit that I have des=
igned based on valuable feedback from some of you (notably Jim Thompson and= John Fields). I am trying to gate an audio signal while avoiding clicks as= it switches on and off.
>=20 >=20 >=20 > I'm submitting the LTSpice file here for your comments and also to ask wh=
y one thing does not seem to be working as intended:
>=20 >=20 >=20 > The output from the two LM339 comparators seems to go all to hell once so=
me part of input frequency goes over 1000 Hz or so. It all works fine at lo= wer frequencies, and if there is just one comparator instead of two (but I = need two to handle zeroes at rising and falling). I haven't built the actua= l circuit in real parts (lab is a bit of a mess at the moment), but LTSpice= is usually far wiser than me, so I must have a flaw in the logic somewhere= !
>=20 > Thanks for your comments and help. =20 >=20 > doug beeson=20 >=20
<big snip of circuit...I didn't look at it.> Did you put pull up resistors on the open collector output of the LM339? (a few k.) George H.
On Tue, 10 Jun 2014 16:59:15 -0700
Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

> On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson > <c.difficile@gmail.com> wrote: >=20 > >Hello all, > > > >I'm back again with an audio zero-cross detection circuit that I have de=
signed based on valuable feedback from some of you (notably Jim Thompson an= d John Fields). I am trying to gate an audio signal while avoiding clicks a= s it switches on and off.
> > > >I'm submitting the LTSpice file here for your comments and also to ask w=
hy one thing does not seem to be working as intended:
> > > >The output from the two LM339 comparators seems to go all to hell once s=
ome part of input frequency goes over 1000 Hz or so. It all works fine at l= ower frequencies, and if there is just one comparator instead of two (but I= need two to handle zeroes at rising and falling). I haven't built the actu= al circuit in real parts (lab is a bit of a mess at the moment), but LTSpic= e is usually far wiser than me, so I must have a flaw in the logic somewher= e!
> > > >Thanks for your comments and help. =20 > > > >doug beeson=20 > > > >PS: Links for the referenced libraries are here: > >https://dl.dropboxusercontent.com/u/2156133/lm324.lib > >https://dl.dropboxusercontent.com/u/2156133/LM339.lib > >https://dl.dropboxusercontent.com/u/2156133/PMV31XN.lib > >https://dl.dropboxusercontent.com/u/2156133/PMV33UPE.lib > > > > > >Version 4 > >SHEET 1 1752 2420 > >WIRE -384 208 -384 192 > >WIRE -224 256 -224 240 > >WIRE -112 256 -112 240 > >WIRE 0 256 0 240 > >WIRE -384 288 -384 208 > >WIRE -224 288 -224 256 > >WIRE -112 288 -112 256 > >WIRE 0 288 0 256 > >WIRE -384 448 -384 368 > >WIRE -224 448 -224 368 > >WIRE -224 448 -384 448 > [snip, full asc listing at...] > [Message-Id:<20140610175714.c9fe263bc96a36dd90f7ef8b@gmail.com>] > >TEXT 712 608 Left 2 ;John Field=19s idea to use D-type flip flop for gat=
e control
> >TEXT -632 136 Left 2 ;uController will signal gate ON/OFF but actual swi=
tching will be subject to ZCD.
> >TEXT -1304 2088 Left 2 ;*** ZCD output goes wonky when f > 1000Hz or so > >TEXT 40 1256 Left 2 ;5 mV >=20 > Missing symbols: LM339, cd4013b.
My apologies: https://dl.dropboxusercontent.com/u/2156133/cd4013b.asy https://dl.dropboxusercontent.com/u/2156133/LM339.asy
> =09 > ...Jim Thompson > --=20 > | James E.Thompson | mens | > | Analog Innovations | et | > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > | San Tan Valley, AZ 85142 Skype: skypeanalog | | > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > | E-mail Icon at http://www.analog-innovations.com | 1962 | > =20 > I love to cook with wine. Sometimes I even put it in the food.
--=20 Douglas Beeson <c.difficile@gmail.com>
On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson
<c.difficile@gmail.com> wrote:

>Hello all, > >I'm back again with an audio zero-cross detection circuit that I have designed based on valuable feedback from some of you (notably Jim Thompson and John Fields). I am trying to gate an audio signal while avoiding clicks as it switches on and off. > >I'm submitting the LTSpice file here for your comments and also to ask why one thing does not seem to be working as intended: > >The output from the two LM339 comparators seems to go all to hell once some part of input frequency goes over 1000 Hz or so. It all works fine at lower frequencies, and if there is just one comparator instead of two (but I need two to handle zeroes at rising and falling). I haven't built the actual circuit in real parts (lab is a bit of a mess at the moment), but LTSpice is usually far wiser than me, so I must have a flaw in the logic somewhere! > >Thanks for your comments and help. > >doug beeson
--- Doug, After the last go-round I worked on my circuit and got to rev. J (!) before I was happy with it, but didn't post anything because (as I recall) interest seemed to have waned. In any case, here's the file: Version 4 SHEET 1 1872 1348 WIRE 576 -16 576 -48 WIRE 880 64 880 -48 WIRE -784 112 -880 112 WIRE -144 112 -784 112 WIRE 576 112 576 64 WIRE 672 112 576 112 WIRE 816 112 752 112 WIRE 576 128 576 112 WIRE -784 160 -784 112 WIRE -144 160 -144 112 WIRE -144 160 -160 160 WIRE -160 176 -160 160 WIRE -144 176 -144 160 WIRE 0 176 -16 176 WIRE 352 176 192 176 WIRE 400 176 352 176 WIRE 512 176 480 176 WIRE -192 192 -240 192 WIRE 0 208 -128 208 WIRE -608 224 -640 224 WIRE -560 224 -608 224 WIRE -464 224 -464 192 WIRE -464 224 -496 224 WIRE -432 224 -464 224 WIRE -320 224 -352 224 WIRE -192 224 -320 224 WIRE 352 240 352 176 WIRE -1120 256 -1120 160 WIRE -1008 256 -1008 176 WIRE -880 256 -880 112 WIRE -640 256 -640 224 WIRE -176 256 -176 240 WIRE -160 256 -160 240 WIRE -160 256 -176 256 WIRE -144 256 -144 240 WIRE -144 256 -160 256 WIRE -784 272 -784 224 WIRE -752 272 -784 272 WIRE -16 272 -16 176 WIRE 1088 304 1088 240 WIRE -784 320 -784 272 WIRE -320 320 -320 224 WIRE -16 320 -16 272 WIRE -640 352 -640 336 WIRE 1040 384 992 384 WIRE -1120 416 -1120 336 WIRE -1088 416 -1120 416 WIRE 880 432 880 160 WIRE 992 432 992 384 WIRE 992 432 880 432 WIRE -640 448 -640 432 WIRE 1088 464 1088 400 WIRE 992 480 992 432 WIRE 1040 480 992 480 WIRE -1120 560 -1120 416 WIRE -1008 560 -1008 336 WIRE -1008 560 -1120 560 WIRE -880 560 -880 336 WIRE -880 560 -1008 560 WIRE -784 560 -784 400 WIRE -784 560 -880 560 WIRE -640 560 -640 528 WIRE -640 560 -784 560 WIRE -320 560 -320 400 WIRE -320 560 -640 560 WIRE -240 560 -240 192 WIRE -240 560 -320 560 WIRE -144 560 -144 256 WIRE -144 560 -240 560 WIRE -16 560 -16 400 WIRE -16 560 -144 560 WIRE 576 560 576 224 WIRE 576 560 -16 560 WIRE 1088 576 1088 560 WIRE 1120 576 1088 576 WIRE 576 608 576 560 WIRE 1088 608 1088 576 WIRE 352 656 352 320 WIRE 384 656 352 656 WIRE 512 656 464 656 WIRE 880 672 880 432 WIRE -1120 704 -1120 560 WIRE 576 720 576 704 WIRE 688 720 576 720 WIRE 816 720 768 720 WIRE 352 736 352 656 WIRE 1088 752 1088 688 WIRE 576 768 576 720 WIRE 880 864 880 768 WIRE 352 880 352 816 WIRE 576 880 576 848 FLAG -1120 704 0 FLAG -1088 416 0V FLAG 96 96 0V FLAG 96 320 MR FLAG -752 272 MR FLAG -16 272 ONOFF FLAG -464 192 AC FLAG -1120 160 12 FLAG -1008 176 -12 FLAG -608 224 ACIN FLAG 576 -48 12 FLAG 880 -48 12 FLAG 880 864 -12 FLAG 576 880 -12 FLAG 352 880 -12 FLAG 1088 240 AC FLAG 1120 576 ACOUT FLAG 1088 752 0 SYMBOL voltage -640 336 R0 WINDOW 0 38 56 Left 2 WINDOW 3 24 96 Invisible 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V3 SYMATTR Value SINE(0 2 349.23) SYMBOL voltage -880 240 R0 WINDOW 0 37 61 Left 2 WINDOW 3 22 99 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 5 SYMBOL cap -560 240 R270 WINDOW 0 32 32 VTop 2 WINDOW 3 0 32 VBottom 2 SYMATTR InstName C2 SYMATTR Value 10ku SYMBOL voltage -16 304 R0 WINDOW 0 38 56 Left 2 WINDOW 3 24 96 Invisible 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V4 SYMATTR Value PULSE(0 5 .1 100n 100n .4) SYMBOL CD4013B 96 96 R0 SYMATTR InstName U2 SYMBOL cap -800 160 R0 SYMATTR InstName C1 SYMATTR Value 10n SYMBOL res -800 304 R0 SYMATTR InstName R1 SYMATTR Value 10k SYMBOL res -336 208 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R2 SYMATTR Value 10k SYMBOL res -336 304 R0 SYMATTR InstName R3 SYMATTR Value 130 SYMBOL Comparators\\LT1719 -160 144 R0 SYMATTR InstName U1 SYMBOL voltage -640 240 R0 WINDOW 0 38 56 Left 2 WINDOW 3 24 96 Invisible 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value SINE(0 2 261.63) SYMBOL voltage -1120 240 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V5 SYMATTR Value 12 SYMBOL voltage -1008 240 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V6 SYMATTR Value -12 SYMBOL npn 512 128 R0 SYMATTR InstName Q3 SYMATTR Value 2N5089 SYMBOL res 496 160 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R9 SYMATTR Value 10k SYMBOL res 560 -32 R0 SYMATTR InstName R10 SYMATTR Value 1000 SYMBOL pnp 816 160 M180 WINDOW 0 67 32 Left 2 WINDOW 3 52 57 Left 2 SYMATTR InstName Q4 SYMATTR Value 2N5771 SYMBOL res 768 96 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R11 SYMATTR Value 1000 SYMBOL res 784 704 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R12 SYMATTR Value 1000 SYMBOL pnp 512 704 M180 WINDOW 0 67 32 Left 2 WINDOW 3 52 57 Left 2 SYMATTR InstName Q5 SYMATTR Value 2N5771 SYMBOL npn 816 672 R0 SYMATTR InstName Q6 SYMATTR Value 2N5089 SYMBOL res 560 752 R0 SYMATTR InstName R13 SYMATTR Value 1000 SYMBOL res 480 640 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R14 SYMATTR Value 1000 SYMBOL res 336 224 R0 SYMATTR InstName R15 SYMATTR Value 1000 SYMBOL res 336 720 R0 SYMATTR InstName R16 SYMATTR Value 4.7k SYMBOL nmos 1040 304 R0 SYMATTR InstName M1 SYMATTR Value BSC010NE2LSI SYMBOL res 1072 592 R0 SYMATTR InstName R4 SYMATTR Value 6 SYMBOL nmos 1040 560 M180 SYMATTR InstName M2 SYMATTR Value BSC010NE2LSI SYMBOL voltage -640 432 R0 WINDOW 0 38 56 Left 2 WINDOW 3 24 96 Invisible 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V7 SYMATTR Value SINE(0 2 392) TEXT -1104 592 Left 2 !.tran .6 startup uic TEXT -1104 616 Left 2 !.include CD4000.lib TEXT -1104 640 Left 2 !.model SW SW(Ron=.01 Roff=1G Vt=2.5 Vh=0) TEXT -304 600 Left 3 ;ZERO-CROSSING SWITCH, REV J TEXT -304 640 Left 3 ;John Fields, 17 May 2014 TEXT -1104 664 Left 2 !.wave C:\\sed\\spice\\zcd2revj.wav 8 44.1K V(acout) V2, V3, and V7 are just to see how the cicuit responds to a variable-frequency variable-amplitude input, and the output looks pretty good. Not the best FFT in the world, but not the worst, either... Also, to check the high freq response I changed ACIN to 20kHz, and as ONOFF went high and low, ACOUT got switched right at the zero crossings, as expected. ;) Just for grins, I had LTspice generate a .wav file so ACOUT could be listened to, and the switching transitions are nice and clean. One caveat: The LT1719 is in there because it has a common mode range which includes 100mV below the negative rail (ground, in this case) so substituting comparators which don't may be a bad idea.
On Tue, 10 Jun 2014 17:05:26 -0700
Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

> On Tue, 10 Jun 2014 16:59:15 -0700, Jim Thompson > <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote: >=20 > >On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson > ><c.difficile@gmail.com> wrote: > > > >>Hello all, > >> > >>I'm back again with an audio zero-cross detection circuit that I have d=
esigned based on valuable feedback from some of you (notably Jim Thompson a= nd John Fields). I am trying to gate an audio signal while avoiding clicks = as it switches on and off.
> >> > >>I'm submitting the LTSpice file here for your comments and also to ask =
why one thing does not seem to be working as intended:
> >> > >>The output from the two LM339 comparators seems to go all to hell once =
some part of input frequency goes over 1000 Hz or so. It all works fine at = lower frequencies, and if there is just one comparator instead of two (but = I need two to handle zeroes at rising and falling). I haven't built the act= ual circuit in real parts (lab is a bit of a mess at the moment), but LTSpi= ce is usually far wiser than me, so I must have a flaw in the logic somewhe= re!
> >> > >>Thanks for your comments and help. =20 > >> > >>doug beeson=20 > >> > >>PS: Links for the referenced libraries are here: > >>https://dl.dropboxusercontent.com/u/2156133/lm324.lib > >>https://dl.dropboxusercontent.com/u/2156133/LM339.lib > >>https://dl.dropboxusercontent.com/u/2156133/PMV31XN.lib > >>https://dl.dropboxusercontent.com/u/2156133/PMV33UPE.lib > >> > >> > >>Version 4 > >>SHEET 1 1752 2420 > >>WIRE -384 208 -384 192 > >>WIRE -224 256 -224 240 > >>WIRE -112 256 -112 240 > >>WIRE 0 256 0 240 > >>WIRE -384 288 -384 208 > >>WIRE -224 288 -224 256 > >>WIRE -112 288 -112 256 > >>WIRE 0 288 0 256 > >>WIRE -384 448 -384 368 > >>WIRE -224 448 -224 368 > >>WIRE -224 448 -384 448 > >[snip, full asc listing at...] > >[Message-Id:<20140610175714.c9fe263bc96a36dd90f7ef8b@gmail.com>] > >>TEXT 712 608 Left 2 ;John Field=19s idea to use D-type flip flop for ga=
te control
> >>TEXT -632 136 Left 2 ;uController will signal gate ON/OFF but actual sw=
itching will be subject to ZCD.
> >>TEXT -1304 2088 Left 2 ;*** ZCD output goes wonky when f > 1000Hz or so > >>TEXT 40 1256 Left 2 ;5 mV > > > >Missing symbols: LM339, cd4013b. > > =09 > > ...Jim Thompson >=20 > Also, I'd guess you aren't getting fast enough risetime out of the > LM339's
Oh, duh. I just went back and checked the datasheet. It states 0.75 us rise= time on 5mV overdrive. I am not familiar with the term "overdrive", but th= e graph seems to show a step input of that magnitude and the corresponding = rise time of the output. When I measure the non-truncated LM339 output in t= he spice simulation it gives me about 3 us rise. So way too slow to handle = a higher frequency input. Should I filter or just let the CD4013 ignore the transitions it doesn't se= e as valid?
> =09 > ...Jim Thompson > --=20 > | James E.Thompson | mens | > | Analog Innovations | et | > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > | San Tan Valley, AZ 85142 Skype: skypeanalog | | > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > | E-mail Icon at http://www.analog-innovations.com | 1962 | > =20 > I love to cook with wine. Sometimes I even put it in the food.
--=20 Douglas Beeson <c.difficile@gmail.com>
On Tue, 10 Jun 2014 17:53:54 -0700 (PDT)
George Herold <gherold@teachspin.com> wrote:

> On Tuesday, June 10, 2014 5:57:14 PM UTC-4, Douglas Beeson wrote: > > Hello all, > > > > > > > > I'm back again with an audio zero-cross detection circuit that I have designed based on valuable feedback from some of you (notably Jim Thompson and John Fields). I am trying to gate an audio signal while avoiding clicks as it switches on and off. > > > > > > > > I'm submitting the LTSpice file here for your comments and also to ask why one thing does not seem to be working as intended: > > > > > > > > The output from the two LM339 comparators seems to go all to hell once some part of input frequency goes over 1000 Hz or so. It all works fine at lower frequencies, and if there is just one comparator instead of two (but I need two to handle zeroes at rising and falling). I haven't built the actual circuit in real parts (lab is a bit of a mess at the moment), but LTSpice is usually far wiser than me, so I must have a flaw in the logic somewhere! > > > > Thanks for your comments and help. > > > > doug beeson > > > <big snip of circuit...I didn't look at it.> > Did you put pull up resistors on the open collector output of the LM339?
Yes, I have 7.5k pulling up to 5V. From the LM339 datasheet it looks like I am asking too much of the comparators to respond to 8kHz. Gotta decide whether to filter the input or ignore the bad outputs. Thanks~ doug
> (a few k.) > George H.
-- Douglas Beeson <c.difficile@gmail.com>
On Wed, 11 Jun 2014 01:51:35 -0500
John Fields <jfields@austininstruments.com> wrote:

> On Tue, 10 Jun 2014 17:57:14 -0400, Douglas Beeson > <c.difficile@gmail.com> wrote: > > >Hello all, > > > >I'm back again with an audio zero-cross detection circuit that I have designed based on valuable feedback from some of you (notably Jim Thompson and John Fields). I am trying to gate an audio signal while avoiding clicks as it switches on and off. > > > >I'm submitting the LTSpice file here for your comments and also to ask why one thing does not seem to be working as intended: > > > >The output from the two LM339 comparators seems to go all to hell once some part of input frequency goes over 1000 Hz or so. It all works fine at lower frequencies, and if there is just one comparator instead of two (but I need two to handle zeroes at rising and falling). I haven't built the actual circuit in real parts (lab is a bit of a mess at the moment), but LTSpice is usually far wiser than me, so I must have a flaw in the logic somewhere! > > > >Thanks for your comments and help. > > > >doug beeson > > --- > Doug, > > After the last go-round I worked on my circuit and got to rev. J (!) > before I was happy with it, but didn't post anything because (as I > recall) interest seemed to have waned.
Oh no, not at all! Your last circuits gave me so many ideas that I went off and played with them for a few weeks. I really, really appreciate your input. I'm just floored by all stuff I don't know about LTSpice and about making simple circuits that work. One of those Rumsfeld moments of not knowing what you don't know...
> > In any case, here's the file: > > Version 4 > SHEET 1 1872 1348 > WIRE 576 -16 576 -48 > WIRE 880 64 880 -48 > WIRE -784 112 -880 112 > WIRE -144 112 -784 112 > WIRE 576 112 576 64 > WIRE 672 112 576 112 > WIRE 816 112 752 112 > WIRE 576 128 576 112 > WIRE -784 160 -784 112 > WIRE -144 160 -144 112 > WIRE -144 160 -160 160 > WIRE -160 176 -160 160 > WIRE -144 176 -144 160 > WIRE 0 176 -16 176 > WIRE 352 176 192 176 > WIRE 400 176 352 176 > WIRE 512 176 480 176 > WIRE -192 192 -240 192 > WIRE 0 208 -128 208 > WIRE -608 224 -640 224 > WIRE -560 224 -608 224 > WIRE -464 224 -464 192 > WIRE -464 224 -496 224 > WIRE -432 224 -464 224 > WIRE -320 224 -352 224 > WIRE -192 224 -320 224 > WIRE 352 240 352 176 > WIRE -1120 256 -1120 160 > WIRE -1008 256 -1008 176 > WIRE -880 256 -880 112 > WIRE -640 256 -640 224 > WIRE -176 256 -176 240 > WIRE -160 256 -160 240 > WIRE -160 256 -176 256 > WIRE -144 256 -144 240 > WIRE -144 256 -160 256 > WIRE -784 272 -784 224 > WIRE -752 272 -784 272 > WIRE -16 272 -16 176 > WIRE 1088 304 1088 240 > WIRE -784 320 -784 272 > WIRE -320 320 -320 224 > WIRE -16 320 -16 272 > WIRE -640 352 -640 336 > WIRE 1040 384 992 384 > WIRE -1120 416 -1120 336 > WIRE -1088 416 -1120 416 > WIRE 880 432 880 160 > WIRE 992 432 992 384 > WIRE 992 432 880 432 > WIRE -640 448 -640 432 > WIRE 1088 464 1088 400 > WIRE 992 480 992 432 > WIRE 1040 480 992 480 > WIRE -1120 560 -1120 416 > WIRE -1008 560 -1008 336 > WIRE -1008 560 -1120 560 > WIRE -880 560 -880 336 > WIRE -880 560 -1008 560 > WIRE -784 560 -784 400 > WIRE -784 560 -880 560 > WIRE -640 560 -640 528 > WIRE -640 560 -784 560 > WIRE -320 560 -320 400 > WIRE -320 560 -640 560 > WIRE -240 560 -240 192 > WIRE -240 560 -320 560 > WIRE -144 560 -144 256 > WIRE -144 560 -240 560 > WIRE -16 560 -16 400 > WIRE -16 560 -144 560 > WIRE 576 560 576 224 > WIRE 576 560 -16 560 > WIRE 1088 576 1088 560 > WIRE 1120 576 1088 576 > WIRE 576 608 576 560 > WIRE 1088 608 1088 576 > WIRE 352 656 352 320 > WIRE 384 656 352 656 > WIRE 512 656 464 656 > WIRE 880 672 880 432 > WIRE -1120 704 -1120 560 > WIRE 576 720 576 704 > WIRE 688 720 576 720 > WIRE 816 720 768 720 > WIRE 352 736 352 656 > WIRE 1088 752 1088 688 > WIRE 576 768 576 720 > WIRE 880 864 880 768 > WIRE 352 880 352 816 > WIRE 576 880 576 848 > FLAG -1120 704 0 > FLAG -1088 416 0V > FLAG 96 96 0V > FLAG 96 320 MR > FLAG -752 272 MR > FLAG -16 272 ONOFF > FLAG -464 192 AC > FLAG -1120 160 12 > FLAG -1008 176 -12 > FLAG -608 224 ACIN > FLAG 576 -48 12 > FLAG 880 -48 12 > FLAG 880 864 -12 > FLAG 576 880 -12 > FLAG 352 880 -12 > FLAG 1088 240 AC > FLAG 1120 576 ACOUT > FLAG 1088 752 0 > SYMBOL voltage -640 336 R0 > WINDOW 0 38 56 Left 2 > WINDOW 3 24 96 Invisible 2 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V3 > SYMATTR Value SINE(0 2 349.23) > SYMBOL voltage -880 240 R0 > WINDOW 0 37 61 Left 2 > WINDOW 3 22 99 Left 2 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V1 > SYMATTR Value 5 > SYMBOL cap -560 240 R270 > WINDOW 0 32 32 VTop 2 > WINDOW 3 0 32 VBottom 2 > SYMATTR InstName C2 > SYMATTR Value 10ku > SYMBOL voltage -16 304 R0 > WINDOW 0 38 56 Left 2 > WINDOW 3 24 96 Invisible 2 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V4 > SYMATTR Value PULSE(0 5 .1 100n 100n .4) > SYMBOL CD4013B 96 96 R0 > SYMATTR InstName U2 > SYMBOL cap -800 160 R0 > SYMATTR InstName C1 > SYMATTR Value 10n > SYMBOL res -800 304 R0 > SYMATTR InstName R1 > SYMATTR Value 10k > SYMBOL res -336 208 R90 > WINDOW 0 0 56 VBottom 2 > WINDOW 3 32 56 VTop 2 > SYMATTR InstName R2 > SYMATTR Value 10k > SYMBOL res -336 304 R0 > SYMATTR InstName R3 > SYMATTR Value 130 > SYMBOL Comparators\\LT1719 -160 144 R0 > SYMATTR InstName U1 > SYMBOL voltage -640 240 R0 > WINDOW 0 38 56 Left 2 > WINDOW 3 24 96 Invisible 2 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V2 > SYMATTR Value SINE(0 2 261.63) > SYMBOL voltage -1120 240 R0 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V5 > SYMATTR Value 12 > SYMBOL voltage -1008 240 R0 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V6 > SYMATTR Value -12 > SYMBOL npn 512 128 R0 > SYMATTR InstName Q3 > SYMATTR Value 2N5089 > SYMBOL res 496 160 R90 > WINDOW 0 0 56 VBottom 2 > WINDOW 3 32 56 VTop 2 > SYMATTR InstName R9 > SYMATTR Value 10k > SYMBOL res 560 -32 R0 > SYMATTR InstName R10 > SYMATTR Value 1000 > SYMBOL pnp 816 160 M180 > WINDOW 0 67 32 Left 2 > WINDOW 3 52 57 Left 2 > SYMATTR InstName Q4 > SYMATTR Value 2N5771 > SYMBOL res 768 96 R90 > WINDOW 0 0 56 VBottom 2 > WINDOW 3 32 56 VTop 2 > SYMATTR InstName R11 > SYMATTR Value 1000 > SYMBOL res 784 704 R90 > WINDOW 0 0 56 VBottom 2 > WINDOW 3 32 56 VTop 2 > SYMATTR InstName R12 > SYMATTR Value 1000 > SYMBOL pnp 512 704 M180 > WINDOW 0 67 32 Left 2 > WINDOW 3 52 57 Left 2 > SYMATTR InstName Q5 > SYMATTR Value 2N5771 > SYMBOL npn 816 672 R0 > SYMATTR InstName Q6 > SYMATTR Value 2N5089 > SYMBOL res 560 752 R0 > SYMATTR InstName R13 > SYMATTR Value 1000 > SYMBOL res 480 640 R90 > WINDOW 0 0 56 VBottom 2 > WINDOW 3 32 56 VTop 2 > SYMATTR InstName R14 > SYMATTR Value 1000 > SYMBOL res 336 224 R0 > SYMATTR InstName R15 > SYMATTR Value 1000 > SYMBOL res 336 720 R0 > SYMATTR InstName R16 > SYMATTR Value 4.7k > SYMBOL nmos 1040 304 R0 > SYMATTR InstName M1 > SYMATTR Value BSC010NE2LSI > SYMBOL res 1072 592 R0 > SYMATTR InstName R4 > SYMATTR Value 6 > SYMBOL nmos 1040 560 M180 > SYMATTR InstName M2 > SYMATTR Value BSC010NE2LSI > SYMBOL voltage -640 432 R0 > WINDOW 0 38 56 Left 2 > WINDOW 3 24 96 Invisible 2 > WINDOW 123 0 0 Left 2 > WINDOW 39 0 0 Left 2 > SYMATTR InstName V7 > SYMATTR Value SINE(0 2 392) > TEXT -1104 592 Left 2 !.tran .6 startup uic > TEXT -1104 616 Left 2 !.include CD4000.lib > TEXT -1104 640 Left 2 !.model SW SW(Ron=.01 Roff=1G Vt=2.5 Vh=0) > TEXT -304 600 Left 3 ;ZERO-CROSSING SWITCH, REV J > TEXT -304 640 Left 3 ;John Fields, 17 May 2014 > TEXT -1104 664 Left 2 !.wave C:\\sed\\spice\\zcd2revj.wav 8 44.1K > V(acout) > > > V2, V3, and V7 are just to see how the cicuit responds to a > variable-frequency variable-amplitude input, and the output looks > pretty good. Not the best FFT in the world, but not the worst, > either... > > Also, to check the high freq response I changed ACIN to 20kHz, and > as ONOFF went high and low, ACOUT got switched right at the zero > crossings, as expected. ;)
That's where my slow LM339 solution is bombing out. I'm going to have to look into the LT1719.
> > Just for grins, I had LTspice generate a .wav file so ACOUT could be > listened to, and the switching transitions are nice and clean.
I never knew that was possible! I am also going to play with using a WAV file as input to a voltage source.
> > One caveat: The LT1719 is in there because it has a common mode > range which includes 100mV below the negative rail (ground, in this > case) so substituting comparators which don't may be a bad idea.
I'm a little confused by the term "common mode range". I always thought that "common mode" meant that part of a signal that was common to two inputs, say in a differential amplifier that is pulling 100mV signal differences out of two inputs that have a common 30V level. But seeing the LT1719 datasheet, and your comment here, it sounds like "common mode range" really just means the absolute value that the input signal can take without invalidating the device output. Thank you again for all your help, John. -- Douglas Beeson <c.difficile@gmail.com>
On Wed, 11 Jun 2014 12:49:38 -0400, Douglas Beeson
<c.difficile@gmail.com> wrote:


>I'm a little confused by the term "common mode range". I always thought that "common mode" meant that part of a signal that was common to two inputs, say in a differential amplifier that is pulling 100mV signal differences out of two inputs that have a common 30V level. But seeing the LT1719 datasheet, and your comment here, it sounds like "common mode range" really just means the absolute value that the input signal can take without invalidating the device output.
--- Kinda. What the common mode range is is the limits between which the inputs must stay in order for the device to work within its spec's. For example, if a single-supply device is powered with +5V on Vcc and 0V on Vss and its input common-mode range spec is from Vcc-1V to Vss +1V, then the inputs must stay between 4V and 1V when a comparison is being made. On some comparators, though, once the comparison has been made and the output has settled, the inputs may move out of the common-mode region without affecting the output. That's only _some_ comparators, however, and if that kind of operation is necessary, then CYA is in order and the data sheet or, better yet, the manufacturer needs to be consulted. ---
>Thank you again for all your help, John.
--- My pleasure. :-) John Fields