# Am I getting DC bandwidth correctly?

I am computing Johnson and shot noise in a DC circuit, where I have an Arduino Due sampling with "delay(100);", i.e. at 10Hz.

Sampling rate and bandwidth follow Nyquist sampling theorem. According to this theorem, the sampling rate should be at least twice the bandwidth of the input signal. Since our sampling rate is 10Hz, the bandwidth should be $$5\text{Hz}.$$ Is this correct? Does this mean that many sources of noise just disappear if I add a large enough delay to my code? What is the correct answer for the bandwidth?

• No, noise will just get aliased. – Matt Young Jun 16 '15 at 18:06
• oh if only that was true – JonRB Jun 16 '15 at 18:06
• Very slightly less. Using a timer to trigger the ADC will allow you to have an exact rate. – Ignacio Vazquez-Abrams Jun 16 '15 at 18:31
• He means exactly 10 Hz, not 9.98 Hz or some other value. – The Photon Jun 16 '15 at 19:14
• There is no magic. Signals at higher frequencies (including noise) get 'wrapped around' when you sample. The only way of eliminating signals outside of the the band of interest is to filter them with a real (hardware) filter. – copper.hat Jun 16 '15 at 19:25

Frequencies work differently than that.

As pointed out in the comments to your question, your noise will just alias into the bandwidth you do have. Aliasing means that a frequency you should be seeing gets interpreted as a lower frequency because your bandwidth isn't large enough.

The nyquist frequency is intended to determine what you will be able to see/detect in a meaningful way, without mistaking the waveform. Of course, only for a sine. If you want to see a square wave of 5Hz, you need much more than 10 samples per second.

As for your noise issue; you cannot "sample away" noise by just downgrading your sampling rate. In fact, a great way to get rid of noise above your signal of interest is something called oversampling. Not undersampling.

Imagine, if you will, there being a 11Hz pure sine noise component. Let's say at t=0ms it crosses the 0 upwards, like a neat sine function of t. At t=22.7ms it's maximum value. At 45.5ms it's 0 again. At 68.1ms it'll be maximum negative. At 90.9ms it'll be 0 again.

And so on.

Let's also say your first sample was at t=0ms.

At 100ms your noise has gone through 1.1 cycle, so it's a bit above 0. so you sample that. Then at 200ms, it's gone through 2.2 cycle, so it's a bit more above 0. and so on and so on, until after 10 samples you have seen it go up once, go back down, cross through 0 and seen it go negative and up again. In effect in 10 samples your system has seen 1 full cycle, while in effect the signal was 11 cycles. So your system says "Oh, that's a 1Hz signal!"

Now imagine there being infinitely many different frequencies.

Can you see how they all will get mistaken as different frequencies that do exist within your sampling band of 5Hz? In effect you are compressing the noise frequencies into a smaller band, so the noise level will stay about the same, but the noise will be "more dense".

If you do over-sample and then take the average, because noise is random to your sampling system, you will effectively add/subtract the noise to itself. So for every 1 sample you want you take 100 and get the average.

If you simplify the noise again, let's say you take 30 samples and average them to get one value, you sample 10 times per second exactly. So you get 1 average value per three seconds that you use. Let's now say you have 1VDC signal and 1VAC noise.

Let's take 15Hz noise, that's at 0 exactly at sample 1):

• Sample 1: 1V + 0V = 1V
• Sample 2: 1V + 0.40V = 1.4V ( noise = sin( (n/15) * 2 * pi ) with n = sample number )
• Sample 3: 1V + 0.74V = 1.74V
• Sample 4: 1V + 0.95V = 1.95V
• Sample 5: 1V + 0.87V = 1.87V
• Sample 6: 1V + 0.59V = 1.59V
• Sample 7: 1V + 0.21V = 1.21V
• Sample 8: 1V - 0.21V = 0.89V
• Sample 9: 1V - 0.59V = 0.41V
• Sample 10: 1V - 0.87V = 0.13V
• Sample 11: 1V - 0.99V = 0.01V
• Sample 12: 1V - 0.95V = 0.05V
• Sample 13: 1V - 0.74V = 0.26V
• Sample 14: 1V - 0.41V = 0.59V
• Sample 15: 1V - 0V = 1V

This repeats for the next 30 samples, so 30 samples added together gives you a value of about 29. (I forgot to press M+ on my calculator when calculating the sine values, so I added the rounded numbers above to come to 14.1 for one set of 15 samples, is 28.2 for 30 samples and just liberally rounded up for good measure).

That 29 divided by 30 gives you a neat approximation of the DC voltage of 0.9667V without ever reflecting any of that pesky 15Hz. And the 15Hz even completely suppresses your DC at its negative peak!

If you'd oversample by a factor of 100 or 1000 you'd be even better off, but even with a factor 4 or 10 you'll already be suppressing a lot of noise.

By then increasing the sample frequency you do open up the bandwidth for your noise a little, but you'll still be much better off than sampling at your original 10Hz and not oversampling, because not-oversampled you just get all the noise aliased into your 5Hz signal band, oversampled your initial signal band becomes wider, which allows for more noise components, but the averaging than smashes away the vast majority plus most of the noise that you previously aliased in.

Basically the best noise free DC sampler would be an ADC sampling at infinite-terra-herz and averaging over infinite seconds. Because all noise would be perfectly sampled and represented, but then averaged away over itself, from yocto-herz to yotta-herz.

But I don't think you want to wait for infinite seconds to see your signal, so just oversampling a little and accepting a few mV of error will be your best bet.

One important note: If your noise is so strong that it clips, i.e. hits the minimum or maximum value of your ADC, but not both equally as much, you will get an offset.

But this answer is already way too long, so I will leave you just with the warning: Make sure your noise is small enough to fit inside the sampling voltage range of your ADC and averaging will take care of the vast majority of it.

• Very nicely done. – bitsmack Jun 16 '15 at 21:56