A Two Frequency Analog Discriminator - Worth Pursuing?

bdd4

Junior Member
Aug 6, 2015
15
0
0
I have simulated an analog circuit using LTSpiceIV which indicates that it can determine which of 2 square waves of equal amplitude is higher in frequency. The circuit lights an A_High or B_High LED. Some results are as follows:
SIG_A SIG_B RESULTS RETURNED IN
1Hz 0.9HZ 2.4 seconds
43967.7Hz 43967.6 17.46ms
1MHz 990KHz 7.11ms
1MHz 1000001 52.46ms (1 PART IN 1e6)
10MHz 990KHz 8.39ms
If a hardware build proves the LTSpice results true, does this circuit have any commercial wort? How difficult would it be to duplicate these results with a uC or other standalone digital solution? What would you estimate the cost of a digital solution to be?
 

Harvey

Administrator<br>Elite Member
Oct 9, 1999
35,057
67
91
Among other applications, discriminator circuits were used in early FM radio signal detection. They were supplanted by phase locked loop (PLL) circuits, which are more robust and more accurate in the presence of various kinds of interference, such as noise and amplitude and phase modulation and nearby intereference signals.

Some wikipedia info on various radio detection circuits.

In the analog domain, I think you'll find that PLL's are a better choice than basic discriminator circuits for most if not all tasks. They are widely available as integrated circuits optimized for both general and specific applications operating over various frequency ranges.

PLL's can be used to generate and recover both FM and phase modulation signals. I've built a few experimental analog PLL's optimized for hard wired (not broadcast) audio transmission and reception using both FM and PWM (Pulse Width Modulation). I was able to achieve very high modulation index (> 60% deviation), which produced a wide dynamic range (signal to noise ratio) with high accuracy (low distortion). I was using these circuits in a closed loop, not transmitted over the air, so external interference wasn't an issue.

I put this project on the back burner when chips became available that could digitize audio at 24 bits x 192 KHz sampling rate. At that point, digital audio really started to sound good so, no matter how good my circuits measured and sounded, they couldn't compete with the ability to interface directly with DSP processors without first having to be digitized.

The commercial value of your circuit will depend on whether it does a better job of performing tasks or solving specific problems than other approaches or doing as good a job as other approaches at a lower cost.

Good luck... And don't stop learning and thinking! :cool:
 
Last edited:

bdd4

Junior Member
Aug 6, 2015
15
0
0
Harvey, thanks for your reply. I know most things have gone digital but I'm hoping :), to find a niche for this circuit which is related to my analog integrator and pulse stretcher/timer circuits that use no reactive components. I wont quit dreaming, I love creating. Since it sounds as though you too are a creator I'd love to be your neighbor.
 
May 11, 2008
22,289
1,425
126
It has been a while for me but set reset flipflops and exor ports can be used to discriminate the phase between signals. They are used in PLLs as mentioned.

You could try for fun a HEF4046. It is a pll ic. Albeit a bit ancient. But works.
The second phase comparator is pretty capable and very interesting :
Could be fun to build one in LTspice.
From the NXP datasheet :

Phase comparator 2 is an edge-controlled digital memory network. It consists of four
flip-flops, control gating and a 3-state output circuit comprising p and n-type drivers with a
common output node. When the p-type or n-type drivers are ON, they pull the output up to
VDD or down to VSS respectively. This type of phase comparator only acts on the
positive-going edges of the signals at SIG_IN and COMP_IN. Therefore, the duty factors
of these signals are not of importance.
If the signal input frequency is higher than the comparator input frequency, the p-type
output driver is maintained ON most of the time, and both the n and p-type drivers are
OFF (3-state) the remainder of the time. If the signal input frequency is lower than the
comparator input frequency, the n-type output driver is maintained ON most of the time,
and both the n and p-type drivers are OFF the remainder of the time. If the signal input
and comparator input frequencies are equal, but the signal input lags the comparator input
in phase, the n-type output driver is maintained ON for a time corresponding to the phase
difference. If the comparator input lags the signal input in phase, the p-type output driver is
maintained ON for a time corresponding to the phase difference. Subsequently, the
voltage at the capacitor of the low-pass filter connected to this phase comparator is
adjusted until the signal and comparator inputs are equal in both phase and frequency. At
this stable point, both p and n-type drivers remain OFF and thus the phase comparator
output becomes an open circuit and keeps the voltage at the capacitor of the low-pass
filter constant.

Datasheet :
http://www.nxp.com/products/logic/p...rch-01_01_15&gclid=CMHf_tS8l8cCFdQZtAod0_0GGQ
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
All you need is a couple frequency to voltage converters, and a comparator. Such circuits have been around for decades.
 

Harvey

