View Single Post
  #47   Report Post  
Posted to alt.binaries.schematics.electronic
John Fields John Fields is offline
external usenet poster
 
Posts: 2,022
Default Sample & hold - for frequency.

On Sat, 7 Nov 2009 14:21:25 -0000, "ian field"
wrote:


"John Fields" wrote in message
.. .
On Fri, 6 Nov 2009 21:57:44 -0000, "ian field"
wrote:


"Jim Thompson" wrote in
message news On Fri, 6 Nov 2009 20:53:53 -0000, "ian field"
wrote:


"John Fields" wrote in message
news On Fri, 6 Nov 2009 14:53:26 -0000, "ian field"
wrote:


"John Fields" wrote in message
news:gop6f598hqid0qo3aag5bkbdoa5b0391n3@4ax .com...

Assuming that your mic can integrate out the 12kHz transitions and
yield
a harmonic and overtone-free fundamental, what I'd do would be to
detect
sequential zero crossings of the signal, square them up with a
comparator, and use the time between the edges to allow a counter
chain
to accumulate high frequency clocks (the frequency of the clock
chosen
to force the regenerated signal (the "copy") to yield the accuracy
you
need) then, at the end of that time, to latch that value and send
the
output of the latch to the broadside load inputs of the counter
chain.

Simultaneously, the counter chain's count direction will be changed,
making it a down counter, and when it gets to zero it'll clock a
dflop
wired as a divide-by-two, and will also reload the value stored in
the
latch into the counter, starting the cycle anew.

The net result will be that the output frequency of the
divide-by-two
will mimic the output frequency of the synthesizer.

JF

I was hoping for something pretty minimalist - its a sort of one hit
project
that once its given me the info I want, its likely to get robbed of
parts
for later projects.

---
Well, you're going to need, as a minimum, something which you can use
to
measure the period of the waveform and then read it out and take its
reciprocal.

That could be something as simple as a comparator, a dflop, an RS
flip-flop, a clock source, and a counter feeding some LEDs

Just for grins, let's say the highest frequency you can get out of the
organ is 3520 Hz (A7) and you want to measure the frequency to +/- 1%.

In order to do that you'll need a clock running 100 times faster,
which
is 352000 Hz., and something to accumulate 100 clock cycles during one
3520 Hz. cycle; an 8 bit binary up counter.

So what you'd do would be to manually reset the counter, have the
first
rising edge of the squared-up organ signal enable the counter, and the
next rising edge disable it forever.

Then you'd get the contents of the counter by reading the LEDs, and
the
frequency of the organ signal by multiplying the counter's contents by
284.0909µs and taking the reciprocal of the product.

One thing to be aware of is that as the frequency of the organ signal
decreases, either the length of the counter will have to increase or
the
frequency of the clock decrease in order to prevent overflow.

Finally, it could get tricky trying to catch the first real rising
edge
of the organ signal, so what I'd do would be to insert a small (10ms?)
delay from the whatever the rising thing out of mic was and, when it
timed out, use the next 2 rising edges to gate the counter,


JF

Can't I just make a PLL lock on to the frequency and stay put after the
note
has decayed, then measure the frequency with a digital frequency
counter?


A PLL that doesn't drift once it loses reference ?:-)

It only needs to stay put for just over a second to cover the gate time of
the counter.


---
But, once you hit the note, the PLL has to lock on to the signal coming
from the mic and, once that's happened, you've got to make your
frequency measurement, which means the VCO has to lock in in whatever
time's left in the front end of envelope so the counter can get a good
count.

One thing that will definitely help is if you square up the signal
coming from the mic, which will effectively put some sustain in it and
increase the time you'll have useful input into the PLL and the counter.

Also, if you can play the key legato so that the leading edge of one
envelope falls on the trailing edge of the previous one before the
amplitude decays to the point where the PLL and counter lose it, that
might work.

Hell, if you can do it that way you might just be able to get away with
a counter and a comparator!

