Author Topic: Noise Spectral Density (NSD)  (Read 6726 times)

0 Members and 1 Guest are viewing this topic.

Offline macabaTopic starter

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Noise Spectral Density (NSD)
« on: June 13, 2020, 02:49:34 pm »
I recently built a LNA (bandwidth 0.1 to 10hz) and have been measuring various noise sources (such as this) and wanted to investigate the effect of record length.

The NSD is computed with a power spectrum FFT, the results square rooted, and an average taken of many runs. I initially started with a fixed number of points (1Mpts) and did 10s (100kSa/s) record lengths, then tried 20s (50kSa/s) and 50s (20kSa/s) where I discovered the apparent noise dropped each time. I then wondered if this is related to sample rate, so did 10Mpts at 100s (100kSa/s) and it doesn't seem to be related. I also tried different window functions and whilst they can change the trace slightly, it doesn't cause them all to converge to the same level.



I did some reading and it would seem that the longer the record length, the closer to the true NSD (that's my interpretation anyway, not 100% sure).

So what record lengths do datasheets tend to use?

One of the things I've been measuring is the performance of my LT3042 design, which gets close to datasheet specifications and if I took a longer record length, would probably match it perfectly.
« Last Edit: June 13, 2020, 02:57:00 pm by macaba »
 

Offline TexasRanger

  • Contributor
  • Posts: 15
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #1 on: June 13, 2020, 04:37:47 pm »
Hi, you have to average the power spectral density and then take the square root. Also don't use window functions for noise analysis as they alter the power of your Signal.
NSD should be Independent of sampling speed and lenght, for 1/f I usally average like 128 plots over 3 hours at something like 2ksps and for white noise 32 averages are usally suficient.
« Last Edit: June 14, 2020, 10:26:06 am by TexasRanger »
 
The following users thanked this post: macaba

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16710
  • Country: us
  • DavidH
Re: Noise Spectral Density (NSD)
« Reply #2 on: June 13, 2020, 04:55:03 pm »
NSD should be Independent of sampling speed and lenght

I agree.  Something is amiss with the results.

Quote
Hi, you have to average the power spectral density and then take the square root. Also don't use window functions for noise analysis as they alter the power of your Signal.

There is a compensation factor to produce a RBW (resolution bandwidth) of 1 Hz for noise spectral density which depends on the FFT bin width which depends on sampling rate, and the window function.

Also beware of noise higher than the Nyquist frequency aliasing down into the results.

https://www.edn.com/dsos-and-noise/
https://www.edn.com/ffts-and-oscilloscopes-a-practical-guide/
 
The following users thanked this post: macaba

Offline macabaTopic starter

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Re: Noise Spectral Density (NSD)
« Reply #3 on: June 13, 2020, 04:56:57 pm »
Thank you TexasRanger - your insightful post prompted me to check my maths again with your comments in mind - I found I was computing power spectrum, and not power spectrum density.  :palm:
Just running the analysis again...
 

Offline macabaTopic starter

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Re: Noise Spectral Density (NSD)
« Reply #4 on: June 13, 2020, 05:02:27 pm »
That's better!



 

Offline JohnPi

  • Regular Contributor
  • *
  • Posts: 158
  • Country: us
Re: Noise Spectral Density (NSD)
« Reply #5 on: June 13, 2020, 06:10:37 pm »
If you have sampling at (say) 20 kS/s, and you care about PSD in the 10 Hz range you need to ensure there are no significant signals (no significant energy) above (20k-10) == 19.99 kHz, as they will be aliased to your region of interest.

This is not precisely the same as Nyquist frequency (would be 10 kHz in this case), as you don't care about energy that is aliased to frequencies above 10 Hz.

A simple R.C filter should do it. Pick a cutoff above your 10 Hz range (say 100 Hz).

As an aside, I find it easier to manipulate and think of noise in power/Hz, not V/rtHz -- they you don't get confused with sqrt(Hz) calculations and values just add simply.     
 

Offline TexasRanger

  • Contributor
  • Posts: 15
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #6 on: June 13, 2020, 07:16:40 pm »
I don't think that aliasing is a problem here, as the signal already seems to have a lowpass at ~10Hz and even the simplest oversampling filter provide sufficient aliasing rejection for this application (given that your frequency band of interest is well below your sampling rate).

But it really depends on the particular digitizer and its digital and analog aliasing filters.

The datasheet of your digitizer should provide you with information about alias rejection, but you can also just test it with an signal generator at the frequencys JohnPi mentioned.
« Last Edit: June 13, 2020, 07:37:03 pm by TexasRanger »
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3483
  • Country: us
Re: Noise Spectral Density (NSD)
« Reply #7 on: June 14, 2020, 12:22:11 am »
Also don't use window functions for noise analysis as they alter the power of your Signal.

This is not correct.  Implicitly the sample length imposes a window.  Without tapering that is a convolution with sinc(f).  A triangle aka Bartlett window is sinc(f)**2.  Take a look at Wikipedia for a very large variety of windows.  However, you do need to account for the window, whatever it is if you want absolute numbers rather than simply a qualitative picture.

Doing DSP programming in the oil industry I most often used a raised cosine of sufficient width when there was no special requirement for something else.  However, I was not interested in absolute numbers.  My concern was sidelobes.

Have Fun!
Reg
 
The following users thanked this post: TexasRanger

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14336
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #8 on: June 14, 2020, 09:20:50 am »
If one does the noise calculation via the computer, one should also include the analog filtering function. The simple filters are already effecting the signal in the pass band a little. If mainly used for the computer one could consider changing the filters to a wider band. So not just 0.1 to 10 Hz but maybe 0.02 Hz to 100 Hz. At the low end the AC coupling can add some noise in the transition region. A larger resistor to ground to lower the cross over frequency reduces the noise - this may be a little counter intuitive.

For the windowing function I see the main point in avoiding aliasing / side lobes from mains hum. If windowing is used the data sets should be well longer than the minimum 10 seconds to get 0.1 Hz - this alone helps to reduce the side lobes and the effect of the windowing function. It may help to have the ADC sampling well faster then 150 SPS so that the mains frequency is well included and not causing aliasing from the ADC sampling.
 
The following users thanked this post: macaba

Offline macabaTopic starter

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Re: Noise Spectral Density (NSD)
« Reply #9 on: June 14, 2020, 10:16:45 am »
If one does the noise calculation via the computer, one should also include the analog filtering function. The simple filters are already effecting the signal in the pass band a little.

I had the same conclusion. Whilst knowledgable in electronics and programming in general, I am new to volt metrology so I wanted to walk before I ran by building a LNA based on the designs here in the forum (1st order HPF, LT1007/LT1037 x10000 amplifier, 4th order LPF).

I’m planning v2 to simply be 1st order HPF, perhaps switchable for microvolt DC readings, amplifier, AA filter, ADC. The cost saving in removing the 4th order filtering goes along way to balancing the cost of the ADC.

The digital/firmware/processing aspect of this potential v2 design is well within my comfort zone.



« Last Edit: June 14, 2020, 10:34:37 am by macaba »
 

Offline maat

  • Regular Contributor
  • *
  • Posts: 144
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #10 on: June 14, 2020, 01:52:10 pm »
I assume you are after an estimate of the PSD of the noise. I say estimate, because an accurate determination is obviously not possible due to the limited number of datapoints cutting off the integral, hence the use of a window function. Anyway, there is a lovely paper on the matter by Peter Welch: The use of fast Fourier transform for the estimation of power spectra: A method based on time averaging over short, modified periodograms (https://ieeexplore.ieee.org/document/1161901) and to understand what he is doing A Direct Digital Method of Power Spectrum Estimation (https://ieeexplore.ieee.org/document/5392439) . He introduced a method of cutting up the sample into multiple segments and then piecing them back together. This greatly reduces the number of computations required and the overlapping segments used, suppress noise nicely.

Fortunately for everyone, who is not into a boatload of sums and integrals, thare is a nice writeup here : https://www.osti.gov/servlets/purl/5688766/ and there is lovely implementation in scipy which is a no-brainer: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.welch.html

Regarding the window function, I typically use a flat-top window to preserve the amplitudes.
 
The following users thanked this post: julian1, 2N3055

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3483
  • Country: us
Re: Noise Spectral Density (NSD)
« Reply #11 on: June 14, 2020, 01:56:29 pm »
There is a normalization term in the Fourier transform.  In the FFT it can be applied going from time to frequency, from frequency to time or both.  The first 2 use a 1/N term.  The latter is 1/sqrt(N). 

I should have thought of that earlier.  Have a look at the FFT source code or test it with a series of constant amplitude.  If the FFT of a series of ones is 1, then there's a 1/N being applied going from time to frequency.

You also need to be aware of wraparound.  If the first and last values are very different it will distort the spectrum.  To preclude that pad the series to double the length with zeros before doing the FFT.

Random Data
Bendat & Piersol
4th ed

is the canonical reference for these subjects.

Have Fun!
Reg
 

Offline macabaTopic starter

  • Regular Contributor
  • *
  • Posts: 205
  • Country: gb
Re: Noise Spectral Density (NSD)
« Reply #12 on: June 15, 2020, 11:04:44 am »
Thanks for all the links & comments so far - I read them all and had a day of frustrating experimentation.

I tried:
- Different window types, taking in account their corresponding equivalent noise bandwidth factor in the density conversion.
- Bartlett vs. Welch methods.
- Using power spectrum and square root vs. amplitude spectrum only.

The resulting trend shapes all correlate, it's just the amplitude that varied. I would like to get my trends within the correct quarter-order of magnitude.

I decided to look at my LNA noise floor, estimate what the noise density at a certain frequency should be and see what method best matches it.

The 3 dominant sources of noise in the LNA is the input resistor, input voltage noise & +ve input current noise.

My LNA has a 1.5k resistor in the HPF before the opamp, corresponding to 4.9nVrms/rHz (290k). The metal film resistor wasn't selected for low noise, so this is likely to be higher.
As seen in my previous plots, my 10hz LPF filter starts a little too early, so I decided to look at the 6hz frequency point on the LT1007/LT1037 datasheet on the input voltage noise plot.
The input voltage noise at 6hz is approx. 3nVrms/rHz.
The voltage noise due to +ve input current noise (2pArms/rHz) at 6hz is approx. 3nVrms/rHz.

That results in a uncorrelated noise sources sum of 6.5nVrms/rHz. Likely to be a little higher due to input resistor not being wirewound or similar low noise type.

I looked at which method was near to 6.5nVrms/rHz, and found this:



where the noise density at 6hz is 8nVrms/rHz.
The method being: Bartlett, with no window into an amplitude spectrum, RMS averaged over 100x 10 second captures. The average metrics over 100 captures is 22.85nVrms and 116.3nVpp. The downside being the requirement for a high number of captures to get a smooth spectral density line (in comparison to the Welch method which gave very smooth lines but incorrect magnitude).

As a point of interest:



Shows the 10hz rolloff and a small amount of 50hz noise.

I'm aware the maths may not support this fully but I'm mainly after comparisons between devices, and a reasonable level of absolute accuracy (within quarter-order of magnitude of true value).
« Last Edit: June 15, 2020, 11:07:23 am by macaba »
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14336
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #13 on: June 15, 2020, 11:56:46 am »
For testing the LNA own noise one should have a short at the input. In this case the input would nearly shorten out the noise contribution of the resistor. The resistor noise would only come in at the lower frequency end, when the capacitors impedance is no longer small compared to the resistor.

With essentially no DC voltage at the resistor the noise does not depend on the quality of the resistor. For thermodynamic reasons the Johnson noise does not depend on the type of resistor, but only the differential resistance. The difference between poor and low noise resistors comes only with a significant voltage at the resistor.

The OPs noise in the low frequency range can vary between different units quite a bit. For a test it would be better to use the white noise range or an JFET based OP and noise from a resistor as a "reference".
 

Offline mrprecision

  • Regular Contributor
  • *
  • Posts: 86
  • Country: de
Re: Noise Spectral Density (NSD)
« Reply #14 on: November 20, 2020, 08:25:25 pm »
The spectral noise density can also be simple plotted with this tool: https://www.signalanalyzer.de
 

Offline MiDi

  • Frequent Contributor
  • **
  • Posts: 607
  • Country: ua
Re: Noise Spectral Density (NSD)
« Reply #15 on: January 21, 2022, 12:13:38 am »
NSD in python as a starting point for discussion (welch window & overlapping).
Python file & plot attached.

Code: [Select]
import pandas as pd
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from matplotlib.ticker import EngFormatter

## read data from file
#df = pd.read_table (r'NSD of white noise.tsv',
#                    header=None, skipinitialspace=True, names=['value'], encoding='latin1')

num_samples = 1000000
df = pd.DataFrame()
np.random.seed(0)
df['value'] = np.random.random(num_samples)
df['value'] -=  df['value'].mean()           # need to remove DC

## write data to file
#df['value'].to_csv("NSD of white noise.tsv", header=None, index=False)

df['value'].describe()

# sample frequency in Hz
fs = 1

# Welch function gives PSD
f, PSD_welch = signal.welch(df['value'], fs, nfft=8192, detrend=False, window='bartlett', average='mean')

# transform to NSD
PSD_welch = np.sqrt(PSD_welch)

# Plot
plt.subplots(figsize=(15, 10))
plt.plot(f, PSD_welch, label='White noise')
plt.ylim(0.4)
plt.xlim([0.001, fs/2*0.99])
plt.xlabel('frequency in Hz')
plt.ylabel(r'Voltage noise (NDS) in V/$\sqrt{Hz}$')
#plt.semilogx()
plt.loglog()
plt.grid(True, which="both")
formatter1 = EngFormatter(sep="")
plt.gca().xaxis.set_major_formatter(formatter1)
#plt.gca().xaxis.set_minor_formatter(formatter1)
plt.gca().yaxis.set_major_formatter(formatter1)
plt.gca().yaxis.set_minor_formatter(formatter1)
plt.legend()
plt.savefig('NSD of white noise.png')

« Last Edit: January 21, 2022, 12:20:46 am by MiDi »
 
The following users thanked this post: mycroft, TopQuark, citizenrich, miro123

Offline miro123

  • Regular Contributor
  • *
  • Posts: 207
  • Country: nl
Re: Noise Spectral Density (NSD)
« Reply #16 on: January 21, 2022, 08:57:15 am »
1. The Script of MiDi is good starting point.
2. Sample rate must be wisely selected. - OP use -sample rate 10KS/s while LNA is limited to 10Hz - 1Ks/s seem reasonable in this case. Lower sample rate will give as side affect higher ADC  resolution from your acquisition system


« Last Edit: January 21, 2022, 09:16:09 am by miro123 »
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 803
  • Country: gb
Re: Noise Spectral Density (NSD)
« Reply #17 on: January 22, 2022, 12:07:12 pm »
Do you have any standard instruments that you can cross-check the results with?
It can save you days (if now weeks) of going around in circles and having to re-test what you thought were accurate results later on.

I use mostly HP89410A for this sort of tests (LNAs, PDNs, LDOs - using JW 60dB amplifier when necesary.) I love it so much that I replaced frontend opamps and put in LCD instead of CRT.  You can also use audio analysers like R&S UPL, etc.

My point is: when you have settled on a method, cross-check it against something else out there.

Leo
« Last Edit: January 22, 2022, 12:51:07 pm by Leo Bodnar »
 
The following users thanked this post: 2N3055, citizenrich

Offline NaxFM

  • Regular Contributor
  • *
  • Posts: 124
  • Country: it
Re: Noise Spectral Density (NSD)
« Reply #18 on: January 22, 2022, 12:41:41 pm »
I recently built a LNA (bandwidth 0.1 to 10hz)

Can you post the design you used and maybe a few pics? I'm very interested in one for measuring precision voltage sources
 

Offline miro123

  • Regular Contributor
  • *
  • Posts: 207
  • Country: nl
Re: Noise Spectral Density (NSD)
« Reply #19 on: January 26, 2022, 03:12:45 pm »


Inspired by MidI script  I add this function to my library
I still don't figured out the purpose of  Pandas framework. For me it is kind of parasite wrapper over already good numpy and matplotlib
Bij lonng term measurements I use substantiating the signal with LPF instead of mean value in your case anything under 0.01Hz can be removed - same applies for the FFT size. - this numbers are base on hardware limitation of your setup 0.1...10Hz
Code: [Select]
def nsd(self,fs=1):
num_samples = 1000000
np.random.seed(0)
yt = np.random.random(num_samples)
v_dc=  np.mean(yt)           # need to remove DC
yt=yt-v_dc

# Welch function gives PSD
f, PSD_welch = signal.welch(yt, fs, nfft=8192, detrend=False, window='bartlett', average='mean')

# transform to NSD
NSD_welch = np.sqrt(PSD_welch)

# Plot
plt.plot(f, NSD_welch, label='White noise')
plt.title('White noise NSD')
plt.ylim(0.4)
plt.xlim([0.001, fs/2*0.99])
plt.xlabel('frequency in Hz')
plt.ylabel(r'Voltage noise (NDS) in V/$\sqrt{Hz}$')
#plt.semilogx()
plt.loglog()
plt.grid(True, which="both")
#plt.savefig('NSD of white noise.png')
plt.show()

« Last Edit: January 26, 2022, 06:06:19 pm by miro123 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf