Ok be gentle with me as Im pretty new to this. Basically I am implementing some C++ code to measure a strain guage signal. I am currently in the process of proving the FFT works ok and am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt amplitude the resulting spectra I output has a peak at 50Hz, but of a much lower amplitude than I would expect, but also a very large DC component. I can explain away the lower amplitude at 50Hz through windowing effects, but am at a loss to explain the DC component. I am using a signal generator to produce the sine wave and on analysing this with my LMS equipment I can find no DC to be present. If anyone can help me with this Id be very gratefull. Regards, Andy
DSP Newbie DC in FFT Question
Started by ●December 18, 2003
Reply by ●December 18, 20032003-12-18
Andrew wrote:> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present. > > If anyone can help me with this Id be very gratefull.My first suspicion would be that the input samples are not represented in the numeric format the FFT expects. For instance, if the CPU's word width is wider than the ADC's, you could be pumping them into the CPU by zero-padding the ms bits instead of sign-extending them. You should be able to eyeball the input data to see if this explanation is close. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (703) 779-7770 The secret to enjoying your job is to have a hobby that's even worse - Calvin's Dad
Reply by ●December 18, 20032003-12-18
Andrew wrote:> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present. > > If anyone can help me with this Id be very gratefull. > > Regards, > > AndyAndy, Strain gauges are typically parts of bridges. How and where do you inject the signal grom the oscillator? id the oscillator's ground reference offset from the sense amplifier's? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●December 18, 20032003-12-18
Presumably the adc stage has also been checked out for DC offset? The spectral leakage from windowing could be the culprit, if the frequency is v low with respect to the sample rate, and the window is too small. You would want ~several~ periods of the waveform in the window. So what is your sample rate and fft window size? Richard Dobson Andrew wrote:> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present. > > If anyone can help me with this Id be very gratefull. > > Regards, > > Andy
Reply by ●December 18, 20032003-12-18
On 18 Dec 2003 03:14:46 -0800, andrew.d.metcalfe@holset.com (Andrew) wrote: Hi,>Ok be gentle with me as Im pretty new to this.Don't worry. We don't bite (unless you take our food dish away).>Basically I am implementing some C++ code to measure a strain guage >signal. I am currently in the process of proving the FFT works ok and >am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt >amplitude the resulting spectra I output has a peak at 50Hz, but of a >much lower amplitude than I would expect, but also a very large DC >component. I can explain away the lower amplitude at 50Hz through >windowing effects, but am at a loss to explain the DC component.Adding my two cents to this thread: It would be nice to know the exact values of your FFT's DC & 50 Hz components. What does "a very large DC component" mean? How many cycles of the 50 Hz signal are you applying to your FFT? The fewer cycles, the larger the relative DC bias of the signal you're FFTing. Ya' know, the FFT's DC component will be proportional to the size of the FFT. What your FFT size? I'd very carefully check the data samples you're applying to the FFT - what's their average (mean) value. As you know, we want that average to be as close to zero as possible.>I am using a signal generator to produce the sine wave and on >analysing this with my LMS equipment I can find no DC to be present.Andrew, when you say "LMS equipment", do you mean the "LMS North America" company that makes noise & vibration testing systems? Are you, by any chance, using their "SCADAS III" acquisition system? Thanks, [-Rick-]
Reply by ●December 18, 20032003-12-18
andrew.d.metcalfe@holset.com (Andrew) wrote in message news:<6f5e8cb4.0312180314.4338923c@posting.google.com>...> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present. > > If anyone can help me with this Id be very gratefull. > > Regards, > > AndyHi Andy. I'm a bit curious, what does a strain gauge look like? I'm asking in earnest, I have never seen one of those devices and wonders what it takes to make it work. Suppose you measure the vertical strain in the chain of a pendulum. I would expect that there would be a substantial DC due to the gravity. Perhaps your experiment works in some similar manner, that the strain gauge is "pre-strained" and the signal oscillates on top of this DC background? Rune
Reply by ●December 19, 20032003-12-19
hi ... I think Jim is quite correct ... DC value should be zero, unless you offset the sinewave with a DC value. If you zero pad the input data, basically you are doing something like ABS(sinewave). This will results in a DC value present. Have a nice day. Jim Thomas <jthomas@bittware.com> wrote in message news:<vu3g70cp64i730@corp.supernews.com>...> Andrew wrote: > > Ok be gentle with me as Im pretty new to this. > > > > Basically I am implementing some C++ code to measure a strain guage > > signal. I am currently in the process of proving the FFT works ok and > > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > > amplitude the resulting spectra I output has a peak at 50Hz, but of a > > much lower amplitude than I would expect, but also a very large DC > > component. I can explain away the lower amplitude at 50Hz through > > windowing effects, but am at a loss to explain the DC component. > > > > I am using a signal generator to produce the sine wave and on > > analysing this with my LMS equipment I can find no DC to be present. > > > > If anyone can help me with this Id be very gratefull. > > My first suspicion would be that the input samples are not represented > in the numeric format the FFT expects. For instance, if the CPU's word > width is wider than the ADC's, you could be pumping them into the CPU by > zero-padding the ms bits instead of sign-extending them. You should be > able to eyeball the input data to see if this explanation is close.
Reply by ●December 19, 20032003-12-19
andrew.d.metcalfe@holset.com (Andrew) wrote in message news:<6f5e8cb4.0312180314.4338923c@posting.google.com>...> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present.Hi Andy, I noticed a similar problem that I reckoned was cause by the windowing. I think it really depends on ho many cycles of the 50Hz are included in your sample. Lets take the case of only one cycle as an extreme case. If your samples start at a zero crossing then the window causes no real problem. If however the sample window starts at a negative peak then the window function will trim the starting negative peak and the ending negative peak while leaving the central positive peak almost untouched and thus you will have a DC offset. This DC offset will vary from depending on the phase of the starting point of the sample window compared to the sampled signal. Note that this effect is reduced as the size of the sampling window increases relative to the wavelength of the signal. Regards Robert
Reply by ●December 19, 20032003-12-19
andrew.d.metcalfe@holset.com (Andrew) wrote in message news:<6f5e8cb4.0312180314.4338923c@posting.google.com>...> I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component.Ouch, here's a detail I missed when I first replied to your post. You should be very, very careful when you process data with the intention of regenerating, say, the voltage of your signal generator in the analysis. There are all sorts of conversion constants involved in a system like the one you have sketched, including voltage -> strain (driving cirquit) strain -> voltage (straing gauge) voltage -> binary (ADC) and so on. These are not including various losses, say, between the strain gauge and the ADC. If you want to recreate the signal generator voltage settings in your analysis, you have to take great care in calibrating your system. To what little extent I know about calibration, it could be a nightmare. Usually, one prefers to run uncalibrated analyses, where one use data that are as accurate as possible to within an unknown constant factor. So, "weird" numbers for voltage in your uncalibrated system is due to unknown conversion factors. Windowing will cause wider spectral peaks. Rune
Reply by ●December 19, 20032003-12-19
"Andrew" <andrew.d.metcalfe@holset.com> wrote in message news:6f5e8cb4.0312180314.4338923c@posting.google.com...> Ok be gentle with me as Im pretty new to this. > > Basically I am implementing some C++ code to measure a strain guage > signal. I am currently in the process of proving the FFT works ok and > am encountering a problem. If I feed in a 50Hz Sine wave of a 5 volt > amplitude the resulting spectra I output has a peak at 50Hz, but of a > much lower amplitude than I would expect, but also a very large DC > component. I can explain away the lower amplitude at 50Hz through > windowing effects, but am at a loss to explain the DC component. > > I am using a signal generator to produce the sine wave and on > analysing this with my LMS equipment I can find no DC to be present. > > If anyone can help me with this Id be very gratefull.Andy, An arbitrary length sample of the sinusoid will have a dc component unless exactly an integer number of cycles are taken. As the number of cycles increases, it's a smaller relative component. Imagine 1-1/2 cycles with 2 positive half cycles and 1 negative half cycle. There's quite a positive dc component! Fred






