Author Topic: Frequency Counter Measurements and Noise  (Read 12458 times)

0 Members and 3 Guests are viewing this topic.

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Frequency Counter Measurements and Noise
« on: August 10, 2015, 09:59:50 pm »
Background:

Using the counter feature on some Instek function generators (GFG-8016G and GFG-8216A), I noticed the value measured was incorrect from the source signal. For example, using a tone  generator app on the iPhone (iPhone plugged into mains), I emit a 199.4hz signal at full volume and using a scope probe I measure the frequency via the headphone jack. On the GFG-8016G it reads around 500 to 600hz and on the GFG-8216A it read around 250 hz. My BK 1801 and Sampo FG1617 reads it correctly as 200hz.

I emailed Instek and they responded indicating these Instek units do not have a low pass circuit design. They mentioned: "... If the input signal is high voltage and it includes the noise signal, the GFG-8216A FC will detect the fundamental signal tone and noise signal tone. So the GFG-8216A FC will show around 250-300hz. ..."

I found for both Instek units, if I attenuate the signal by setting the probe to 10x, or use the 1/10 feature on the GFG-8016G, then the units both count 200hz correctly. If I decrease the volume on the iPhone the GFG-8016G will eventually read around 203hz.

If I construct a low pass filter, both units read the 200 hz correctly.

I also found that if I omit the resistor in the RC filter and only use a capacitor in parrelel to the iPhone output (I tried 1uF on the GFG-8216A and 130nF on the GFG-8016G) then they also show 200 hz.

I also tried the above using a laptop (plugged into mains at full volume) and Audacity. I found the same issue on my Instek GFG-8016G and the above solutions also work (either attenuating the signal, using a low pass filter, or just a 130nF capacitor).

Attached are the wave-forms seen on the scope for the output from the laptop.
(The GFG-8016G manual mentions it has a high input sensitivity of 20mv RMS. In another area it mentions the sensitivity as <= 20mV rms)

Questions:

I read online how on some counters one could adjust the trigger band to avoid triggering on noise. Is it likely that when I attenuate the signal the noise components are also being attenuated so they remain within the trigger band and therefore the counter reports the 200 hz signal correctly?

When I use a low pass filter the Instek units measure the 200 hz signal correctly. Is it  because the noise is higher frequency and therefore the main signal remains as it is, and the higher frequency noise is attenuated within the trigger band and therefore does not effect the measurement?

Why is it that using only a capacitor in parallel with the iPhone or laptop headphone jack output, the Instek units measure correctly?
« Last Edit: August 10, 2015, 10:04:23 pm by rstor22 »
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #1 on: August 11, 2015, 12:31:16 am »
I read online how on some counters one could adjust the trigger band to avoid triggering on noise. Is it likely that when I attenuate the signal the noise components are also being attenuated so they remain within the trigger band and therefore the counter reports the 200 hz signal correctly?

When I use a low pass filter the Instek units measure the 200 hz signal correctly. Is it  because the noise is higher frequency and therefore the main signal remains as it is, and the higher frequency noise is attenuated within the trigger band and therefore does not effect the measurement?

Your understanding is perfect here.

Why is it that using only a capacitor in parallel with the iPhone or laptop headphone jack output, the Instek units measure correctly?

The headphone jack is providing your intended signal at low impedance.  The noise, both from the jack and picked up from EMI, is at a higher impedance.  This effectively provides an R for this signal component, which in combination with your C, makes the familiar RC filter.
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #2 on: August 11, 2015, 04:01:52 pm »
The headphone jack is providing your intended signal at low impedance.  The noise, both from the jack and picked up from EMI, is at a higher impedance.  This effectively provides an R for this signal component, which in combination with your C, makes the familiar RC filter.

I have a 3.5mm stereo plug (into the headphone jack) that has bare wires, using alligator clips I connect these wires to the 130nF capacitor on a breadboard. Is it the resistance of the wire on the 3.5mm stereo plug and the resistance of the alligator clips which contribute towards the R in this RC circuit when just the capacitor is used?
 

Offline unitedatoms

  • Frequent Contributor
  • **
  • !
  • Posts: 324
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #3 on: August 11, 2015, 04:16:31 pm »
Chris C answered you that internal low impedance of iPhone is involved. It is possibly low (few ohms may be) but it is higher than just wires and alligator clips. May be 30 Ohm or so.

I suggest for more experments, put the capacitor in series, not in parallel and see how high the frequency counter reading will be. May be 10KHz
« Last Edit: August 11, 2015, 04:19:35 pm by unitedatoms »
Interested in all design related projects no matter how simple, or complicated, slow going or fast, failures or successes
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #4 on: August 11, 2015, 04:24:29 pm »
Chris C answered you that internal low impedance of iPhone is involved. It is possibly low (few ohms may be) but it is higher than just wires and alligator clips. May be 30 Ohm or so.