Administrator<br>Elite Member
Oct 9, 1999
35,057
67
91
All you need is a couple frequency to voltage converters, and a comparator. Such circuits have been around for decades.

That's exactly what wne PLL would do. A PLL compares two frequencies and outputs a voltage proportional to the difference.

Traditionally, one frequency is considered as a steady clock and the other is the modulated carrier, but in a PLL, eiher input can be considered the clock. The best analog PLL's I've encountered are based on analog multiplier circuits.

The gain control of most linear multipliers (X x Y / Z) are inherently temperature stable. Logarithmic/exponentially controlled multipliers (dB/volt) have a temperature sensitive control characteristic. There are numerous ways to thermally compensate them.

You need to determine:

1. Dynnamic range (noise floor to clipping)
2. Bandwidth or band of interest
3. Accuracy (distortion)
4. Control characteristic (log vs. linear)
5. Thermal stability (gain vs. temp)
6. Operating voltage range
 

bdd4

Junior Member
Aug 6, 2015
15
0
0
Hello sm625, thanks for replying. Yes, I know the scheme you mentioned has been around for ages but I still believe my design has merit....saleable?, better or cheaper than other solutions? or just as a curiosity worth hanging on my lab wall?, I don't know yet. A new simulation indicates that I can discern the difference between 14000 Hz and 14000.01 Hz in addition to other previously posted close frequencies. I wonder if 2 F/Vs and a comparator could very easily "see" that difference. Your thoughts?
 

Harvey

Administrator<br>Elite Member
Oct 9, 1999
35,057
67
91
A new simulation indicates that I can discern the difference between 14000 Hz and 14000.01 Hz in addition to other previously posted close frequencies. I wonder if 2 F/Vs and a comparator could very easily "see" that difference. Your thoughts?

14000.01/14000 = 1.000000714 = 0.000006204 db

The difference between the two would be far below the noise floor of most, if not all, analog circuits.
 

bdd4

Junior Member
Aug 6, 2015
15
0
0
Thanks Harvey, Spice is a nice clean environment, especially when you don't add real world influences, which I have not. I have parts on order and will build the circuit and hope it can duplicate at least some of my spice results.
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
I have simulated an analog circuit using LTSpiceIV which indicates that it can determine which of 2 square waves of equal amplitude is higher in frequency. The circuit lights an A_High or B_High LED. Some results are as follows:
SIG_A SIG_B RESULTS RETURNED IN
1Hz 0.9HZ 2.4 seconds
43967.7Hz 43967.6 17.46ms
1MHz 990KHz 7.11ms
1MHz 1000001 52.46ms (1 PART IN 1e6)
10MHz 990KHz 8.39ms
If a hardware build proves the LTSpice results true, does this circuit have any commercial wort? How difficult would it be to duplicate these results with a uC or other standalone digital solution? What would you estimate the cost of a digital solution to be?

It could be done fairly easily with a (potentially) low cost microcontroller.

Assuming that the two frequency sources, can readily be converted into digital signals. Method of conversion, depends on exact specs, but could be zero-threshold (crossing) detection or something.
Feed this into the input capture (or similar, it detects the timing WITHOUT relying on the software processing delay, as it is done in hardware, via timers) inputs of the microcontroller. It can then measure the time intervals, of the signals. Perhaps of multiple cycles, to improve measurement resolution.

Software, can then readily compare the time periods of the two frequencies.

Increasingly more sophisticated methods can be used, if the above does not give the desired results. Such as more processing of the signals (e.g. PLL freq multiplication, if it improves the results accuracy and response times. If not, there are probably other processing methods), before they enter the microcontroller.

Modern high speed, high resolution microcontrollers (e.g. small number of nano-seconds of resolution), with accurate quartz crystals (the readings would be relative to each other, so the time base accuracy, should not matter too much, anyway).

At VERY high frequencies (e.g. above 10 MHz), you would lose resolution. But smart software, and taking readings across multiple cycles (e.g. x100, x1000), should be able to improve the resolution.
 
Last edited:

bdd4

Junior Member
Aug 6, 2015
15
0
0
Hello SOFTengCOMPelec, Thanks for your reply. You offered some interesting thoughts on how we might accomplish the results digitally. For example PLL multiplication of 14000.01 Hz/14000Hz by say 10^3 would yield a much friendlier difference of 10Hz (14,000010 - 14MHz) but what uC clock speed and accuracy might we need to achieve an accurate count of that small difference at 14MHz? 14000010/14000000 = 1.00000071429 I suppose the multiplied PLL quantity could be counted under a long window e.g. 1 or 10 seconds. Now we ask, could the uC solution return accurate results as fast as the analog simulation indicates might be possible? That leaves me something to examine.
Your thoughts?
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
Analog simulations, can give misleading results. Especially if it is leading you to believe that your circuits, seem to be working at phenomenally better than existing commercial performance levels.

