Member Since: August 7, 2010

Country: United States

  • Did some alterations on .ino. Maybe it runs directly, without alterations now.

  • Arduino code trial uploaded on Github:

    Code was not verified.

  • Matlab code on Github:

    As soon as I have time I will port to Arduino as the code is simple and moving averages have specific libraries already coded.

  • Hi, I did not have time to port to Arduino, but the code is very simple. I am posting today, because is the last day… Approach is three moving averages to smooth the instantaneous acceleration delta and a lower limit to discriminate low acceleration change that is not a hit. Parameters were established on trial and error to better suit the known results. Code was tested on Matlab (have fun):

    cont=0; % hit count delta=0; % acceleration instantaneous delta finalmean=0; % acceleration smoothed firstmean=90; % parameter for first moving average secondmean=110; % parameter for second moving average thirdmean=30; % parameter for third moving average lowerlimit=80; % hits are above this limit for i=1:length(x)-1; delta(i)=abs(x(i+1)-x(i))+ abs(y(i+1)-y(i)) + abs(z(i+1)-z(i)); end; finalmean=movmean(movmean(movmean(delta,firstmean,‘omitnan’),secondmean,‘omitnan’),thirdmean,‘omitnan’); for i=1:length(finalmean)-2; if (finalmean(i+2)<finalmean(i+1)) && (finalmean(i+1)>finalmean(i)) && (finalmean(i+1) > lowerlimit); cont=cont+1; end; end; display(cont);

    x,y and z are your inputs and cont will give you the hits. On Arduino I believe it can count the hit in real time, after less than 1 second of turned on. Results: 3: 77 (77), 4: 81 (81), 5: 91 (93), 6: 79 (79), Mistery 1: 190, Mistery 2: 161.

  • Guess where is the other horn ?

No public wish lists :(