I suggest for more experments, put the capacitor in series, not in parallel and see how high the frequency counter reading will be. May be 10KHz

It seems I misunderstood. So it is the internal resistance of the iPhone or Laptop that is involved which contributes towards the R in the RC circuit when just the capacitor is used?
 

Offline unitedatoms

  • Frequent Contributor
  • **
  • !
  • Posts: 324
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #5 on: August 11, 2015, 04:27:50 pm »
Yes. The circuitry of amplifiers behind outputs of audio plugs has non-zero output impedance. As any audio amplifier has. I estimate it to be at about few ohms up to 10 Ohm may be (30 Ohm will be possibly too high). It may not be even a discrete resistor there. The amplifier chip itself has the impedance inherently.

Edit: This article claims that iPhone5 has impedance of 4.5 Ohm
http://www.kenrockwell.com/apple/iphone-5/audio-quality.htm

If for example the noise is high KHz, say one component is 150KHz then with 0.22uF cap, the low pass will divide this frequency component by ~2. And the signal turns cleaner, because the impedance magnitude of cap at 150KHz ~4.8 Ohm (or 5 Ohm together with ESR). With internal resistance of iPhone it makes a potentiometer-like divider. At 200Hz cap has high impedance, so 200 Hz component is nearly unattenuated.
« Last Edit: August 11, 2015, 04:44:33 pm by unitedatoms »
Interested in all design related projects no matter how simple, or complicated, slow going or fast, failures or successes
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #6 on: August 11, 2015, 04:48:59 pm »
Let's explain this a different way.

Look at the voltage waveform you provided "at the input of RC filter".  Pretty noisy, right?  If you were to *record* this waveform and play it back through headphones, you'd easily hear the noise as hiss.

But skip the record and playback, and just plug headphones directly into the iPhone/laptop.  You hear little or no hiss, only the intended 200hz signal.  Why?

Because the 200hz is being produced with sufficient current to always drive the headphones to the intended voltage.  The impedance of the headphone amplifier is low, equivalent to a resistor in serial with the output, of just a few ohms.  With or without a load, the voltage output remains essentially the same.

Most of the noise is at a much higher impedance, as if it were passing through a much larger resistor.  With little or no load it can still produce voltage.  For example, apply 0.1V to one side a 100K resistor and measure with a multimeter, you will always see 0.1V on the other side.  That's because the multimeter provides no load.  It's very high impedance, almost like an open circuit.  And so is your frequency counter.

But add a load, and the noise voltage rapidly drops.  That's what you've done with the parallel capacitor.  Replace it with a 50ohm resistor, or actual headphones, and it would also work.
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #7 on: August 11, 2015, 05:51:41 pm »
For the Instek GFG-8016G I tried a 50 ohm terminator and when the iPhone was the source of the signal the counter read 200 hz correctly. For the laptop, without the 50 ohm terminator the counter read around 400hz and with the 50 ohm terminator it read 280-300hz. In this case I would conclude the 50 ohm terminator was not sufficient load to decrease the noise voltage, but it had some effect on it.

Chris; would you be able to explain in more detail what you mean by the following "Most of the noise is at a much higher impedance" ? Do you mean the noise requires a higher load than the output resistance of the iPhone to attenuate it? And that a load such as headphones, resistor in a scope probe (when set to 10x), or an RC circuit would be needed to attenuate it further?



« Last Edit: August 11, 2015, 05:56:29 pm by rstor22 »
 

Offline dom0

  • Super Contributor
  • ***
  • Posts: 1483
  • Country: 00
Re: Frequency Counter Measurements and Noise
« Reply #8 on: August 11, 2015, 08:48:18 pm »
The circuitry of amplifiers behind outputs of audio plugs has non-zero output impedance. As any audio amplifier has.

There is little in that field that hasn't been tried, but negative output resistance amplifiers were :-)
,
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #9 on: August 11, 2015, 08:59:10 pm »
I'm going to venture a guess that your confusion stems from not being fully familiar with the term "impedance".

Impedance is formally defined as "the effective resistance of an electric circuit or component to alternating current, arising from the combined effects of ohmic resistance and reactance".

Which may not be too helpful, so I'll attempt an example.

If we apply 1V DC to a resistor, and 1A passes through it, we know that resistor has a resistance of 1ohm.