Real circuits have stray capacitance/inductance, drift, component tolerance, performance limits on the semiconductors/Op-amps, such as gain bandwidth (products). Real life leakage currents, variation with temperature, cross talk, etc. Are NOT necessarily accurately considered by all simulators.

These effects can build up in real life circuits, to create huge instability and all sorts of other issues. Which ultimately either stop it from working, increase costs and potentially reduce the performance.

tl;dr
Best to try it out, in real life (build it). Before getting too excited, about its capabilities. Which may be just due to limitations, of your simulator.

Because microcontroller(s) are often a part of modern day electronic devices. I.e. The cost of the device is ALREADY paid for. Because your mobile-phone/test-instrument/radio/electronic-kitchen-aid may already have a reasonably decent microcontroller.
Also that microcontroller, may well have hundreds or more, of connection pins, many of which are programmable input output ones.
So performing what you want to do, digitally (microcontroller), may just involve using a few pins (out of hundreds), and a couple of timers (the timers may be used for other things, and there may not be that many, depending on the exact MCU being used). But if it has them, and they are available (free). Doing it in the MCU (if a suitable one was already in the product) would add little/nothing to the hardware costs.
Except for the initial analog to digital interface circuitry, so that the capture unit(s), can measure the time intervals.

Measuring the frequencies, with the microcontroller, can become a very big and complex subject area. So I will NOT try to cover it here.

If it was me looking in to this. I would be tempted, to research how modern high capability (often very expensive), frequency counters (meters etc), work.

My understanding is that they use clever combinations of phase locked loops (PLLs), typically frequency multipliers, so that they can update quickly (for low frequencies), and yet give high reading resolutions as well.
Also switching to reciprocal measurement techniques, when the frequency is low enough. So that the resolution is much improved.

When I use such equipment, I am sometimes amazed at the accuracy, resolution and speed of the readings.

E.g.
A cheap/old (simple frequency counter), says 1 Hz, updating every 10 seconds.
But an expensive one says 1.002176342411 Hz, soon after you plug in the signal lead. With temperature stabilized oven crystal, to improve the accuracy, still further, after the oven has reached, its stable/final temperature.

Because you are looking at differences between frequencies in YOUR application. There could be further circuit optimizations, which lead to better, cheaper and more accurate measurement techniques.

I.e. A mixture of some analog circuitry, and digital, may lead to the best price, performance, accuracy, resolution, and response time compromise.

Depending on the input frequency range, and budget for the hardware. It may be viable, to use sampling techniques. If you want very fast response times, and this can give you accurate enough results (it may not be accurate enough), then it could be viable. But it is beginning to get VERY complicated.
 
Last edited:

bdd4

Junior Member
Aug 6, 2015
15
0
0
SOFTengCOMPelec: Thanks for taking the time to make suggestions. I agree, analog simulators can raise false expectations. Bob Pease (National Semiconductors....deceased) cautioned against expecting to see the same results in hardware as seen in a simulation. Wouldn't it be nice if we lived in a world with no CROSS TALK, NO UNWANTED NOISE, no INTOLERANCE or other adverse affects?

Back to the serious side: I have a few more parts to gather, then I will build and test.
In the meantime, I have tweaked my design and in simulation cannow DETECT THE DIFFERENCE BETWEEN 1MHz AND 1,000,000.001Hz.
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
SOFTengCOMPelec: Thanks for taking the time to make suggestions. I agree, analog simulators can raise false expectations. Bob Pease (National Semiconductors....deceased) cautioned against expecting to see the same results in hardware as seen in a simulation. Wouldn't it be nice if we lived in a world with no CROSS TALK, NO UNWANTED NOISE, no INTOLERANCE or other adverse affects?

Back to the serious side: I have a few more parts to gather, then I will build and test.
In the meantime, I have tweaked my design and in simulation cannow DETECT THE DIFFERENCE BETWEEN 1MHz AND 1,000,000.001Hz.

Funny you should mention Bob Pease.

Here in this video, at the correct starting time, he and his team, explain in detail. Why it (simulation/Spice) can lead to false expectations.
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
I think what you're doing is great. There's two ways you can go from here. The first is to actually produce the circuit and find out that the minimum frequency difference is much higher than what spice is telling you. Then you can go on to figure out why. At least in my undergraduate, we had to learn things the hard way with some breadboard circuits and there were definitely moments where something that works great in spice suddenly does nothing in the lab.

