Jobro wrote:Take 8/4/2 adc samples (10bit fullscale = 1023counts), accumulate them into a a 16 unsigned variable. Count should range between 0 to 8184 decimal. Roll that s*** right 3/2/1 times without carry. That is your sample. Send that s*** into the filter I describe below.
Fs=100Hz
Fc=10Hz
4th order fixed point implementation of IIR Butterworth decomposed into 2x SOS (second order systems).
You have answered one of the three questions. Are you interested in MAP or TPS? Is the filter targeted at MAP or mapDOT; TPS or tpsDOT?
In any case, oversampling by 8 or 4 or 2 and using the mean of those samples isn't much of an improvement over using the lag filters. As for using a software bandpass filter, why?
If we're talking TPS, it's just a glorified volume control knob; it's not like the TPS value is itself very important.
If it's MAP, the sound wave effects within the intake tract would certainly make for some interesting analysis, but I would be surprised if the output of a general purpose Butterworth filter was any better than what we have now. The largest fluctuations in the MAP reading aren't noise, they are all (well, mostly, see MAP spike thread) legitimate point samples of the manifold pressure. The code hopes to turn this into a single number well correlated to how well filled each cylinder is going to be. The current algorithm allows the user to pick a part of the engine cycle which will be sampled and the lowest MAP reading in that window is our magic number. It may be that some other heuristic would more closely relate to cylinder filling. Seems to me that this is an interesting area for research.
But doing all this number crunching without a clear model in mind seems to me to be in the same league as astrology.
Have fun,
Rob.