If we apply 1V AC RMS @ 100hz to a capacitor, it will pass a limited amount of energy.  The energy it passes pulsates, but suppose we average the current it passes over time, and find that it is 1A.  In those terms - of energy passed over time - that capacitor is effectively acting just like a 1ohm resistor.  And for the purpose of simplifying analysis of a circuit, it's sometimes adequate to treat that capacitor as if it really were a 1ohm resistor.  Of course it is not, so we say it has impedance, rather than resistance, to make it clear that we have applied that simplification.

But if we were to increase the frequency to 200hz without changing anything else, that capacitor would pass 2A.   So now, in our simplified analysis, it's acting like a 0.5ohm resistor.  The impedance has changed, and that is why when the frequency makes a difference, impedance is specified together with frequency.  Our example capacitor has 1ohm impedance @ 100hz, 0.5ohm impedance @ 200hz.

Even an amplifier, like the one in your iPhone/laptop, can be modeled as having an impedance.  But an amplifier is a LOT more complex than a capacitor!  A description of how its impedance changes with frequency, differing impedances of signal and noise, and the many reasons behind it, would be too long for me to write up - and probably beyond my ability even if I did try. ;)

So it will have to suffice to say, the major sources of noise in your setup have a higher impedance than the impedance of the desired signal.  And because of this, lowering the impedance of your frequency counter's input (by adding R, RC, etc.), you are removing more noise than signal.  (Though even if this wasn't the case, and you were reducing signal and noise equally, since you have such a large signal compared to the noise it's sufficient to just reduce everything to the point where the noise is smaller than the trigger band.)
 

Offline unitedatoms

  • Frequent Contributor
  • **
  • !
  • Posts: 324
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #10 on: August 11, 2015, 09:19:11 pm »
The circuitry of amplifiers behind outputs of audio plugs has non-zero output impedance. As any audio amplifier has.

There is little in that field that hasn't been tried, but negative output resistance amplifiers were :-)

Nice. I googled for this and it was great reading. If zeroing or going below zero for amplifier output impedance is possible for DC and low frequencies, it can help to make some interesting things possible. Say "ideal low power DC supply", etc.
Interested in all design related projects no matter how simple, or complicated, slow going or fast, failures or successes
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #11 on: August 12, 2015, 03:04:33 am »
I'm going to venture a guess that your confusion stems from not being fully familiar with the term "impedance".

Yes! Thank you for the detailed explanations. I believe I understand now. The desired signal of 200hz would have a certain impedance at the amplifier stage of the iPhone/laptop. When noise is introduced, that impedance of the amplifier stage is changed. This impedance of the output of the amplifier (regardless if there is noise or no noise) can be viewed as the R when a capacitor is placed in parallel with the output of the amplifier (which forms an RC circuit). Correct?

I tried placing the 130nF capacitor in parallel with the output of the iPhone without using a breadboard and alligator clips. The counter read 222 hz. If I used a 1uF or 10uF capacitor with the same setup it would read 200hz correctly. If I used one alligator clip to one of the leads of the 130nF capacitor (the other end to the headphone jack), the counter would read 200hz correctly. If I understand correctly, the higher capacitance [1uF or 10uF] along with the high impedance (taking into account the noise) at the output, results in a filter with a cutoff frequency that is attenuating the noisy components. For the 130nF capacitor, the alligator clip adds extra resistance to the high impedance output so that the cutoff frequency is lowered to a point which also attenuates the noisy frequencies. Correct?
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #12 on: August 12, 2015, 05:20:03 pm »
Yes! Thank you for the detailed explanations. I believe I understand now. The desired signal of 200hz would have a certain impedance at the amplifier stage of the iPhone/laptop. When noise is introduced, that impedance of the amplifier stage is changed. This impedance of the output of the amplifier (regardless if there is noise or no noise) can be viewed as the R when a capacitor is placed in parallel with the output of the amplifier (which forms an RC circuit). Correct?

You're welcome!  We're getting very close here, actually close enough.  But technically, the impedance of the iPhone/laptop amplifier doesn't have only a single impedance, that changes as a whole.  It has many impendances, simultaneously and in parallel, affecting different frequencies and signal/noise separately.  A diagram describes this best:



On the left, we have a very simplified model of what's going on inside the iPhone/laptop.  The signal source comes through at a low impedance of 4.5ohm (using [unitedatoms]' value).  Some noise comes through at that same impedance, but not all; so I've also two additional noise sources, in parallel and with higher impedances; the actual values are just guesses for the demonstration.

On the right, your test setup.  Including one more noise source, RF and EMI picked up from your test leads, breadboard, alligator clips, etc. - with a very high impedance.  Ropt and Copt are some of the extra components you've been experimenting with, initially disconnected.  At this point, due to the very high impedance of the frequency counter input, nothing is attentuated or reduced; signal and noise come through at their maximum possible voltage regardless of impedance.

