13
\$\begingroup\$

I have a data acquisition board(A/D+Digital Signal Processor) and I want to check if a digital high-pass filter(implemented in DSP) at an extremely low cut-off frequency(0.05Hz) is actually working.

If this was a frequency I could generate with a signal generator it'd be easy to check, but 0.05Hz is too low and I can't generate it. How do engineers check this kind of filters?

\$\endgroup\$
  • 3
    \$\begingroup\$ My mind is blown by this question and it's answers! I have never considered filtering this low of a frequency :) \$\endgroup\$ – bitsmack Jan 31 at 2:20
  • 6
    \$\begingroup\$ @bitsmack I've seen a 50 milliHz high-pass in an electrogastrography (EGG) instrument. \$\endgroup\$ – Nick Alexeev Jan 31 at 4:35
  • \$\begingroup\$ Some signal generators have both the MHz button and the mHz button. \$\endgroup\$ – AndrejaKo Jan 31 at 7:06
  • \$\begingroup\$ Can you feed a testing signal in a digital form into the DSP? It is easy to generate any frequency in a digital form. --- The drawback is that you will not test the analogue and A/D part of the board. \$\endgroup\$ – pabouk Jan 31 at 8:55
  • 1
    \$\begingroup\$ @bitsmack It means you'd have to wait a long time before things settle out and "sweeping" has to be very slow (hours and hours) but it's good to test the actual real-time performance at least once before trusting it will work slowed down (after testing it sped up). Things like aliasing can rear their heads. \$\endgroup\$ – Spehro Pefhany Jan 31 at 12:49
18
\$\begingroup\$

I guess it depends on several factors, among others the order of the filter, but you have a few possibilities:

  1. Find a signal generator that gets there. These are rather inexpensive nowadays.
  2. Trust the math. This is a digital filter and as such it scales with sampling rate. If you can increase the sampling rate by two orders of magnitude you would have a filter with a 5Hz cutoff, much easier to measure. Likewise, if the limiting factor becomes the ADC you can isolate it from the filter and feed in some artificial digital data.
  3. Use a step response (many wideband signals would do). Calculate the step response of your desired filter and compare with the result. Or, alternatively, compute the frequency response by means of the FFT of the step response.

We use a variation of alternative 3 in some of our test setups, not because we cannot generate the slow waveforms required, but because the <0.01Hz cutoff of our analog filters would take way too long to characterize if we tried even a rough frequency sweep. This reduced the testing time from more than an hour to mere minutes.

\$\endgroup\$
10
\$\begingroup\$

I would use my Agilent function generator, which goes down to 1\$\mu\$Hz, a fairly unremarkable (and obsolete) Model 33522A. My Rigol DG4102, I think, similarly has 1\$\mu\$Hz resolution and cost less.

Unfortunately, you can't get that low with cheap DDS (eg. AD9850) modules because the tuning word is only 32 bits and the clock is typically 125MHz, so that's 0.03Hz resolution. I suppose it would give you a few data points (0.0291/0.0582/0.0873 Hz)

You also could feed it a step and look at the time domain response.

\$\endgroup\$
  • 2
    \$\begingroup\$ If your DDS module can take an external clock signal, simply underclock it! A DDS is really a very fancy divide-by-N at heart.... \$\endgroup\$ – ThreePhaseEel Jan 30 at 23:53
  • 1
    \$\begingroup\$ @ThreePhaseEel You can do that but it won't be a very nice output in general unless you redesign the output low pass filter, which is typically something like a 5-pole LC elliptical filter. In the case of OP, since the maximum frequency is so low, he or she could probably just add a 1Hz low pass RC filter to the output and get a nice signal. \$\endgroup\$ – Spehro Pefhany Jan 30 at 23:58
  • \$\begingroup\$ Agreed that you'd need a postfilter -- AD9850s have a minimum clock of 1MHz btw, which is a bit limiting, but still plenty enough to get the results the OP wants \$\endgroup\$ – ThreePhaseEel Jan 30 at 23:59
  • \$\begingroup\$ @ThreePhaseEel Sure, even 8 or 10 MHz would yield resolution of 0.002 or 0.0024Hz. \$\endgroup\$ – Spehro Pefhany Jan 31 at 0:17
6
\$\begingroup\$

Option 1: Test on the PC.

If your DSP code is written in C, then you can set up a test harness in GCC or Visual Studio. You know the sample rate for your DSP code, so use Excel to generate a test input CSV file, and have your test harness dump a CSV file output which you can check.

Option 2: Test on the DSP with a PC interface.

If your DSP code has to run on the DSP, you can still use the PC to test it. Set up a test harness on the DSP which receives a value from the PC, runs one step of the DSP filter, and then reports the filter output for that step back to the PC (using USB, RS-232 or TCP/IP depending on how you're connecting to the DSP). You'll also need a PC-side test harness to send and receive those values. Again, you can set up a test input CSV file on the PC, pass successive samples to the filter code, and dump a CSV file output which you can check.

For both...

If you're filtering at 0.05Hz, chances are your sample rate is going to be fairly slow too. Using a test harness will let you run these tests faster than real-time, which will make your testing process more efficient.

\$\endgroup\$
5
\$\begingroup\$

If you have a D/A converter as well in your DSP system, you could generate this extremely low frequency signal in software an feed it back to your A/D input. Alternatively you could use a D/A Card or USB Adapter to generate the signal. One example of such devices would be LabJack but there are many more with varying price/capabilites out there. Another possibility would be to use a cheap micro controller + DAC like Raspberry Pi or Arduino

\$\endgroup\$
2
\$\begingroup\$

If this was a frequency I could generate with a signal generator it'd be easy to check, but 0.05Hz is too low and I can't generate it. How do engineers check this kind of filters?

There are three good ways to check for filter response, one is a dirac delta function (a impulse function or short pulse), the other is a step input, and the last one is a frequency sweep.

With the instruments I use the experiments can last from weeks to months, some of our physical systems have a response in the days range. The best way to check these systems\filters is to use a step input, then measure the time constant. If you remember the time constant for a voltage input is:

$$ V(t) = V_0 (1-e^{-t/\tau})$$

Where \$ \tau=RC\$

enter image description here
Source: http://mit6002.blogspot.com/2011/05/1011-parallel-rc-circuit-step-input.html

(the pic has a current source with a parallel resistor which is equivalent to a voltage source with a series resistor)

\$\endgroup\$
0
\$\begingroup\$

You could probably generate a tolerably smooth 50 mHz signal by hand using a potentiometer and a wristwatch.

Alternatively, calculate the expected step response of your filter. Give your hardware a step input by flipping a switch. Plot the output over a minute or so (if your oscilloscope timebase won't go that slowly, videotape a multimeter and transcribe the readings every second). Compare the measured step response to what you predicted. If they match (closely enough, accounting for ADC / DAC / timing inaccuracies) then your filter is working as designed.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.