Makes a fool of himself on Usenet. Not much money in it, but he's VERY good at it.
Makes a fool of himself on Usenet. Not much money in it, but he's VERY good at it.
Ok, John, So, you have a best possible sample rate of 12Ksamples. You want to get
1000 samples to work with, but you don't want a single harmonic to give you false results. Instead of just a random delay, use some set delays of known frequency to give you a reasonable spread, say 8us, 11us, 14us, 8us, 11us, 14us. Now, to get your 1K samples it will take a little longer, but now you have three data sets you can compare to see if there are any harmonic effects going on. If they don't agree by some reasonable value, resample say at 9us, 11us, 16us and compare all six...So, your BIST takes .4s instead of .2, but only if harmonic effects are noted...
Charlie
Ok, off by a factor 10, 80us, 110us, 140us, etc....
Charlie
I'm not at all interested in your dull and boring life and enterprises.
The green-eyed monster keeps on ranting. Please shut up!
...Jim Thompson
Well, it amuses me.
So, what are you interested in?
John
Didn't have time to read the whole thread but at first glance it looks like this one hadn't come up:
I usually try to figure this stuff out in time domain. Since you know it's a sine wave you could find out where it crosses zero, or some other DC level if the data indicates it's all above or below zero. The data values of each sample pair that straddles zero (or a selected DC level) will indicated where exactly the zero crossing happened on the timeline between these two samples. Now monitor three consecutive crossings and you have the frequency plus the DC offset.
It's *supposed* to be a sine wave, but that's one of the things I'm trying to verify. It should have a predicted average-abs value and a small averaged (offset) value.
The adc sample rate may be above or below the potentially unknown signal frequency, so I can't measure crossings to any useful accuracy.
John
He should change his handle to J. Fred Muggs.
The random sampling interval idea has to be the best - provided you can accept the small amount of "noise" in your results. I don't know how to *prove* it's the best though! I suppose anything less "random" could end up aliasing something, if the input is unknown.
I used a similar trick for measuring duty cycle. I realised you dont need to track the signal and precisely time each edge - just sample when you can and average. (My input was already random so aliasing was not much problem).
But why, when there are computers which will do it for us? Just program up a pseudo-random delay which ranges between 1 and 3 times the minimum possible delay, and simulate it against every possible sine wave frequency you can generate. It'll probably work; and if it doesn't, you'll know. Yeah, it might take an hour or two of simulation time, but so what?
(Things to watch out for are:
1) quantization in the pseudo-random value -- if the clock rate of whatever circuit tells the ADC to start taking a sample is 1 MHz, and your sine wave is 2 MHz, you'll have aliasing no matter what you try; and 2) adding the random delay to a fixed, periodic start time. It's tempting to divide the whole interval of time into 1000 subintervals, and put a random point on each -- but then, since the points can't be too close to each other, you've introduced some sort of periodicity, which might be problematic. Better to just repeatedly compute a random delay and add it to the current time, to get the next time to sample, and stop when you've collected 1000 samples, rather than stopping at a prescribed end time.)
Is an FFT (or a few) out of the question?
--Mac
Computationally, yes; I haven't the resources. But what good would it do? Since the signal frequency may be above or below the sample rate, the spectrum is hopelessly mutilated and folded.
John
That will stop aliassing from generating very unfortunate all top of peaks samples in the worst case scenaro where the sinewave has an exact number of cycles between adc samples. I'd be inclined to use a small pseudorandom delay - frequency sweeping could give you other alias related artefacts.
But it won't help if the frequency is so low that you only get a small number and a half cycles of sine wave in your 1000 sample buffer. You have to also make sure the sums are computed over an integral number of whole cycles of the captured waveform. And it sounds like you know it is a sine wave source - essentially noise free.
Min, max and mdeian might be an alternative way of handling the data. Min, max & median should give you a better handle on peak to peak amplitude and symmetry of the waveform than the rectified average.
It might be easier to low pass filter and rectify with low pass filter in analogue with a slow ADC on the outputs.
Regards, Martin Brown
Looks like a "fuzz up and average long enough" situation then.
Well, here's what I'm thinking. Since you can't do it anyway, I'm not developing it very fully or carefully.
The spectrum is not hopelessly mutilated and folded. If the input is a sine wave, then there will still be a peak in the frequency domain. You just won't know how many times it has been aliased around. That's why you would perhaps want to do two FFT's with different sample rates.
If you have a distinct peak away from DC, then you know you are not aliased to DC, so you can use the height of the peak and the height of the DC bin to get your signal amplitude and DC offset, respectively. If you don't have a peak away from DC, then you know you are either aliased to DC or there is a fault in the signal synthesis. A second FFT with a strategically chosen sample rate will resolve the ambiguity.
There's more to it than this. You wouldn't want to use ONLY the height of the highest bin, you'd want to use the height of the highest bin plus the heights of adjacent bins. And you may not want to ONLY use the DC bin, but the first two bins. Etc., etc.
The other idea I had was to sweep the sample rate linearly. In FFT land, that would smear the signal, and allow you to estimate RMS regardless of aliasing, perhaps. I haven't really thought it through.
Oh well. Have fun. ;-)
--Mac
Have something to add? Share your thoughts — no account required.
Ask the community — no account required