Add Ropt @ 100ohms.  Note that it forms a voltage divider with each of the source impedances, and consider them separately.  Since the signal impedance is only 4.5ohm, it only attenuates it by 4.3%.  But Noise1, with its 500ohm impedance, is attenuated by 83.3%!  Even more for Noise2, and the RF/EMI noise.

Or add Copt.  Now you have a low pass RC filter, with the impedance of each source providing the R of the RC.  (Though you could also consider C an impedance at any particular frequency, and model its effect vs. the source impedance again as a voltage divider.  Not so useful here, as it only makes things more complicated; but do remember it can be done, there may be a time when you will find it useful.)

I tried placing the 130nF capacitor in parallel with the output of the iPhone without using a breadboard and alligator clips. The counter read 222 hz. If I used a 1uF or 10uF capacitor with the same setup it would read 200hz correctly. If I used one alligator clip to one of the leads of the 130nF capacitor (the other end to the headphone jack), the counter would read 200hz correctly. If I understand correctly, the higher capacitance [1uF or 10uF] along with the high impedance (taking into account the noise) at the output, results in a filter with a cutoff frequency that is attenuating the noisy components. For the 130nF capacitor, the alligator clip adds extra resistance to the high impedance output so that the cutoff frequency is lowered to a point which also attenuates the noisy frequencies. Correct?

It's hard to say what's going on here.  I wouldn't think the alligator clip is adding significant resistance.  Perhaps you have a bit of 50/60hz being picked on your test leads from nearby AC power?  A small C (like 130nF) wouldn't attenuate that much.  A larger C would, and your wanted signal even more, but it could work by reducing the 50/60hz component below the trigger band while the 200hz still remains above.  And the alligator clip, being unshielded, would pick up more 50/60hz; but perhaps due to its physical placement it's picking it up at opposite polarity, and cancelling some of the unwanted interference.

Just a guess.  The scope can tell you what's going on here better than I. ;)
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #13 on: August 13, 2015, 02:23:21 am »
It's hard to say what's going on here.  I wouldn't think the alligator clip is adding significant resistance.  Perhaps you have a bit of 50/60hz being picked on your test leads from nearby AC power?  A small C (like 130nF) wouldn't attenuate that much.  A larger C would, and your wanted signal even more, but it could work by reducing the 50/60hz component below the trigger band while the 200hz still remains above.  And the alligator clip, being unshielded, would pick up more 50/60hz; but perhaps due to its physical placement it's picking it up at opposite polarity, and cancelling some of the unwanted interference.

Just a guess.  The scope can tell you what's going on here better than I. ;)

Your explanation with diagram is great. Much appreciated. Things are a lot more clearer after reading this and looking at the diagram.  I did notice as you mentioned when the probe was near the iPhone charger the counter would pickup the 60hz signal. I tried again with the iPhone  unplugged. With just the 130nF capacitor and it would still read around 230hz. I noticed if I moved the iPhone around I could lower it to around 210-220 hz. With the iPhone still unplugged I tried two alligator cables (one at a time) that have resistances of 0.05 and .16 ohms. With one end of the capacitor connected using the alligator cables the reading was around 199-204 hz (for both cables). I then used an alligator cable with an approximate resistance of 1.20 ohms and the counter read 199-200hz (and rarely showed 201-202hz). With the laptop, using only the 130nF capacitor, the counter read 200hz. As you mentioned, seeing this on the scope would be able to provide more details on what is happening. At this point I'll leave this curiosity as is.

One thing I found interesting is that at higher frequencies such as 10khz, either from the iPhone or laptop, the counter read correctly without the need for any other component. Why would this be?
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #14 on: August 13, 2015, 09:31:14 am »
One thing I found interesting is that at higher frequencies such as 10khz, either from the iPhone or laptop, the counter read correctly without the need for any other component. Why would this be?

I see a similar behavior with my old BK Precision 1803A (with the built-in LPF turned off).  For a high-amplitude sine, once the frequency is also sufficiently high, at most points in the waveform the slope of the signal is fast enough that superimposed noise doesn't have a chance to cross the trigger band going in an opposing direction.  I also think the trigger band voltage is based on a short average of the most recent input, and so lags behind the the leading edge of fast waveforms, increasing noise immunity.  (But while likely, I haven't examined the input stage to verify this is actually the case.)
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #15 on: August 13, 2015, 11:41:46 pm »
I see a similar behavior with my old BK Precision 1803A (with the built-in LPF turned off).  For a high-amplitude sine, once the frequency is also sufficiently high, at most points in the waveform the slope of the signal is fast enough that superimposed noise doesn't have a chance to cross the trigger band going in an opposing direction.

So would it be like the following diagram:



