Maker Pro
Maker Pro

Simple audio encoding... how?

M

MooseFET

Jan 1, 1970
0
---
Maybe even better, since it gets rid of the peak detector!

The down side I see, in hardware, is the need for 16 bit adders to do
the integration for an 8 bit input.

You don't need real 16 bit adders because the ADC is much slower than
HC logic. You can use a serial adder.

Another idea would be to have a 20MHz clock and a 20KHz saw tooth.
Any time the voltage is greater than the sawtooth, the counter is
enabled. By using a somewhat perverted sort of ADC, you get the
summing action with just counting. It is only good to about 10 bits
on the ADC but perhaps that is enough.
Here's what I've got so far:

news:[email protected]

Unfortunately I can't deal with the URL. Perhaps if I wasn't so lazy
I would have a real news reader, but if a sled had wheels it would be
a wagon too.
I did it in 4 bits instead of 8 because I thought that would make it
simpler but, in actuality, doing it in 8 ( using an HC688 for the
magnitude comparator, a couple of HC273's for the input latches, an
HC40103 for the counter and a single HC175 instead of the HC74's) would
have resulted in one less chip.

If I get ambitious I'll redraw it... :)

Did someone already say "use a PIC" yet?. This sort of thing would be
falling off a log simple with something like Cygnal F120 processor.
You could sample the ADC at 40KHz and use one of the DACs to make the
output pulses. With just some lightning protection and a 3.3V
regulator, the who thing would be done.
 
M

MooseFET

Jan 1, 1970
0
---
Geez, where's the fun in that? ;)

Besides I seem to recall the OP (who seems to have dropped off the face
of the earth) asked for a hardware solution.

I find myself losing interest now that the problem appears to be not
all that hard to solve. If I had to do it with all hardware, I would
look at the ramp ADC method I suggested elsewhere but it has too many
parts in it even at that.

Was there some reason that analog oneshot like circuits got
abandoned? It seems like they would do what the OP wanted well
enough.
 
M

MooseFET

Jan 1, 1970
0
I don't have a complete one but I did sketch out the high points.

The trickiest part seems to be making an integrator with a reset that
has a very low offset voltage. There are conflicting requirements on
the op-amp involved.

Low bias current and fast together usually means a JFET but the low
offset suggests a bipolar.

Basically this part started out looking like this:


---/\/\---O O----------------------
^ HC4053 1/3 !
! !
+----------!!------------+
! C1 !
--!-\ !
! >------------------+---- To Amplitude
GND---!+/ Sample and hold


Instead of having to put a sample and hold circuit on the amplitude, I
came up with the idea of making more than one of the integrators. I
settled on a total of four such circuits. They take turns like this:

A - running up
B - Holding while we make this pulse
C - Resetting down to zero
D - Settling

I was looking at a 5uF film capacitor as C1. 10V means full amplitude
at 20Hz so:

I(C1) = 5uF * 20 * 10 = 1mA

This is a reasonable output current for an op-amp.
 
M

MooseFET

Jan 1, 1970
0
See below:
My schematic is at:


and since you get abse I've emailed you a copy as well.

I'm not sure we're on the same page since, after querying the OP and
finding out that what he wanted was a circuit which would output a pulse
with a width proportional to the amplitude of an input sine wave, I
posted a circuit which would do that regardless of (well, there is a
high-frequency limit) the frequency of the input signal, on a
cycle-by-cycle basis.

I was aiming at a duty cycle that depended on the amplitude and not a
pulse width that did so.


A comparator that looks like this:


R1 R2 C1
GND ---/\/\---+---/\/\--!!--
! !
-!+\ !
! >--------+--- "IsLow"
Signal ---------!-/
!
GND



The R1 and R2 are picked based on how much HF noise there is on the
signal. C1 makes a time constant that is short enough that the
comparator switches very near zero volts for the intended signal.

The IsLow signal goes to three places. One is the 4053 section here:


Signal
---+----/\/\-----+-----/\/\---------
! ! !
! --!-\ !
O ! >------------+--- Rectified
<--------------!+/
O HC4053
!
GND

One other place the IsLow goes is to a counter that divides by 4.
This counter via logic gates does the sequencing on the analog
switches in the 4 resetable integrators.

The switches in the integrators reset the integrator half the time,
cause it to integrate up 1/4th the time and hold steady for 1/4th the
time. This means that two 4053 sections are needed per integrator.


The third place IsLow goes is to a one-shotting circuit that resets a
ramp generator once per cycle.

The ramp is compared to whichever integrator is holding the voltage
and this comparison becomes the output.


I hope that is clear enough for you to follow. It is a bit complex
but I think it gets the job done.
 
M

MooseFET

Jan 1, 1970
0
Spice biffs every time I put the comparitor in but you'll get the
idea.

I'm sure it is more complex than needs be

Version 4
SHEET 1 11172 2756
WIRE 2448 -2864 2112 -2864
WIRE 2112 -2816 2112 -2864
WIRE 2064 -2800 2032 -2800
WIRE 2064 -2752 2000 -2752
WIRE 1728 -2672 1696 -2672
WIRE 2112 -2672 2112 -2736
WIRE 2112 -2672 1808 -2672
WIRE 2112 -2640 2112 -2672
WIRE 2256 -2640 2112 -2640
WIRE 2448 -2640 2448 -2864
WIRE 2448 -2640 2320 -2640
WIRE 1792 -2608 1792 -2624
WIRE 1840 -2608 1792 -2608
WIRE 2448 -2576 2448 -2640
WIRE 2976 -2576 2448 -2576
WIRE 1744 -2560 1744 -2624
WIRE 2272 -2496 2272 -2512
WIRE 2112 -2480 2112 -2640
WIRE 2240 -2480 2112 -2480
WIRE 2448 -2464 2448 -2576
WIRE 2448 -2464 2304 -2464
WIRE 2240 -2448 2224 -2448
WIRE 2272 -2400 2272 -2432
WIRE 2976 -2064 2976 -2576
WIRE 3440 -2064 2976 -2064
WIRE 3712 -2064 3520 -2064
WIRE 2480 -2016 2144 -2016
WIRE 3504 -2000 3504 -2016
WIRE 3552 -2000 3504 -2000
WIRE 2144 -1968 2144 -2016
WIRE 2096 -1952 2064 -1952
WIRE 3456 -1952 3456 -2016
WIRE 2096 -1904 2032 -1904
WIRE 1696 -1824 1696 -2672
WIRE 1760 -1824 1696 -1824
WIRE 2144 -1824 2144 -1888
WIRE 2144 -1824 1840 -1824
WIRE 2144 -1792 2144 -1824
WIRE 2288 -1792 2144 -1792
WIRE 2480 -1792 2480 -2016
WIRE 2480 -1792 2352 -1792
WIRE 2640 -1792 2480 -1792
WIRE 2640 -1776 2640 -1792
WIRE 3440 -1776 2640 -1776
WIRE 3712 -1776 3712 -2064
WIRE 3712 -1776 3520 -1776
WIRE 1824 -1760 1824 -1776
WIRE 1872 -1760 1824 -1760
WIRE 1776 -1712 1776 -1776
WIRE 3504 -1712 3504 -1728
WIRE 3552 -1712 3504 -1712
WIRE 3456 -1664 3456 -1728
WIRE 2304 -1648 2304 -1664
WIRE 2144 -1632 2144 -1792
WIRE 2272 -1632 2144 -1632
WIRE 2480 -1616 2480 -1792
WIRE 2480 -1616 2336 -1616
WIRE 2272 -1600 2256 -1600
WIRE 2304 -1552 2304 -1584
WIRE 3456 -1488 3040 -1488
WIRE 3712 -1488 3712 -1776
WIRE 3712 -1488 3536 -1488
WIRE 3712 -1472 3712 -1488
WIRE 3840 -1472 3712 -1472
WIRE 4624 -1472 3840 -1472
WIRE 3520 -1424 3520 -1440
WIRE 3568 -1424 3520 -1424
WIRE 3472 -1376 3472 -1440
WIRE 3840 -1360 3840 -1472
WIRE 2480 -1280 2144 -1280
WIRE 3040 -1280 3040 -1488
WIRE 3040 -1280 2480 -1280
WIRE 3840 -1248 3840 -1280
WIRE 2144 -1232 2144 -1280
WIRE 2096 -1216 2064 -1216
WIRE 3456 -1184 3088 -1184
WIRE 3712 -1184 3712 -1472
WIRE 3712 -1184 3536 -1184
WIRE 2096 -1168 2032 -1168
WIRE 3520 -1120 3520 -1136
WIRE 3568 -1120 3520 -1120
WIRE 1696 -1088 1696 -1824
WIRE 1760 -1088 1696 -1088
WIRE 2144 -1088 2144 -1152
WIRE 2144 -1088 1840 -1088
WIRE 3472 -1072 3472 -1136
WIRE 2144 -1056 2144 -1088
WIRE 2288 -1056 2144 -1056
WIRE 2480 -1056 2480 -1280
WIRE 2480 -1056 2352 -1056
WIRE 1824 -1024 1824 -1040
WIRE 1872 -1024 1824 -1024
WIRE 1776 -976 1776 -1040
WIRE 2304 -912 2304 -928
WIRE 2144 -896 2144 -1056
WIRE 2272 -896 2144 -896
WIRE 2480 -880 2480 -1056
WIRE 2480 -880 2336 -880
WIRE 2272 -864 2256 -864
WIRE 2304 -816 2304 -848
WIRE 2512 -432 2176 -432
WIRE 3088 -432 3088 -1184
WIRE 3088 -432 2512 -432
WIRE 2176 -384 2176 -432
WIRE 2128 -368 2096 -368
WIRE 2128 -320 2064 -320
WIRE 5504 -288 5504 -304
WIRE 928 -272 768 -272
WIRE 976 -272 928 -272
WIRE 1136 -272 1056 -272
WIRE 1200 -272 1136 -272
WIRE 1296 -272 1280 -272
WIRE 1296 -240 1296 -272
WIRE 1472 -240 1296 -240
WIRE 1696 -240 1696 -1088
WIRE 1696 -240 1552 -240
WIRE 1792 -240 1696 -240
WIRE 2176 -240 2176 -304
WIRE 2176 -240 1872 -240
WIRE 5360 -224 5360 -288
WIRE 2176 -208 2176 -240
WIRE 2320 -208 2176 -208
WIRE 2512 -208 2512 -432
WIRE 2512 -208 2384 -208
WIRE 5328 -192 4912 -192
WIRE 1856 -176 1856 -192
WIRE 1904 -176 1856 -176
WIRE 5504 -176 5504 -208
WIRE 5504 -176 5408 -176
WIRE 5648 -176 5504 -176
WIRE 928 -160 928 -272
WIRE 4624 -160 4624 -1472
WIRE 5328 -160 4624 -160
WIRE 880 -144 848 -144
WIRE 1184 -128 1184 -144
WIRE 1808 -128 1808 -192
WIRE 1136 -112 1136 -272
WIRE 1152 -112 1136 -112
WIRE 5360 -112 5360 -128
WIRE 5440 -112 5360 -112
WIRE 880 -96 656 -96
WIRE 1296 -96 1296 -240
WIRE 1296 -96 1216 -96
WIRE 5344 -96 5344 -128
WIRE 5376 -96 5376 -128
WIRE 5376 -96 5344 -96
WIRE 1104 -80 928 -80
WIRE 1152 -80 1104 -80
WIRE 5344 -80 5344 -96
WIRE 2336 -64 2336 -80
WIRE 928 -48 928 -80
WIRE 2176 -48 2176 -208
WIRE 2304 -48 2176 -48
WIRE 880 -32 848 -32
WIRE 1184 -32 1184 -64
WIRE 2512 -32 2512 -208
WIRE 2512 -32 2368 -32
WIRE 2304 -16 2288 -16
WIRE 1104 0 1104 -80
WIRE 656 16 656 -96
WIRE 752 16 656 16
WIRE 880 16 816 16
WIRE 2336 32 2336 0
WIRE 928 48 928 32
WIRE -384 64 -384 48
WIRE 32 64 0 64
WIRE 32 80 32 64
WIRE 0 112 -112 112
WIRE 144 112 80 112
WIRE 176 112 144 112
WIRE 288 112 256 112
WIRE 384 112 384 80
WIRE 384 112 288 112
WIRE 544 112 384 112
WIRE 656 112 656 16
WIRE 656 112 544 112
WIRE 1104 112 1104 80
WIRE 288 128 288 112
WIRE 0 144 -64 144
WIRE -384 160 -384 144
WIRE 32 192 32 176
WIRE 48 192 48 176
WIRE 48 192 32 192
WIRE 640 192 592 192
WIRE 736 192 640 192
WIRE 992 192 816 192
WIRE 16 208 16 176
WIRE 16 208 0 208
WIRE 48 224 48 192
WIRE 288 224 288 192
WIRE 1088 224 1040 224
WIRE 1200 224 1168 224
WIRE 1328 224 1200 224
WIRE 592 240 592 192
WIRE 4016 272 3888 272
WIRE -144 304 -192 304
WIRE -64 304 -64 144
WIRE 0 304 -64 304
WIRE 144 304 144 112
WIRE 144 304 80 304
WIRE -448 320 -448 304
WIRE -368 320 -368 304
WIRE 640 320 640 192
WIRE 688 320 640 320
WIRE 928 320 848 320
WIRE 1040 320 1040 224
WIRE 1040 320 928 320
WIRE 1200 320 1200 288
WIRE 592 336 592 304
WIRE 3888 336 3888 272
WIRE 4576 336 4400 336
WIRE 4912 336 4912 -192
WIRE 4912 336 4576 336
WIRE 4016 352 4016 272
WIRE 544 368 544 112
WIRE 688 368 544 368
WIRE 1088 368 864 368
WIRE 1200 368 1168 368
WIRE 1344 368 1344 304
WIRE 1344 368 1200 368
WIRE -448 416 -448 400
WIRE -368 416 -368 400
WIRE 1200 464 1200 432
WIRE 4480 480 4480 464
WIRE 640 496 608 496
WIRE 720 496 640 496
WIRE 928 496 928 320
WIRE 928 496 800 496
WIRE 4400 496 4400 336
WIRE 4448 496 4400 496
WIRE 4576 512 4576 336
WIRE 4576 512 4512 512
WIRE 608 528 608 496
WIRE 4016 528 4016 432
WIRE 4272 528 4016 528
WIRE 4448 528 4352 528
WIRE 1072 544 944 544
WIRE 1184 544 1152 544
WIRE 1376 544 1184 544
WIRE 4016 560 4016 528
WIRE 4016 560 3952 560
WIRE 4096 560 4016 560
WIRE 4480 592 4480 544
WIRE 640 608 640 496
WIRE 688 608 640 608
WIRE 944 608 944 544
WIRE 944 608 848 608
WIRE 3952 608 3952 560
WIRE 608 624 608 592
WIRE 4096 624 4096 560
WIRE 1184 640 1184 608
WIRE 1392 640 1392 512
WIRE 1680 640 1392 640
WIRE 544 656 544 368
WIRE 688 656 544 656
WIRE 992 656 992 192
WIRE 992 656 864 656
WIRE 1840 656 1744 656
WIRE 3696 656 3632 656
WIRE 3840 656 3776 656
WIRE 3888 656 3840 656
WIRE 992 688 992 656
WIRE 1072 688 992 688
WIRE 1184 688 1152 688
WIRE 1392 688 1392 640
WIRE 1392 688 1184 688
WIRE 1344 704 1344 368
WIRE 1680 704 1344 704
WIRE 2944 720 2848 720
WIRE 3408 720 2944 720
WIRE 3632 720 3632 656
WIRE 3952 720 3952 704
WIRE 4096 720 4096 688
WIRE 1328 736 1328 224
WIRE 1680 736 1328 736
WIRE 3584 736 3472 736
WIRE 1840 752 1744 752
WIRE 1184 784 1184 752
WIRE 2944 784 2944 720
WIRE 2992 784 2944 784
WIRE 3120 784 3056 784
WIRE 3264 784 3200 784
WIRE 3408 784 3264 784
WIRE 3584 784 3552 784
WIRE 1392 800 1392 688
WIRE 1680 800 1392 800
WIRE 3264 816 3264 784
WIRE 3552 816 3552 784
WIRE 1328 832 1328 736
WIRE 1680 832 1328 832
WIRE 3632 832 3632 800
WIRE 1840 848 1744 848
WIRE 1376 896 1376 544
WIRE 1680 896 1376 896
WIRE 3264 912 3264 880
WIRE 1344 928 1344 704
WIRE 1680 928 1344 928
WIRE 1840 944 1744 944
WIRE 1376 992 1376 896
WIRE 1680 992 1376 992
WIRE 3728 1056 3664 1056
WIRE 3840 1056 3840 656
WIRE 3840 1056 3808 1056
WIRE 1376 1072 1376 992
WIRE 1872 1072 1376 1072
WIRE 3664 1072 3664 1056
WIRE 1344 1120 1344 928
WIRE 1872 1120 1344 1120
WIRE 1392 1168 1392 800
WIRE 1872 1168 1392 1168
WIRE 3664 1168 3664 1152
WIRE 1328 1216 1328 832
WIRE 1872 1216 1328 1216
WIRE 1328 1376 1328 1216
WIRE 1344 1376 1344 1120
WIRE 1376 1376 1376 1072
WIRE 1392 1376 1392 1168
FLAG -384 160 0
FLAG -384 48 signal
FLAG 48 224 0
FLAG 0 64 vcc
FLAG -112 112 signal
FLAG 0 208 vee
FLAG -192 304 0
FLAG -448 416 0
FLAG -368 416 0
FLAG -448 304 vcc
FLAG -368 304 vee
FLAG 384 80 IsNeg
FLAG 768 -272 signal
FLAG 848 -144 0
FLAG 848 -32 0
FLAG 928 48 0
FLAG 1184 -144 vcc
FLAG 1184 -32 vee
FLAG 608 624 0
FLAG 592 336 0
FLAG 2272 -2512 vcc
FLAG 2272 -2400 vee
FLAG 2224 -2448 0
FLAG 1744 -2560 0
FLAG 2032 -2800 0
FLAG 1840 656 state0
FLAG 1840 752 state1
FLAG 1840 848 state2
FLAG 1840 944 state3
FLAG 1872 1072 dis0
FLAG 1872 1120 dis1
FLAG 1872 1168 dis2
FLAG 1872 1216 dis3
FLAG 1840 -2608 state0
FLAG 2000 -2752 dis0
FLAG 2304 -1664 vcc
FLAG 2304 -1552 vee
FLAG 2256 -1600 0
FLAG 1776 -1712 0
FLAG 2064 -1952 0
FLAG 1872 -1760 state1
FLAG 2032 -1904 dis1
FLAG 2304 -928 vcc
FLAG 2304 -816 vee
FLAG 2256 -864 0
FLAG 1776 -976 0
FLAG 2064 -1216 0
FLAG 1872 -1024 state2
FLAG 2032 -1168 dis2
FLAG 2336 -80 vcc
FLAG 2336 32 vee
FLAG 2288 -16 0
FLAG 1808 -128 0
FLAG 2096 -368 0
FLAG 1904 -176 state3
FLAG 2064 -320 dis3
FLAG 1104 112 0
FLAG 3456 -1952 0
FLAG 3552 -2000 state1
FLAG 3472 -1072 0
FLAG 3568 -1120 state0
FLAG 3456 -1664 0
FLAG 3552 -1712 state2
FLAG 3472 -1376 0
FLAG 3568 -1424 state3
FLAG 3840 -1248 0
FLAG 288 224 0
FLAG 1200 464 0
FLAG 1200 320 0
FLAG 1184 784 0
FLAG 1184 640 0
FLAG 3264 912 0
FLAG 2848 720 IsNeg
FLAG 3952 720 0
FLAG 4096 720 0
FLAG 3552 816 0
FLAG 3632 832 0
FLAG 3888 336 0
FLAG 3664 1168 0
FLAG 4480 464 vcc
FLAG 4480 592 vee
FLAG 5360 -288 vcc
FLAG 5344 -80 0
FLAG 5440 -112 vee
FLAG 5504 -304 vcc
FLAG 5648 -176 PWMout
SYMBOL voltage -384 48 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value SINE(0 1 100)
SYMBOL Comparators\\LT1116 32 64 R0
SYMATTR InstName U1
SYMBOL res -48 288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL res 96 288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL voltage -448 304 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 5
SYMBOL voltage -368 304 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value -5
SYMBOL res 1072 -288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R3
SYMATTR Value 5k
SYMBOL res 1296 -288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R4
SYMATTR Value 5k
SYMBOL sw 928 -176 R0
SYMATTR InstName S1
SYMATTR Value SW1
SYMBOL sw 928 -64 R0
SYMATTR InstName S2
SYMATTR Value SW1
SYMBOL Digital\\dflop 768 272 R0
SYMATTR InstName A2
SYMBOL Digital\\dflop 768 560 R0
SYMATTR InstName A3
SYMBOL cap 576 240 R0
SYMATTR InstName C2
SYMATTR Value 10p
SYMBOL cap 592 528 R0
SYMATTR InstName C3
SYMATTR Value 10p
SYMBOL res 832 176 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R6
SYMATTR Value 100
SYMBOL res 816 480 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R7
SYMATTR Value 100
SYMBOL cap 2320 -2656 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C6
SYMATTR Value 5�
SYMBOL sw 1712 -2672 R270
SYMATTR InstName S9
SYMATTR Value SW1
SYMBOL sw 2112 -2832 R0
SYMATTR InstName S10
SYMATTR Value SW1
SYMBOL Digital\\and 1712 608 R0
SYMATTR InstName A4
SYMBOL Digital\\and 1712 704 R0
SYMATTR InstName A5
SYMBOL Digital\\and 1712 800 R0
SYMATTR InstName A6
SYMBOL Digital\\and 1712 896 R0
SYMATTR InstName A7
SYMBOL cap 2352 -1808 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C1
SYMATTR Value 5�
SYMBOL sw 1744 -1824 R270
SYMATTR InstName S3
SYMATTR Value SW1
SYMBOL sw 2144 -1984 R0
SYMATTR InstName S4
SYMATTR Value SW1
SYMBOL cap 2352 -1072 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C4
SYMATTR Value 5�
SYMBOL sw 1744 -1088 R270
SYMATTR InstName S5
SYMATTR Value SW1
SYMBOL sw 2144 -1248 R0
SYMATTR InstName S6
SYMATTR Value SW1
SYMBOL res 1568 -256 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R9
SYMATTR Value 1k
SYMBOL cap 2384 -224 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C5
SYMATTR Value 5�
SYMBOL sw 1776 -240 R270
SYMATTR InstName S7
SYMATTR Value SW1
SYMBOL sw 2176 -400 R0
SYMATTR InstName S8
SYMATTR Value SW1
SYMBOL Opamps\\LT1882 2272 -2464 R0
SYMATTR InstName U3
SYMBOL Opamps\\LT1882 2304 -1616 R0
SYMATTR InstName U4
SYMBOL Opamps\\LT1882 2304 -880 R0
SYMATTR InstName U5
SYMBOL Opamps\\LT1882 2336 -32 R0
SYMATTR InstName U6
SYMBOL res 1088 -16 R0
SYMATTR InstName R13
SYMATTR Value 10
SYMBOL Opamps\\LT1037 1184 -160 R0
SYMATTR InstName U2
SYMBOL Digital\\inv 752 -48 R0
SYMATTR InstName A1
SYMBOL sw 3424 -2064 R270
SYMATTR InstName S11
SYMATTR Value SW1
SYMBOL sw 3440 -1184 R270
SYMATTR InstName S12
SYMATTR Value SW1
SYMBOL sw 3424 -1776 R270
SYMATTR InstName S13
SYMATTR Value SW1
SYMBOL sw 3440 -1488 R270
SYMATTR InstName S14
SYMATTR Value SW1
SYMBOL res 3824 -1376 R0
SYMATTR InstName R14
SYMATTR Value 10e9
SYMBOL res 272 96 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R5
SYMATTR Value 220
SYMBOL cap 272 128 R0
SYMATTR InstName C7
SYMATTR Value 2p
SYMBOL res 1184 352 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R8
SYMATTR Value 22
SYMBOL cap 1184 368 R0
SYMATTR InstName C8
SYMATTR Value 1p
SYMBOL res 1184 208 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R10
SYMATTR Value 22
SYMBOL cap 1184 224 R0
SYMATTR InstName C9
SYMATTR Value 1p
SYMBOL res 1168 672 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R11
SYMATTR Value 22
SYMBOL cap 1168 688 R0
SYMATTR InstName C10
SYMATTR Value 1p
SYMBOL res 1168 528 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R12
SYMATTR Value 22
SYMBOL cap 1168 544 R0
SYMATTR InstName C11
SYMATTR Value 1p
SYMBOL Digital\\inv 2992 720 R0
SYMATTR InstName A8
SYMBOL Digital\\and 3440 688 R0
SYMATTR InstName A9
SYMBOL cap 3248 816 R0
SYMATTR InstName C12
SYMATTR Value 4.7n
SYMBOL res 3216 768 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R15
SYMATTR Value 10k
SYMBOL res 3792 640 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R16
SYMATTR Value 1k
SYMBOL npn 3888 608 R0
SYMATTR InstName Q1
SYMATTR Value 2N3904
SYMBOL cap 4080 624 R0
SYMATTR InstName C13
SYMATTR Value 0.47�
SYMBOL e 3632 704 R0
SYMATTR InstName E1
SYMATTR Value 5
SYMBOL current 4016 352 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName I1
SYMATTR Value 0.1e-3
SYMBOL res 3824 1040 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R17
SYMATTR Value 1k
SYMBOL voltage 3664 1056 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value PULSE(5 0 10u 1u)
SYMBOL Opamps\\LT1880 4480 512 R0
SYMATTR InstName U7
SYMBOL res 4368 512 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R18
SYMATTR Value 10k
SYMBOL res 5488 -304 R0
SYMATTR InstName R19
SYMATTR Value 10k
TEXT -248 600 Left 0 !.model sw1 sw(VT=0.5)
TEXT -482 620 Left 0 !.tran 0.1
TEXT 5240 -232 Left 0 ;compare
RECTANGLE Normal -640 2752 -800 2640
RECTANGLE Normal 11168 -4048 11008 -4160
 
J

Jasen Betts

Jan 1, 1970
0
Spice biffs every time I put the comparitor in but you'll get the
idea.

it seems LTs chips like to have the inputs at close volages
(max difference 0.6 or 1.2 v)
I'm sure it is more complex than needs be

and less complex. using voltage controlled switches is cheating!
real parts only.

I've been playing with (a simulation) of a simpler (and less capable)
version but had problems with max differential input, bias current,
and oscillations. (and a glitch on rising zero crossing)

this was my starting point:

.-------------+---->|--[R]-.
| | |
| |\ | |\ |
`--|-\ +----|-\ | |\
| >--->|--+ | >----+-| >O-- out
in---+--|+/ | .-|+/ |/
| |/ === | |/ -+-
| | | |
| -+- +5 /// | [1K]
| |\| +-----'
`--|-\ |/
| >---[1k]-|
.--|+/ |>
| |/| |
| -+- -5 /// gnd
///

this circuit has max output duty cycle of 50%
only measures the amplitide of the positive half-cycle
and is only approximately linear (but R could be replaced with a
better current source)

if I can find some ideal op-amps and comparitors
and install a flip-flop (or delay line?) to squash the
glitch it might even work!
 
M

MooseFET

Jan 1, 1970
0
it seems LTs chips like to have the inputs at close volages
(max difference 0.6 or 1.2 v)

Many of the op-amps have diodes across the inputs.
and less complex. using voltage controlled switches is cheating!
real parts only.

The real parts are HC4053s. I have an only partial model of them.
The supply voltages are +/- 5V so that the switches can be used.

I've been playing with (a simulation) of a simpler (and less capable)
version but had problems with max differential input, bias current,
and oscillations. (and a glitch on rising zero crossing)

this was my starting point:

          .-------------+---->|--[R]-.
          |             |            |
          |  |\         |    |\      |
          `--|-\        +----|-\     | |\
             |  >--->|--+    |  >----+-| >O-- out
     in---+--|+/        |  .-|+/       |/  
          |  |/        === | |/ -+-
          |             |  |     |
          |   -+- +5   /// |    [1K]
          |  |\|           +-----'
          `--|-\         |/      
             |  >---[1k]-|        
          .--|+/         |>
          |  |/|           |
          |   -+- -5      /// gnd
         ///              

 this circuit has max output duty cycle of 50%
 only measures the amplitide of the positive half-cycle
 and is only approximately linear (but R could be replaced with a
 better current source)

 if I can find some ideal op-amps and comparitors
 and install a flip-flop (or delay line?) to squash the
 glitch it might even work!

There is a trick to doing the op-amp and diode rectifiers. You want
to keep the op-amp from flying to the rails on the other half cycle.
In real life, op-amps tend to take a long time to recover from being
crashed against the rails.
 
J

Jasen Betts

Jan 1, 1970
0
Spice biffs every time I put the comparitor in but you'll get the
idea.

it seems LTs chips like to have the inputs at close volages
(max difference 0.6 or 1.2 v)

Many of the op-amps have diodes across the inputs.
I'm sure it is more complex than needs be

and less complex. using voltage controlled switches is cheating!
real parts only.

The real parts are HC4053s. I have an only partial model of them.
The supply voltages are +/- 5V so that the switches can be used.

I've been playing with (a simulation) of a simpler (and less capable)
version but had problems with max differential input, bias current,
and oscillations. (and a glitch on rising zero crossing)

this was my starting point:

          .-------------+---->|--[R]-.
          |             |            |
          |  |\         |    |\      |
          `--|-\        +----|-\     | |\
             |  >--->|--+    |  >----+-| >O-- out
     in---+--|+/        |  .-|+/       |/  
          |  |/        === | |/ -+-
          |             |  |     |
          |   -+- +5   /// |    [1K]
          |  |\|           +-----'
          `--|-\         |/      
             |  >---[1k]-|        
          .--|+/         |>
          |  |/|           |
          |   -+- -5      /// gnd
         ///              

 this circuit has max output duty cycle of 50%
 only measures the amplitide of the positive half-cycle
 and is only approximately linear (but R could be replaced with a
 better current source

that's right...

It's more parts than the above ascii but it seems to work.

Version 4
SHEET 1 1176 680
WIRE -336 -272 -352 -272
WIRE -320 -272 -336 -272
WIRE 416 -272 240 -272
WIRE 576 -272 480 -272
WIRE 720 -272 656 -272
WIRE -336 -256 -336 -272
WIRE -240 -256 -288 -256
WIRE 112 -192 -128 -192
WIRE 128 -192 112 -192
WIRE 144 -192 128 -192
WIRE 272 -192 208 -192
WIRE 400 -192 272 -192
WIRE 656 -192 640 -192
WIRE 720 -192 720 -272
WIRE -336 -176 -368 -176
WIRE -288 -176 -288 -256
WIRE -288 -176 -336 -176
WIRE -368 -160 -368 -176
WIRE -240 -160 -240 -176
WIRE -240 -160 -256 -160
WIRE -224 -160 -240 -160
WIRE 16 -160 -16 -160
WIRE 112 -160 112 -192
WIRE 112 -160 80 -160
WIRE 112 -128 112 -160
WIRE -176 -112 -304 -112
WIRE -80 -112 -80 -160
WIRE 336 -112 320 -112
WIRE 352 -112 336 -112
WIRE 576 -112 576 -192
WIRE 592 -112 576 -112
WIRE 720 -112 720 -192
WIRE 992 -112 896 -112
WIRE 336 -96 336 -112
WIRE 272 -80 272 -192
WIRE 304 -80 272 -80
WIRE -240 -64 -256 -64
WIRE -224 -64 -240 -64
WIRE -64 -64 -80 -64
WIRE -48 -64 -64 -64
WIRE 400 -64 400 -192
WIRE 400 -64 368 -64
WIRE 448 -64 400 -64
WIRE 576 -64 576 -112
WIRE 576 -64 528 -64
WIRE 624 -64 608 -64
WIRE 640 -64 624 -64
WIRE 896 -64 896 -112
WIRE 992 -64 992 -112
WIRE -240 -48 -240 -64
WIRE -64 -48 -64 -64
WIRE 240 -48 240 -272
WIRE 304 -48 240 -48
WIRE 624 -48 624 -64
WIRE -304 -32 -304 -112
WIRE -272 -32 -304 -32
WIRE -128 -32 -128 -192
WIRE -96 -32 -128 -32
WIRE 576 -32 576 -64
WIRE 592 -32 576 -32
WIRE -176 -16 -176 -112
WIRE -176 -16 -208 -16
WIRE -144 -16 -176 -16
WIRE -16 -16 -16 -112
WIRE -16 -16 -32 -16
WIRE 48 -16 -16 -16
WIRE 112 -16 112 -48
WIRE 336 -16 336 -32
WIRE 336 -16 320 -16
WIRE 352 -16 336 -16
WIRE 720 -16 720 -112
WIRE 720 -16 656 -16
WIRE 832 -16 800 -16
WIRE -352 0 -512 0
WIRE -272 0 -352 0
WIRE -144 0 -144 -16
WIRE -96 0 -144 0
WIRE 592 0 576 0
WIRE 448 16 416 16
WIRE 576 16 576 0
WIRE 576 16 528 16
WIRE -512 32 -512 0
WIRE -240 32 -240 16
WIRE -240 32 -256 32
WIRE -224 32 -240 32
WIRE -64 32 -64 16
WIRE -64 32 -80 32
WIRE -48 32 -64 32
WIRE 240 64 240 -48
WIRE 272 64 240 64
WIRE 896 64 896 32
WIRE 1040 64 896 64
WIRE -16 80 -16 -16
WIRE 0 80 -16 80
WIRE 80 80 64 80
WIRE 240 80 240 64
WIRE 240 80 160 80
WIRE 896 80 896 64
WIRE -352 96 -352 0
WIRE 240 96 240 80
WIRE 624 112 624 16
WIRE 768 112 624 112
WIRE 624 144 624 112
WIRE 624 144 608 144
WIRE 640 144 624 144
WIRE -512 160 -512 112
WIRE 240 192 240 160
WIRE 544 192 528 192
WIRE 560 192 544 192
WIRE 768 192 768 112
WIRE 896 192 896 160
WIRE 896 192 768 192
WIRE -352 208 -352 176
WIRE -96 208 -352 208
WIRE -16 208 -32 208
WIRE 0 208 -16 208
WIRE 416 208 416 16
WIRE 416 208 400 208
WIRE 448 208 416 208
WIRE 544 208 544 192
WIRE 544 208 528 208
WIRE -16 224 -16 208
WIRE 400 224 400 208
WIRE -96 240 -96 208
WIRE -48 240 -96 240
WIRE 64 256 64 240
WIRE 64 256 16 256
WIRE 416 256 416 208
WIRE 640 256 416 256
WIRE -160 272 -208 272
WIRE -64 272 -80 272
WIRE -48 272 -64 272
WIRE 64 272 64 256
WIRE 96 272 64 272
WIRE 336 272 176 272
WIRE 640 272 640 256
WIRE -208 304 -208 272
WIRE -16 304 -16 288
WIRE -16 304 -32 304
WIRE 0 304 -16 304
WIRE -64 384 -64 272
WIRE -48 384 -64 384
WIRE 64 384 64 272
WIRE 64 384 32 384
WIRE 400 384 400 320
WIRE 640 496 640 464
FLAG -64 -64 vcc
FLAG 624 -64 vcc
FLAG -512 160 0
FLAG -336 -272 vcc
FLAG -368 -160 0
FLAG -240 -160 vee
FLAG -64 32 vee
FLAG 624 144 vee
FLAG 240 192 0
FLAG -16 208 vcc
FLAG -16 304 vee
FLAG -208 304 0
FLAG 400 384 0
FLAG 544 192 vcc
FLAG -240 -64 vcc
FLAG -240 32 vee
FLAG 640 496 0
FLAG 336 -112 vcc
FLAG 336 -16 vee
FLAG 272 64 cap
FLAG 992 -64 0
FLAG 1040 64 out
SYMBOL Opamps\\LT1097 -64 -80 R0
SYMATTR InstName U1
SYMBOL Opamps\\LT1097 624 -80 R0
SYMATTR InstName U2
SYMBOL Misc\\battery -240 -272 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 5v
SYMBOL voltage -512 16 R0
WINDOW 3 -189 100 Left 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 .2 2000)
SYMATTR InstName V2
SYMBOL Misc\\battery -336 -272 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 5v
SYMBOL cap 224 96 R0
SYMATTR InstName C2
SYMATTR Value 1µf
SYMBOL diode 48 0 R270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName D1
SYMATTR Value 1N914
SYMBOL Opamps\\LT1097 -16 192 R0
SYMATTR InstName U3
SYMBOL res -368 80 R0
SYMATTR InstName R2
SYMATTR Value 100k
SYMBOL diode 416 -256 R270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName D2
SYMATTR Value 1N914
SYMBOL res 672 -288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R3
SYMATTR Value 1K
SYMBOL res -64 256 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R4
SYMATTR Value 100
SYMBOL res 48 368 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R5
SYMATTR Value 100meg
SYMBOL npn 336 224 R0
WINDOW 3 56 60 Left 0
SYMATTR Value 2N2222
SYMATTR InstName Q1
SYMBOL res 544 192 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R6
SYMATTR Value 1K
SYMBOL res 816 -32 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R7
SYMATTR Value 1k
SYMBOL Opamps\\LT1097 -240 -80 R0
SYMATTR InstName U4
SYMBOL res 176 64 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 51 49 VBottom 0
SYMATTR InstName R10
SYMATTR Value 100
SYMBOL res 192 256 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 28 56 VBottom 0
SYMATTR InstName R12
SYMATTR Value 1k
SYMBOL diode 624 400 R0
SYMATTR InstName D3
SYMBOL diode 624 336 R0
SYMATTR InstName D4
SYMBOL res 544 0 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R14
SYMATTR Value 1K
SYMBOL Opamps\\LT1097 336 -128 R0
SYMATTR InstName U5
SYMBOL res 544 -80 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R11
SYMATTR Value 1K
SYMBOL res 96 -144 R0
SYMATTR InstName R9
SYMATTR Value 10k
SYMBOL diode 0 96 R270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName D5
SYMATTR Value 1N914
SYMBOL res 224 -208 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R16
SYMATTR Value 1k
SYMBOL diode -80 -96 R270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName D6
SYMATTR Value 1N914
SYMBOL diode 80 -176 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName D7
SYMATTR Value 1N914
SYMBOL diode -16 -176 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName D10
SYMATTR Value 1N914
SYMBOL diode 720 -128 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName D11
SYMATTR Value 1N914
SYMBOL res 736 -208 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R19
SYMATTR Value 47K
SYMBOL diode 576 -176 R270
WINDOW 0 32 32 VTop 0
WINDOW 3 0 32 VBottom 0
SYMATTR InstName D8
SYMATTR Value 1N914
SYMBOL diode 656 -128 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName D9
SYMATTR Value 1N914
SYMBOL diode 624 272 R0
SYMATTR InstName D12
SYMBOL pnp 832 32 M180
SYMATTR InstName Q3
SYMATTR Value 2N2907
SYMBOL res 880 64 R0
SYMATTR InstName R8
SYMATTR Value 1k
TEXT -568 392 Left 0 !.tran 0 .006s .001s startup
 
Top