But then you won't get to use my beautyful circuit :-( sob...


Its a shame, but I can't afford my own power station to run it all.


---
What are you talking about?

You can do the whole thing for probably less than than $10 in parts and
less than a quarter of a watt in power.

And, it seems to work:


Version 4
SHEET 1 2520 948
WIRE 448 96 176 96
WIRE 736 96 464 96
WIRE 1024 96 752 96
WIRE 1312 96 1040 96
WIRE 1600 96 1328 96
WIRE 1888 96 1616 96
WIRE 2176 96 1904 96
WIRE 2448 96 2192 96
WIRE 304 128 144 128
WIRE 592 128 304 128
WIRE 880 128 592 128
WIRE 1168 128 880 128
WIRE 1456 128 1168 128
WIRE 1744 128 1456 128
WIRE 2032 128 1744 128
WIRE 2304 128 2032 128
WIRE -64 176 -880 176
WIRE 304 176 304 128
WIRE 592 176 592 128
WIRE 880 176 880 128
WIRE 1168 176 1168 128
WIRE 1456 176 1456 128
WIRE 1744 176 1744 128
WIRE 2032 176 2032 128
WIRE 2304 176 2304 128
WIRE -1056 192 -1328 192
WIRE -1056 224 -1056 192
WIRE 176 224 176 96
WIRE 224 224 176 224
WIRE 416 224 384 224
WIRE 464 224 464 96
WIRE 512 224 464 224
WIRE 704 224 672 224
WIRE 752 224 752 96
WIRE 800 224 752 224
WIRE 992 224 960 224
WIRE 1040 224 1040 96
WIRE 1088 224 1040 224
WIRE 1280 224 1248 224
WIRE 1328 224 1328 96
WIRE 1376 224 1328 224
WIRE 1568 224 1536 224
WIRE 1616 224 1616 96
WIRE 1664 224 1616 224
WIRE 1856 224 1824 224
WIRE 1904 224 1904 96
WIRE 1952 224 1904 224
WIRE 2144 224 2112 224
WIRE 2192 224 2192 96
WIRE 2224 224 2192 224
WIRE 2416 224 2384 224
WIRE -1088 240 -1120 240
WIRE -944 256 -1024 256
WIRE -640 256 -944 256
WIRE -1088 272 -1184 272
WIRE 224 272 -16 272
WIRE 448 272 448 96
WIRE 448 272 400 272
WIRE 512 272 448 272
WIRE 736 272 736 96
WIRE 736 272 688 272
WIRE 800 272 736 272
WIRE 1024 272 1024 96
WIRE 1024 272 976 272
WIRE 1088 272 1024 272
WIRE 1312 272 1312 96
WIRE 1312 272 1264 272
WIRE 1376 272 1312 272
WIRE 1600 272 1600 96
WIRE 1600 272 1552 272
WIRE 1664 272 1600 272
WIRE 1888 272 1888 96
WIRE 1888 272 1840 272
WIRE 1952 272 1888 272
WIRE 2176 272 2176 96
WIRE 2176 272 2128 272
WIRE 2224 272 2176 272
WIRE 2448 272 2448 96
WIRE 2448 272 2400 272
WIRE -880 288 -880 176
WIRE -848 288 -880 288
WIRE -1120 304 -1120 240
WIRE -1056 304 -1056 288
WIRE -1056 304 -1120 304
WIRE -96 304 -384 304
WIRE -1056 336 -1056 304
WIRE -736 336 -784 336
WIRE -704 336 -736 336
WIRE -848 352 -880 352
WIRE -736 352 -736 336
WIRE -448 352 -528 352
WIRE -880 368 -880 352
WIRE -240 368 -384 368
WIRE -64 368 -64 176
WIRE -64 368 -240 368
WIRE 240 368 -64 368
WIRE 304 368 304 320
WIRE 304 368 240 368
WIRE 592 368 592 320
WIRE 592 368 304 368
WIRE 880 368 880 320
WIRE 880 368 592 368
WIRE 1168 368 1168 320
WIRE 1168 368 880 368
WIRE 1456 368 1456 320
WIRE 1456 368 1168 368
WIRE 1744 368 1744 320
WIRE 1744 368 1456 368
WIRE 2032 368 2032 320
WIRE 2032 368 1744 368
WIRE 2304 368 2304 320
WIRE 2304 368 2032 368
WIRE -704 384 -704 336
WIRE -640 384 -640 256
WIRE -880 400 -736 352
WIRE -1184 416 -1184 272
WIRE -1104 416 -1184 416
WIRE -944 416 -944 256
WIRE -944 416 -1024 416
WIRE -880 416 -880 400
WIRE -848 416 -880 416
WIRE -736 416 -880 368
WIRE -736 432 -736 416
WIRE -736 432 -784 432
WIRE 416 432 416 224
WIRE 704 432 704 224
WIRE 992 432 992 224
WIRE 1280 432 1280 224
WIRE 1568 432 1568 224
WIRE 1856 432 1856 224
WIRE 2144 432 2144 224
WIRE 2416 432 2416 224
WIRE -528 448 -528 352
WIRE -240 448 -240 368
WIRE -16 448 -16 272
WIRE -1184 464 -1184 416
WIRE -848 480 -880 480
WIRE -656 496 -656 448
WIRE -608 496 -656 496
WIRE -400 496 -432 496
WIRE -320 496 -400 496
WIRE 416 528 416 496
WIRE 704 528 704 496
WIRE 992 528 992 496
WIRE 1280 528 1280 496
WIRE 1568 528 1568 496
WIRE 1856 528 1856 496
WIRE 2144 528 2144 496
WIRE 2416 528 2416 496
WIRE -608 544 -656 544
WIRE -368 544 -448 544
WIRE -96 544 -96 304
WIRE -96 544 -160 544
WIRE -1328 576 -1328 192
WIRE -1184 576 -1184 544
WIRE -880 576 -880 480
WIRE -848 576 -880 576
WIRE -736 576 -736 432
WIRE -736 576 -768 576
WIRE 32 576 32 512
WIRE 240 576 240 368
WIRE -880 592 -880 576
WIRE -656 640 -656 544
WIRE -400 640 -400 496
WIRE -400 640 -656 640
WIRE -368 640 -368 544
WIRE -32 640 -32 512
WIRE -32 640 -368 640
WIRE -1328 688 -1328 656
WIRE -1184 688 -1184 656
WIRE -1184 688 -1328 688
WIRE -880 688 -880 656
WIRE -880 688 -1184 688
WIRE -528 688 -528 592
WIRE -528 688 -880 688
WIRE -240 688 -240 592
WIRE -240 688 -528 688
WIRE 32 688 32 656
WIRE 32 688 -240 688
WIRE 144 688 144 128
WIRE 144 688 32 688
WIRE 240 688 240 656
WIRE 240 688 144 688
WIRE 416 688 416 608
WIRE 416 688 240 688
WIRE 704 688 704 608
WIRE 704 688 416 688
WIRE 992 688 992 608
WIRE 992 688 704 688
WIRE 1280 688 1280 608
WIRE 1280 688 992 688
WIRE 1568 688 1568 608
WIRE 1568 688 1280 688
WIRE 1856 688 1856 608
WIRE 1856 688 1568 688
WIRE 2144 688 2144 608
WIRE 2144 688 1856 688
WIRE 2416 688 2416 608
WIRE 2416 688 2144 688
WIRE -1328 752 -1328 688
FLAG -1328 752 0
FLAG -1056 336 0
SYMBOL Digital\\dflop 304 176 R0
SYMATTR InstName A1
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL voltage 240 560 R0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value PULSE(0 5 100e-6 1e-7 1e-7 1e-6 0 1)
SYMATTR InstName V2
SYMBOL Digital\\dflop 592 176 R0
SYMATTR InstName A4
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 880 176 R0
SYMATTR InstName A5
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 1168 176 R0
SYMATTR InstName A7
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 1456 176 R0
SYMATTR InstName A8
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 1744 176 R0
SYMATTR InstName A9
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 2032 176 R0
SYMATTR InstName A10
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\dflop 2304 176 R0
SYMATTR InstName A11
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL LED 400 432 R0
SYMATTR InstName D9
SYMBOL res 432 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R3
SYMATTR Value 150
SYMBOL voltage 32 560 R0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value PULSE(0 5 0 1e-7 1e-7 1.4205e-6 2.841e-6)
SYMATTR InstName V1
SYMBOL Digital\\and -64 480 R270
SYMATTR InstName A6
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL voltage -1184 560 R0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 .1 3520)
SYMATTR InstName V4
SYMBOL Comparators\\LT1017 -1056 256 R0
SYMATTR InstName U1
SYMBOL res -1200 448 R0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res -1008 400 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R11
SYMATTR Value 1e6
SYMBOL voltage -1328 560 R0
WINDOW 3 24 104 Invisible 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value 5
SYMATTR InstName V5
SYMBOL LED 688 432 R0
SYMATTR InstName D1
SYMBOL res 720 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R2
SYMATTR Value 150
SYMBOL LED 976 432 R0
SYMATTR InstName D2
SYMBOL res 1008 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R4
SYMATTR Value 150
SYMBOL LED 1264 432 R0
SYMATTR InstName D3
SYMBOL res 1296 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R5
SYMATTR Value 150
SYMBOL LED 1552 432 R0
SYMATTR InstName D4
SYMBOL res 1584 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R6
SYMATTR Value 150
SYMBOL LED 1840 432 R0
SYMATTR InstName D5
SYMBOL res 1872 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R7
SYMATTR Value 150
SYMBOL LED 2128 432 R0
SYMATTR InstName D6
SYMBOL res 2160 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R8
SYMATTR Value 150
SYMBOL res 2432 624 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R9
SYMATTR Value 150
SYMBOL LED 2400 432 R0
SYMATTR InstName D7
SYMBOL res -752 560 R90
WINDOW 0 -3 22 VBottom 0
WINDOW 3 39 54 VTop 0
SYMATTR InstName R10
SYMATTR Value 100k
SYMBOL cap -896 592 R0
WINDOW 0 -38 31 Left 0
WINDOW 3 -56 56 Left 0
SYMATTR InstName C1
SYMATTR Value 1e-7
SYMBOL Digital\\or -816 256 R0
WINDOW 0 -10 19 Left 0
SYMATTR InstName A13
SYMATTR SpiceLine trise 1e-7 tfall 1e-7 vhigh 5v
SYMBOL Digital\\or -816 512 M180
WINDOW 0 -30 14 Left 0
SYMATTR InstName A14
SYMATTR SpiceLine trise 1e-7 tfall 1e-7 vhigh 5v
SYMBOL Digital\\dflop -528 592 M180
SYMATTR InstName A16
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\or -416 400 R180
WINDOW 0 -33 -17 Left 0
SYMATTR InstName A17
SYMATTR SpiceLine trise 1e-7 tfall 1e-7 vhigh 5v
SYMBOL Digital\\dflop -240 592 M180
SYMATTR InstName A15
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
SYMBOL Digital\\and -608 416 R90
SYMATTR InstName A2
SYMATTR Value2 Vhigh 5V Trise 1e-7 Tfall 1e-7
TEXT -1320 720 Left 0 !.tran 8e-3 uic
TEXT -1136 616 Left 0 ;MIC
TEXT 280 616 Left 0 ;RESET
TEXT 80 608 Left 0 ;HF
TEXT 64 640 Left 0 ;CLOCK
TEXT 280 48 Left 0 ;LSB
TEXT 2280 48 Left 0 ;MSB
JF