There is a low frequency signal, a high frequency signal, and noise (with trigger points as dots). All signals are the same amplitude. The slope of the high frequency signal is fast enough such that if we superimpose the noise signal, the high frequency signal would still trigger before the noise. And if we superimpose the noise on the low frequency signal, the noise would cause false triggering?
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #16 on: August 14, 2015, 02:50:50 am »
Nice graph!  And a good analysis, but it seems to neglect that the input stage of a frequency counter is AC coupled.

I put together a very simple SPICE circuit to demonstrate how this works.  I suck at hand-drawn graphs, and this way I can let SPICE do the drawing for me. ;)



XFG1: Function generator, 200hz sinewave a 1VAC peak-to-peak (our desired signal).
XFG2: Function generator, 5Khz sinewave at 50mVAC peak-to-peak (a simple noise signal).
J1:  A switch so we can connect or disconnect the noise source.  Starts disconnected.
The circular thing with A,B,C:  Sums together voltages of A, B, and C (not connected), outputs sum voltage on right terminal.  A convenient way of mixing signals.
C1: Most likely the very first component after the input jack of a typical frequency counter.  Since it's in serial with the signal, the signal is AC coupled.
R1: In combination with C1, makes a differentiator, "a circuit that is designed such that the output of the circuit is approximately directly proportional to the rate of change (the time derivative) of the input."
To_Trigger:  Goes to a Schmitt Trigger.  This converts the analog signal to a digital signal, that can be counted by the rest of the digital circuitry.  Using the earlier stated trigger range of 20mV, when the input goes above +20mV, it switches its output to logic high.  It output remains high until the input drops below -20mV, then it goes low.  Until the input goes above +20mV again.  For every two output transitions, the counter adds one to the count.
XSC1: Oscilloscope.  Shows our input signal.  Set to 1V per vertical division.
XSC2: Oscilloscope.  Shows the differentiated signal the Schmitt Trigger will see.  Set to 20mV per vertical division, so you can easily see where the Schmitt trigger responds.

Wikipedia pages for further details on possibly unfamiliar terms:
https://en.wikipedia.org/wiki/Differentiator
https://en.wikipedia.org/wiki/Schmitt_trigger

Let's simulate!  Pay attention to the left half of the displays for now:



We can see the differentiator at work on the 200hz signal.  I've marked two times.  The blue mark shows where the input signal is rising fastest, and you can see the differentiator outputs the largest voltage there.  The yellow mark is the "flat" top of the sinewave where the signal momentarily changes very little, and you can the differentiator outputs near zero voltage there.  While the output is out of phase with the input, it still crosses the triggering voltages twice per 200hz cycle, and all is well.

That is, until I close J1 at the center of the trace, and things rapidly go downhill!  Though there's only 50mV of noise, it's FAST noise.  And since a differentiator responds to rate of change, it goes nuts.  Let's zoom in on that action, showing a single 200hz cycle with overlaid noise:



I'm marked a region here.  Where the Schmitt trigger should have only changed state once, it actually did so FIVE times that I can see.  And it will false trigger more times on the similar region of the second half of the 200hz cycle.  That's why the frequency counter shows neither 200hz nor 5Khz, producing weird readings instead; it all depends on the number of false crossings at these critical regions.

Now let's turn our desired signal up to 10Khz, still 1VAC peak-to-peak.  The noise source remains unchanged and connected:



The output of the differentiator is off the scope.  It's responding even more strongly to the desired signal, which is now both LARGE and FAST.  The actual peak voltage is somewhere around +/- 837mV.  I left the scope set to 20mV per vertical division so that you can see it's triggering correctly, the noise no longer has any effect.

Nothing beats a little real-world experimentation though.  Given that the differentiator is only two components, you easily build one.  Run a signal in, scope the output, and you can get a pretty good idea if the frequency counter will read correctly.  If not, you can try adding a resistor or capacitor to the input as you've been doing, and actually see how well each cleans things up.
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #17 on: August 16, 2015, 03:48:45 am »
I am also very bad at drawing. I took an image of the three sine waves that I found online and wrote on top :P

Thanks for taking the time to put together this simulation! It was very informative. After going through it, I constructed a similar circuit as suggested. I used two function generators to output the signal (200 hz, 2.48V pkpk) and noise (5Khz, 400mV pkpk).  I had slowly increased the amplitude of the noise until the counter at point To_Trigger started to read incorrectly (around 230hz) which resulted in the noise value of 400mV pkpk. The output of each generator was connected to approx. 50 ohms resistors and then the resistors were connected to combine the output. For C1 I used 18.4pF, and R1 approx 2.3MOhm.
 
