Thanks for your time.
PLEASE NOTE; I am brainstorming here. I have commented twice in this post and both should be read to understand my post Happy to pay for the right advice.
Here is what I would like to do.
I would like to isolate/identify data values from an input sensor, then serial print the data that meets the condition I have.
The data is from an accelerometer, and I want only the acceleration data from an impact that occurs between two objects.
My accelerometer is connected to one of the objects.
There are periods where the object may move and not make an impact which is 'noise'. I only want to view the impact data, when an impact occurs.
Here is my thoughts on how to do it (also see below for further explanation of unique data point that identifies an impact in acceleration figures.
If acceleration is greater than some THRESHOLD,
AND the current acceleration figure B is opposite in direction to the previous figure A and figure C, where the order of events/data points is A,B then C
THEN print all data from acceleration data (before and after) THE EVENT which is above THRESHOLD
Where the
THRESHOLD would be g force that represents the stationary state.
Please note;
Figure B is attached excel spreadsheet cell 43
Figure A at cell 42
Figure C at cell 44
I have attached data from a specific event in the serial print data feed (from an MPU6050 accelerometer output) that I would like to have a function/method to isolate and print each time it occurs.
I noticed at the moment of impact the acceleration changes direction, then reverts to the same direction at the next available data point. The attached excel spreadsheet graph demonstrates what I am saying nicely. See the graph and excel cell value 43. I had to screen shot excel data and graph as the forum does not accept excel spreadsheet attachments.
The green data is the acceleration, the yellow is the moment of impact, and the red is the deceleration. Note the sign of the values simply indicated the direction of the g force.
What would be some suggested methods to isolate and serial print the data from the impact event, which only triggers printing results to the serial monitor when the events occurs? I am only interested in capturing the impact event.
My thought was to create a trigger/condition for serial print based on the below.
First is that possible to do in Arduino sketch? If not, what would be the alternatives?
Any suggestions would be greatly be appreciated and suggestions on how such a function could be written.
Best regards,
PS below is a copy of the acceleration data around impact.
-0.01
-0.04
-0.07
-0.07
-0.12
-0.16
-0.17
-0.24
-0.27
-0.29
-0.3
-0.31
-0.33
-0.35
-0.39
-0.4
-0.44
-0.51
-0.54
-0.54
-0.56
-0.58
-0.6
-0.66
-0.67
-0.72
-0.8
-0.89
-1.04
-1.27
-1.48
-1.73
-2
-2
-2
-2
-2
-2
-2
-1.66
-0.97
1.97
-1.89
1.2
2
2
2
2
2
2
2
1.8
1.63
1.3
0.82
0.39
0.06
Acceleration Bar Chart.pdf (207 KB)
Graph.pdf (338 KB)