[chbot] Data filter

Charles Manning cdhmanning at gmail.com
Tue May 11 23:37:08 BST 2021


Hi Wallace

There are many forms of filtering and most of them are backed by a whole
lot of theory. One of them that you're using is not.

You've no doubt heard of IIR and FIR filters. Indeed you are using one: an
averaging filter is a type of FIR.

The filtering that deletes the max/min values is sometimes called a median
filter (ie. it is looking for the middle value(s)) and rejecting the
outliers. THis is very handy for spike rejection, especially when followed
by an IIR or FIR to then smooth what's left (like you have).

I would try two things to begin with:
1) Average over more samples.
2) Sample at a higher speed, then down sample back to 30Hz if that's what
you want to work with.


On Wed, May 12, 2021 at 10:12 AM Marshland Engineering <
marshland at marshland.co.nz> wrote:

> This is one of those projects where you learn what is required while doing
> the
> project!!!
>
> Make sure you have had you coffee fix before reading on !!
>
> This is version 2 of my dyno both hardware and software. The old version
> was a
> bought package that used a freq to voltage converter and then an A to D
> converter for the input to the PC but the resolution was very poor and I
> had
> to do a lot of fiddling with higher power bikes to get reasonable data.
>
> My idea with this version is to get as high a resolution as I can, however,
> what this has highlighted is, how many samples do you need for an A4 page
> size
> graph, and what kind of resolution do I need?
>
> Here is my data with my current parameters.
>
> http://www.marshland.co.nz/ftp/Delphi/Plot.jpg
>
> If you have some time to spare, here is my logic and happy for it to be
> picked
> to pieces.
>
> The drum speed goes from 45 to 65 kph over 4 seconds. Or 12.5 to 18 m/s.
> I'm
> sampling at 30 hz
>
> Over the time period, I take 120 samples. That should be enough for an A4.
> The average rate of change of each sample is 0.17 kph or 47 mm/s. If I take
> the 0.17m over the average speed range of 55, it is
> 1/330 or 0.3 %. That is quite optimistic for dyno, but it where I'm
> starting.
>
> Each timing period from the drum represents 200mm on the surface and the
> ATMEGA can count up to 65535 clock cycles in this period.  My resolution
> with
> the ATMEGA is therefore  0.003 mm per clock cycle.
>
> I think I have enough resolution for what I want.
>
> One of the problems is that the wheel to drum, engine speed changes etc are
> not exactly linear. I believe this is where the noise is from, however, the
> data below the noise is valid.
>
> I can improve the plots by fewer samples, ie getting a bigger rate of
> change
> between samples but then my resolution will decrease. Maybe 30 hz is too
> high
> and 0.3 % too optimistic.
>
> If not, what filters can I use to smooth the data ? I've looked at a lot of
> them but creating the maths code to use them is a bit beyond my scope at
> the
> moment.  I'm using Delphi and I cant find any Components for smoothing.
>
> The best I found was taking 10 samples, deleting the max and min and
> averaging
> the rest. If I did that a second time with the result, it wasn't that bad
> but
> still looking for a better solution.
>
>
> Cheers 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20210512/58a9838f/attachment.html>


More information about the Chchrobotics mailing list