<div dir="ltr"><div>Hi Wallace</div><div><br></div><div>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.</div><div><br></div><div>You've no doubt heard of IIR and FIR filters. Indeed you are using one: an averaging filter is a type of FIR.</div><div><br></div><div>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).</div><div><br></div><div>I would try two things to begin with:</div><div>1) Average over more samples.<br></div><div>2) Sample at a higher speed, then down sample back to 30Hz if that's what you want to work with.<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 12, 2021 at 10:12 AM Marshland Engineering <<a href="mailto:marshland@marshland.co.nz">marshland@marshland.co.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is one of those projects where you learn what is required while doing the<br>
project!!!<br>
<br>
Make sure you have had you coffee fix before reading on !! <br>
<br>
This is version 2 of my dyno both hardware and software. The old version was a<br>
bought package that used a freq to voltage converter and then an A to D<br>
converter for the input to the PC but the resolution was very poor and I had<br>
to do a lot of fiddling with higher power bikes to get reasonable data. <br>
<br>
My idea with this version is to get as high a resolution as I can, however,<br>
what this has highlighted is, how many samples do you need for an A4 page size<br>
graph, and what kind of resolution do I need?<br>
<br>
Here is my data with my current parameters.<br>
<br>
<a href="http://www.marshland.co.nz/ftp/Delphi/Plot.jpg" rel="noreferrer" target="_blank">http://www.marshland.co.nz/ftp/Delphi/Plot.jpg</a><br>
<br>
If you have some time to spare, here is my logic and happy for it to be picked<br>
to pieces. <br>
<br>
The drum speed goes from 45 to 65 kph over 4 seconds. Or 12.5 to 18 m/s. I'm<br>
sampling at 30 hz<br>
<br>
Over the time period, I take 120 samples. That should be enough for an A4. <br>
The average rate of change of each sample is 0.17 kph or 47 mm/s. If I take<br>
the 0.17m over the average speed range of 55, it is<br>
1/330 or 0.3 %. That is quite optimistic for dyno, but it where I'm starting. <br>
<br>
Each timing period from the drum represents 200mm on the surface and the<br>
ATMEGA can count up to 65535 clock cycles in this period. My resolution with<br>
the ATMEGA is therefore 0.003 mm per clock cycle. <br>
<br>
I think I have enough resolution for what I want. <br>
<br>
One of the problems is that the wheel to drum, engine speed changes etc are<br>
not exactly linear. I believe this is where the noise is from, however, the<br>
data below the noise is valid. <br>
<br>
I can improve the plots by fewer samples, ie getting a bigger rate of change<br>
between samples but then my resolution will decrease. Maybe 30 hz is too high<br>
and 0.3 % too optimistic. <br>
<br>
If not, what filters can I use to smooth the data ? I've looked at a lot of<br>
them but creating the maths code to use them is a bit beyond my scope at the<br>
moment. I'm using Delphi and I cant find any Components for smoothing. <br>
<br>
The best I found was taking 10 samples, deleting the max and min and averaging<br>
the rest. If I did that a second time with the result, it wasn't that bad but<br>
still looking for a better solution. <br>
<br>
<br>
Cheers Wallace <br>
<br>
<br>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>