Attached are the results before the noise and after the noise is applied (measured on the scope at point XSC2).

I placed a low pass filter before C1 and the counter connected at point To_Trigger read correctly (200hz). With the low pass filter removed, at higher frequencies the output voltage of the differentiator was larger and the noise was reduced and the counter would also read correctly.

Questions:

In the attached scope output (both analog and digital) at point XSC2 the midpoint of the sine wave is not centred perfectly however in your simulation it is. Is it because the volts per division is so low on the scope?

At higher frequencies the noise is reduced, which is the result of the differentiator (to my understanding), however I was wondering why the differentiator is used in the first place. I would take from the wiki link you posted that it is needed by the Schmitt trigger with regards to setting the sensitivity limit (in addition to converting the intput to a rectangular logic signal) ?

You mentioned that in the diagram I posted, I neglected to take into account that the input stage of a frequency counter is ac coupled. From what I know ac coupling would remove the dc component (offset). Did you mean that I didn't take into account the differentiator?

On websites that describe how frequency counters work they refer to the input where the signal enters the input amplifier where it is converted into a logic rectangular wave. The input amplifier would therefore consist of a differentitor, Schmitt trigger, in addition to other components?

« Last Edit: August 16, 2015, 04:33:08 am by rstor22 »
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #18 on: August 16, 2015, 05:09:12 am »
Thanks for taking the time to put together this simulation! It was very informative. After going through it, I constructed a similar circuit as suggested.

Excellent!

In the attached scope output (both analog and digital) at point XSC2 the midpoint of the sine wave is not centred perfectly however in your simulation it is. Is it because the volts per division is so low on the scope?

Yup.  Turn off both signal generators.  And then zoom out the time scale.  Bet you'll then immediately recognize what's throwing your trace off center, a bit of 60hz (that right for Canada?) picked up by the scope leads.  SPICE is immune to that. ;)

At higher frequencies the noise is reduced, which is the result of the differentiator (to my understanding), however I was wondering why the differentiator is used in the first place. I would take from the wiki link you posted that it is needed by the Schmitt trigger with regards to setting the sensitivity limit (in addition to converting the intput to a rectangular logic signal) ?

Well, let's assume a frequency counter was DC coupled instead, and the trigger points are fixed at +20mV and -20mV.  That would work fine for an AC input signal centered around 0V.  But what about an AC signal with a large DC offset?  Doesn't work.  Unless you analyze the signal, realize there's a DC offset, and adjust the trigger points accordingly.  But that would be complicated.  It's easier to just AC couple via a differentiator.

You mentioned that in the diagram I posted, I neglected to take into account that the input stage of a frequency counter is ac coupled. From what I know ac coupling would remove the dc component (offset). Did you mean that I didn't take into account the differentiator?

It looked like your diagram was representing each individual signal component separately, with each reaching individual DC trigger points and the behavior of the counter dependent on which component reached a trigger first.  But to be honest I'm not sure, I may have been interpreting it wrong.

On websites that describe how frequency counters work they refer to the input where the signal enters the input amplifier where it is converted into a logic rectangular wave. The input amplifier would therefore consist of a differentitor, Schmitt trigger, in addition to other components?

I've only seen a few real counter schematics, but this was the case in all of them.  What I omitted for simplicity's sake:

1) One more resistor, that shifts the differentiated signal to be centered at 1/2 of the counter's VCC.  For example, if VCC is 5V, then the center is 2.5V.  With all voltages now positive, you can set trigger points at 2.52V and 2.48V, and don't need a negative supply rail.
2) Under/over voltage clamping.  Because you know someone will connect 120VAC, a CB radio, etc.
3) And there's often a high input impedance op-amp, between the differentiator and Schmitt trigger.  Maybe more than one, with some or all providing gain.  This is easier than making a decent Schmitt trigger, with a narrow trigger band, that ALSO has sufficiently high input impedance.

But none of these significantly affect our modelling and prediction, in regards to how a counter will respond to a particular input.  They're only of interest if you plan to build one.
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #19 on: August 16, 2015, 07:00:21 pm »
Yup.  Turn off both signal generators.  And then zoom out the time scale.  Bet you'll then immediately recognize what's throwing your trace off center, a bit of 60hz (that right for Canada?) picked up by the scope leads.  SPICE is immune to that. ;)

Yes we have 60hz mains. I turned off both signal generators and zoomed out on the time scale and then back in. There was a waveform present, on the scope it calculated the frequency as around 60hz (sometimes hit 100hz). I also tried plugging the scope into an isolation transformer and the waveform was still present with similar frequency.

