Author Topic: FIR FILTER  (Read 1886 times)

0 Members and 1 Guest are viewing this topic.

Offline lorenrusTopic starter

  • Regular Contributor
  • *
  • Posts: 64
  • Country: it
FIR FILTER
« on: July 22, 2021, 03:06:49 pm »
Hello everybody

I'm here to ask you for your opinion.

in practice I have an ADC that has its own reference voltage. To this reference voltage, when the temperature reaches a certain value, a ripple of 128mVpp and a freq equal to 10khz are added. The data that the ADC converts, including the core temperature, I send them over the CAN to view. But when you add this ripple the values that are plotted are out of order.

I cannot add a HW filter to the reference output because the card has already been made.

A colleague proposed to put a FIR filter on the samples converted by the ADC, before being sent over CAN. But in my opinion this does not make sense, because I apply the filter on an analog signal which I then sample and filter and not on digital samples?

Quite right ?

Thank you
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8170
  • Country: fi
Re: FIR FILTER
« Reply #1 on: July 22, 2021, 04:49:23 pm »
Well, if the error signal is always reliably at 10kHz, and you can guarantee no other errors happen - this is very strange, by the way; you should try to eliminate the 10kHz error signal to begin with -;

then indeed a FIR filter would be excellent at filtering that 10kHz away. Of course assuming no signal of interest is near that frequency.

For this to be possible, the ADC needs to sample at very least at 20ksamples/s (so that Nyquist is at 10kHz) but more is preferable.

I'm assuming you have no interesting content above 10kHz, so you need a lowpass. Design the FIR in Matlab or Octave or with some online tool, apply to the ADC samples, send through CAN.

A so-called decimating FIR filter may be what you need if you don't want to output 20ksamples/s to CAN which would hog all your CAN bandwidth.

Decimating FIR filter is like calculating FIR for every sample then dropping some, for example send out only one of eight samples. A specialized "decimating FIR" is an optimization reducing amount of unnecessary CPU work by only calculating those samples that are not removed.

In any case, filtering out an unknown source of error signal which shouldn't exist in the first place is asking for trouble.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16611
  • Country: us
  • DavidH
Re: FIR FILTER
« Reply #2 on: July 22, 2021, 07:13:51 pm »
What sample rate can you achieve?

Even if your sample rate is too low to prevent aliasing, you may be able to filter out the interference if it is sufficiently narrow.  How stable is the 10kHz ripple?
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1168
  • Country: de
Re: FIR FILTER
« Reply #3 on: July 22, 2021, 07:58:56 pm »
In the first place I'd analyze the signal in the frequency domain, i.e. capture a sequence of contiguous samples (as may as you can buffer, say a few thousand - the more the better), save them into a file and and do a FFT (in Matlab, Octave, numpy, or howsowever). Then you will see which frequency regions are actually "polluted", and you have a basis for designing the filter.

Edit: What is the sampling rate? And what is the desired bandwidth of the wandted signal? If the frequency components of the ripple1) happen to overlap with the wanted frequencies, then it will be hard to separate them with a filter.
Furthermore, what MCU is it? Is is fast enough to run the filter?

1) after potentially down-folding them to 0...fs/2
« Last Edit: July 22, 2021, 08:12:56 pm by gf »
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: FIR FILTER
« Reply #4 on: July 22, 2021, 08:08:03 pm »
To this reference voltage, when the temperature reaches a certain value, a ripple of 128mVpp and a freq equal to 10khz are added

When you say "added", is this a deliberate act, or something that just seems to happen for reasons you've not yet identified?

I have a rule; anything you observe but don't understand must be investigated, because if you don't, it'll come back and bite you on the ar*e later on.

I'd start by checking the power supply.
 
The following users thanked this post: Siwastaja


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf