[chbot] Filter

Charles Manning cdhmanning at gmail.com
Wed Oct 17 22:58:12 BST 2018


Mark's suggestion (averaging) is the simplest form of a FIR filter.

A very simple IIR filter is as follows:

output_value = filter_sum >> 4;
filter_sum = filter_sum - output_value;
filter_sum = filter_sum + input_value;

Quite often what you're trying to kill is just a very noisy glitch. eg.
20, 22, 18, 78, 24, 21, the twenty-something values are Ok, the 78 is not.

For that you don't want to use a FIR or IIR because these cook the noise
in. Instead you want to use a median filter which looks at the last, say, 5
values and picks the middle value. This eliminates outliers (like the 78).



On Thu, Oct 18, 2018 at 10:28 AM Richard Jones <richardandjanej at gmail.com>
wrote:

> Hi Wallace,
>
> Maybe a little more context is required to understand the measurements
> being taken and the problem that you have with the results.
>
> Is this static measurement data that you wish to filter, or real time
> samples with frequency domain filter, or maybe you wish to do a curve fit?
>
> Richard Jones
>
> On Thu, Oct 18, 2018 at 10:20 AM Mark Atherton <markaren1 at xtra.co.nz>
> wrote:
>
>> Take 32 readings, add them together, divide result by 32 (or however
>> long you can tolerate waiting).
>>
>> Need to be very careful about overflow. What is your basic data-type ?
>>
>> Can't think of a simpler filter than averaging...
>>
>> -Mark
>>
>>
>> On 18/10/2018 9:03 AM, Marshland Engineering wrote:
>> > I need to do some software filtering. I'm reading a camshaft with a
>> 0.001
>> > linear scale and there is quite a bit of noise in the data. Looking on
>> the web
>> > has left me non the wiser. Rectangular or Triangle filters are an
>> option but
>> > these will loose some data integrity. The profile is a very gentle
>> curve with
>> > the data around the ctr line.
>> >
>> > I hoping for something simple !!!!
>> >
>> > Thanks Wallace.
>> >
>> >
>> > _______________________________________________
>> > Chchrobotics mailing list Chchrobotics at lists.ourshack.com
>> > https://lists.ourshack.com/mailman/listinfo/chchrobotics
>> > Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
>> > Meetings usually 3rd Monday each month. See http://kiwibots.org for
>> venue, directions and dates.
>> > When replying, please edit your Subject line to reflect new subjects.
>>
>>
>>
>> _______________________________________________
>> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
>> https://lists.ourshack.com/mailman/listinfo/chchrobotics
>> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
>> Meetings usually 3rd Monday each month. See http://kiwibots.org for
>> venue, directions and dates.
>> When replying, please edit your Subject line to reflect new subjects.
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20181018/cff617f5/attachment-0001.html>


More information about the Chchrobotics mailing list