I'm working with sensor with amplifier. I can see sensor is suddenly producing very high value, which is affecting the functionality. I'm looking for some algorithm that will eliminate sudden spike values. I'm using embedded c for this project, please suggest me some algorithm that will eliminate sudden spike values using c program.
I tried previous and current value comparison method but it has not solved my problem
You can try a simple moving average filter like
Select N depending on your needs.
I do not know the details of your sensor data. You can change integers with float types if your sensor data is in real numbers.