# Digital filter selection for sensor

I am having a LM35 sensor which gives $10\textrm{ mV}$ signal per degree rise of temperature. Now I have one question, which digital filter will be the best for this ?

This sensor will be use in very noisy industrial environment. Also digital filter have some cutoff frequency what should be the cutoff frequency set for this filter ? As signal coming from sensor is an analog signal but not a periodic frequency signal.

One I know is FIR Moving average filer. This takes the mean of previous samples. This I do not want to use as I have used it before, $$\frac 1N\sum_{n=0}^{N-1}x[k-n]$$

If I am right then DFT is not required as I am not interested in the spectrum analysis of the signal coming from LM35 sensor.

Is there any other DSP digital filter which I can use ?

• why you need a filter ? please state the problem you are facing with the raw data provided by sensor, I guess then it will be easy for anyone to suggest you the suitable filter. – Arpit Jain Jul 7 '17 at 6:01
• its still not clear. One should specify the cutoff frequency for designing any high/low pass filter. and cutoff will depend on what kind of frequencies will be returned by sensor. that will in turn depend on the process where sensor is used. so basically someone with knowledge of LM35 can help, and then its not kind of totally DSP related question. – Arpit Jain Jul 7 '17 at 6:17
• There are too many sorts of these. Maybe it's a time for you use some beginner book on digital filters? – Andrei Keino Jul 7 '17 at 10:26

It depends a lot on the kind of noise and how fast you need the sensor to track the true temperature, and how fast you need to read the temp.

If you expect large outliers, a median filter is robust to those kinds of perturbations and they can have a relatively short effective window, and a corresponding fast response.

Following the median filter with a conventional low pass is used in some applications.

As was pointed out in the comments, the better you can define your requirements, the better you can make your measurements.

The nice thing about using a median,it is a rank statistic that it is core to nonparametric statistics, where fewer assumptions are made by the underlying probability distribution and there is a large literature on how to design hypothesis tests.

• Thanks for replying..My requirement is not that strict but only thing I know is I have to measure temperature near industrial machinery where very high noise is produced. Wiki says median filter is used for removing noise from image. – user6363 Jul 7 '17 at 15:20
• Then ask Wiki your questions – user28715 Jul 7 '17 at 15:33

If you have the flexibility to alter the circuit, then you can make the problem easier by adding an R-C filter to the LM35 analog output. Temperature changes slowly, so you can take advantage of that.

The sensor drive capability is probably not very strong (thousands to hundreds of thousands of Ohm). if you connect a 100k resistor to the LM35 output, and then add a 1uF Capacitor to a quiet ground, then you can sample that with your ADC.

The corner frequency for a first order low pass filter is

double cornerFreq = 1/( 2.0 * PI * R * C);
// (please excuse me I like C++);


which is about 1.6 Hz I doubt you need to filter below that.

LM35 is a stable chip whose output is not noisy, however, noise may build up while LM35 output is transmitted to ADC input. You must first do your best in minimizing the electrical interference, by adjusting the impedences and adding analog filters if necessary.

Then you may look for mathematical methods to reduce it further after its being ADC converted.

Can you please provide example waveforms? What's the type of noise and what's the general characteristic of the signal you expect to measure ?