Or you can add noise (thermal noise in components and voltage supply noise while you're at it) and monte carlo (device mismatch) to your simulations. I think that will give you a better picture on the actual performance you may get when you actually construct it.
 

Harvey

Administrator<br>Elite Member
Oct 9, 1999
35,057
67
91

As a young analog engineer, Bob Pease and his best friend, Jim Williams (later, one of the founders of Linear Technology) were two of my heros. I actually had the pleasure of speaking with both of them at differfent times.

Bob Pease was one of the funniest guys I've ever heard or read. He could crack up an audience of otherwise stoic engineers at National Semiconductor seminiars, and in his monthly articles in Electronic Design while sneaking in a wealth instructive, insightful info on the deeper aspects of analog circuit design. He also compiled the legendary "National Semiconductor Audio Handbook" and the later version, the "National Semiconductor Audio/Radio Handbook."

national%20semiconducter%20book.jpg

I still have well worn original copies of both which I've owned since they were new. Yes, I'm that old. :p

I identified strongly with Jim Williams because like me, did not have his engineering degree. Analog circuitry just made sense to him, and it grew from there. When I read one of his articles where he said that he envisioned analog circuitry while downhill skiing, I phoned him at his work just to tell him how much I understood that. :cool:

Interestingly, they both died within a week of each other. Interestingely, the two losses were related, since Bob&#8217;s accident occurred on his way home from Jim&#8217;s memorial service. :(

Sorry for digressing, but you brought up some really great memories of really great guys.
 

SOFTengCOMPelec

Platinum Member
May 9, 2013
2,417
75
91
As a young analog engineer, Bob Pease and his best friend, Jim Williams (later, one of the founders of Linear Technology) were two of my heros. I actually had the pleasure of speaking with both of them at differfent times.

Bob Pease was one of the funniest guys I've ever heard or read. He could crack up an audience of otherwise stoic engineers at National Semiconductor seminiars, and in his monthly articles in Electronic Design while sneaking in a wealth instructive, insightful info on the deeper aspects of analog circuit design. He also compiled the legendary "National Semiconductor Audio Handbook" and the later version, the "National Semiconductor Audio/Radio Handbook."

national%20semiconducter%20book.jpg

I still have well worn original copies of both which I've owned since they were new. Yes, I'm that old. :p

I identified strongly with Jim Williams because like me, did not have his engineering degree. Analog circuitry just made sense to him, and it grew from there. When I read one of his articles where he said that he envisioned analog circuitry while downhill skiing, I phoned him at his work just to tell him how much I understood that. :cool:

Interestingly, they both died within a week of each other. Interestingely, the two losses were related, since Bob’s accident occurred on his way home from Jim’s memorial service. :(

Sorry for digressing, but you brought up some really great memories of really great guys.

Although at a partly late stage, Bob Widlar, who (apparently) was a significant friend of Bob Pease (both worked at National Semiconductor, and Bob Pease did a nice article about Widlar, when he passed away, so young, relatively), was/is one of my Electronics hero's. https://en.wikipedia.org/wiki/Bob_Widlar.

Amazingly he designed lots of integrated circuit "inventions", especially including the first (commercially significant), op amp, the uA709. The earlier uA702 was also his design. He was to do a number of other op amps (and ICs), as well.

Luckily he was NOT a very, very late developer, because he unfortunately died, aged ONLY 53.

I'd be glad to have *ONLY* invented/designed ONE of his chips, by the age of 83, let alone 53.

It must have been real (great) fun, to pioneer those early chips in the 1960s/70s/80s and onwards. These days we just take them for granted.

People/engineers, use to (in the 1960s, especially), REALLY know how to make complicated circuits, of good quality, JUST out of transistors (obviously passives/diodes etc as well).
E.g. They could design very high quality, powerful amplifiers, and music Synthesizers. With not a single IC, in the whole thing.

These days, a lot/most of these "pure" transistor designers, have either disappeared, or not done it for such a long period of time, they have mostly forgotten how to do it. Very few people, these days, are left, who could do it, extremely well.

Looking back over some (now) very old electronics magazines. I am sometimes AMAZED at how clever they were, with the transistor circuitry design.

E.g. An ALL electronic, mains frequency divider (to divide it down to seconds), to drive a mechanical digits, clock.
Using a somewhat small number of transistors.

The gist of the design, was that each mains pulse (sine wave), would make a transistorized mono-stable, generate a brief pulse, which charged up a capacitor, a bit.
Once it reached a certain voltage (which represented x10 counts), it reset itself, and triggered a similar pulse onto the next stage. Similarly it divided by x6 counts, finally creating a very accurate (for its day, approx 1960s), time clock.

At that time digital binary dividers (the modern way of doing it, e.g. TTL), were impractically too expensive.
It only had about 15 transistors, in total (if I remember, correctly). It may have been from the 1950s, or 1960s, I can't accurately remember, but probably the 1960s.