Well, let's assume a frequency counter was DC coupled instead, and the trigger points are fixed at +20mV and -20mV.  That would work fine for an AC input signal centered around 0V.  But what about an AC signal with a large DC offset?  Doesn't work.  Unless you analyze the signal, realize there's a DC offset, and adjust the trigger points accordingly.  But that would be complicated.  It's easier to just AC couple via a differentiator.

I understand, based on your explanation, the advantage of having the signal AC coupled. I thought only C1 was needed for AC coupling. With C1 and R1 you have a differentiator, why is the differentiator required? Can't the input signal be AC coupled by C1 and fed directly to the Schmitt Trigger?

It looked like your diagram was representing each individual signal component separately, with each reaching individual DC trigger points and the behavior of the counter dependent on which component reached a trigger first.  But to be honest I'm not sure, I may have been interpreting it wrong.

I envisioned the main signal centered at 0V and the noise centered at 0V (both having the same amplitude). I figured if the main signal is low frequency there would be a false trigger as the noise would trigger first, and if the main signal was at a higher frequency it would trigger first before the noise. Based on your simulation and the experiment, if I understand correctly, the noise and main signal are not two signals when it arrives at the differentiator but it is combined at some point before hand such that you have the main signal with components of the noise on it (one signal) -- this one signal with the superimposed noise has less chances of triggering falsely when the main signal is at higher frequencies because of the way the differentiator behaves (as shown in your simulation)?
=====

Attached is part of the schematic for my Instek unit. I circled where I believe the capacitor is for AC coupling and where the differentiator is. Would you be able to confirm
if this is correct please?
« Last Edit: August 16, 2015, 09:14:36 pm by rstor22 »
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #20 on: August 16, 2015, 11:28:44 pm »
I understand, based on your explanation, the advantage of having the signal AC coupled. I thought only C1 was needed for AC coupling. With C1 and R1 you have a differentiator, why is the differentiator required? Can't the input signal be AC coupled by C1 and fed directly to the Schmitt Trigger?

Ok, let's say there's no R1.  And the Schmitt trigger has infinite impedance, so it doesn't act like an R.  Both sides of C1 start at 0V.  Then, on the input of C1, feed in an AC signal, with a 10VDC offset.  On the output side (with the Schmitt trigger), you will find the exact same AC signal with 10VDC offset.  Which doesn't do us any good.  A resistor is needed to allow the output side to always drift, at a controlled rate, towards the midpoint of the trigger range.

The C1/R1 combo is also a high-pass filter.  That improves rejection of 60hz, which as you've witnessed is everywhere, unless measured are taken to eliminate it that most would consider heroic. ;)

It looked like your diagram was representing each individual signal component separately, with each reaching individual DC trigger points and the behavior of the counter dependent on which component reached a trigger first.  But to be honest I'm not sure, I may have been interpreting it wrong.

Based on your simulation and the experiment, if I understand correctly, the noise and main signal are not two signals when it arrives at the differentiator but it is combined at some point before hand such that you have the main signal with components of the noise on it (one signal) -- this one signal with the superimposed noise has less chances of triggering falsely when the main signal is at higher frequencies because of the way the differentiator behaves (as shown in your simulation)?

Yes, they're superimposed.  It's only when you analyze the effect of something that behaves differently at different frequencies, like a filter, that you deconstruct the signal into its components to see how the filter acts upon each component.

Attached is part of the schematic for my Instek unit. I circled where I believe the capacitor is for AC coupling and where the differentiator is. Would you be able to confirm if this is correct please?

