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
THRESHOLD would be g force that represents the stationary state.
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.
PS below is a copy of the acceleration data around impact.
Acceleration Bar Chart.pdf (207 KB)
Graph.pdf (338 KB)