Yes, that's the AC coupling capacitor.  I stared at the marked op-amp section for a few minutes, and I can't tell if it's an active differentiator.  I'm mainly a programmer.  My analog skills, especially when it comes to op-amps, are actually quite weak.  :-[
 

Offline rstor22Topic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ca
Re: Frequency Counter Measurements and Noise
« Reply #21 on: August 17, 2015, 01:50:42 am »
The C1/R1 combo is also a high-pass filter.  That improves rejection of 60hz, which as you've witnessed is everywhere, unless measured are taken to eliminate it that most would consider heroic. ;) 

I was reading more about this, I didn't know that the same high pass filter is used in scopes for AC coupling:
http://www.phys.ufl.edu/courses/phy4802L/f05/lectures/oscilloscope.pdf

When either the laptop or iPhone is plugged into mains, I found that to get a accurate reading on either the Instek or BK, the counter ground needs to be connected to the ground sleeve of the head phone jack. If I reverse the connection the readings are inaccurate (though if I attenuate the signal both read correctly). If either the iPhone or laptop are unplugged from mains, it doesn't matter which way I probe. When I measure the resistance of the ground (sleeve) wire of the 3.5mm stereo plug (headphone jack) to earth ground for either the iPhone and Laptop (when they are plugged into mains) it is not zero ohms. One device was around 300ohms and the other was around 300kohms *if I recall correctly*.

Does this have something to do with the 60hz mains?

Yes, that's the AC coupling capacitor.

I was basically looking for the resistor to go with the capacitor to form the differentiator... I didn't see one in the circuit I attached so I thought the differentiator circuit was implemented differently... I'm way in over my head as my knowledge is very limited.  I realize that I need to learn the basics to gain a deep understanding of what exactly is going on...
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Frequency Counter Measurements and Noise
« Reply #22 on: August 17, 2015, 05:56:31 am »
I was reading more about this, I didn't know that the same high pass filter is used in scopes for AC coupling:
http://www.phys.ufl.edu/courses/phy4802L/f05/lectures/oscilloscope.pdf

Yes!  Good find.

When either the laptop or iPhone is plugged into mains, I found that to get a accurate reading on either the Instek or BK, the counter ground needs to be connected to the ground sleeve of the head phone jack. If I reverse the connection the readings are inaccurate (though if I attenuate the signal both read correctly). If either the iPhone or laptop are unplugged from mains, it doesn't matter which way I probe. When I measure the resistance of the ground (sleeve) wire of the 3.5mm stereo plug (headphone jack) to earth ground for either the iPhone and Laptop (when they are plugged into mains) it is not zero ohms. One device was around 300ohms and the other was around 300kohms *if I recall correctly*.

Does this have something to do with the 60hz mains?

Sure does.  Both your iPhone and laptop are using AC-to-DC switching power supplies.  Which are not totally isolated as one might expect.  They AC couple GND to neutral (which should normally be within a few volts of earth ground), and VCC to hot.  Check out this page:

http://sound.westhost.com/articles/external-psu.htm

Scroll down to Figure 3 and you'll see these coupling capacitors, both labelled Y1, highlighted in yellow.  I picked this page rather than just a schematic, because it goes into a detailed description on the rationale behind this coupling, if you're interested.  As well as a way it may cause problems, though I've seen some people dispute Elliott's conclusions.

I'm not sure what kind of AC power setup your frequency counters have.  But it's likely the same, or perhaps ground is connected directly to earth ground.  Reverse the test leads as you described and you've created a small path from AC neutral/ground to hot, creating a voltage differential that adds additional 60hz noise.  Disconnect either device from AC, and you break that path.

I was basically looking for the resistor to go with the capacitor to form the differentiator... I didn't see one in the circuit I attached so I thought the differentiator circuit was implemented differently... I'm way in over my head as my knowledge is very limited.  I realize that I need to learn the basics to gain a deep understanding of what exactly is going on...

R602/R604 (right below the circled cap) appear to be the resistors that goes with the capacitor to form a passive differentiator.  It's using two resistors in series, so you can switch the output between two points to provide a selectable -20dB cut.

I've been toying with electronics at a hobby level for, wow, I guess it's been 30 years now.  :o  Didn't get very far in most of that time.  Have gotten much more serious about it in the past five years, but progress is still slow in the analog department.  My mind is organized for programming, which is linear and predictable; so digital comes naturally, and analog does not!  Fortunately I rarely have to do any complex analog work, but I still want to be relatively competent.

What I've been doing for a few years now is imposing challenges on myself in SPICE.  I pick something I want to understand better.  Then attempt to design it using mainly discretes, plus op-amps and comparators only if it's way too difficult to avoid them (although I realize that's part of the reason I'm weak with op-amps).  And I try not to "cheat" by using too much reference material, unless I get truly stuck.

In this environment, you can design and revise quickly, stop time, and have infinite and perfect test equipment at your disposal.  Well, sometimes it's a little too perfect.  Once I have something that appears to work, I make sure to subject it to every kind of simulated exception and abuse it I can think of that it might encounter in the real world, to make sure it REALLY works.  It's great for learning.

I've accumulated dozens of schematics.  Lots of power supplies, either voltage or current limited (or both), both linear and switchers.  Lots of amps, one is a rather strange high power audio amp that's stable with highly capacitive loads (they generally aren't, I just wanted to see if it was possible).  Soft power switches, variable loads, MOSFET gate drivers, voltage level converters.  And so on.  Most I will never build, in the real world it's just so easy to use a dedicated IC that does it all for you, instead of putting together dozens of discretes.  Some I have built, and I'm happy to say worked.  But all have helped me learn.  Often I witness some characteristic or flaw of a component or circuit in SPICE, analyze and try to understand it; then later upon re-reading some electronics related text I finally realize, "oh, THAT'S what they were talking about!"  It's still not intuitive, reading other people's complex schematics is hard, and there are some large holes in my knowledge.  But I'm getting there!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf