Hello guys! I am trying to use the linear acceleration data to calculate the velocity. However, as far as I know, when I review the linear acceleration data, it doesnt seem correct.
I am using Esp8266 and Mpu6050 sensors.
Please find my code enclosed below in the attachment.
Here is the results(Yaw data you see blow is actually acceleration of x axis.(I modified the code)It supposed to be around 16000-17000 when the sensor is held parallel to the ground.(The sensor is fixed and parallel to the ground, however, these values come.))
As I mention above, these values are achieved when the sensor is fixed. How can I solve this problem? I also changed the offset values, using another programme which detects the offsets but it didnt work.
Is there anyone who can help me? Actually I am trying to remove earth gravity from the accelerometer data so I can calculate the velocity. Can someone please show me a way to do it?
If the accelerometer X (or Y) axis is always parallel to the Earth's surface, then you have a small chance that your efforts will work.
If not, you will need quite sophisticated software to remove the estimated gravity vector from the total acceleration, and this blog article explains why that will not work with consumer grade IMUs.
X and Y they are both parallel to the ground. I've managed to calculate linear acceleration using Rowberg's library and I removed the gravitiy vector from the linear acceleration. Is my process true?
If X and Y are perfectly parallel to the ground, the acceleration due to gravity should not affect the X and Y acceleration values.
In that case, there is nothing to remove, and you can integrate the X or Y acceleration to estimate the change in X or Y velocity during the integration period.
But, when I tilt the sensor up or down, raw data of acceleration Y changes. So I needed to remove it. Can you please send me an article that includes how to integrate acceleration to get velocity?
Yes I’ve read it. If you can show me an idea how to detect forward movement, using mpu6050, I appreciate. The problem is the sensor wont be fixed. Its going to be put on a sheep’s neck and we would like to detect that the sheep is walking/running or not. How can I detect it with mpu6050?(As you can imagine, when the sheep starts moving, its gonna start moving its neck towards up and down as well, while its running or walking.) Hopefully, you understand what we want to do.
To detect motion is easy. Just read out the three acceleration variables ax, ay and az, and calculate the magnitude of the total acceleration = sqrt(axax + ayay + az*az).
When that value is significantly different from the static value (the acceleration due to gravity), then the sensor is accelerating.
According to your calculation, if the sheep moves its neck, we would calculate and determine that sheep is walking. Whereas, the sheep only moved its neck. Its not walking or running. In sum, even if the sheep moves its neck, we are going to say that the sheep is walking or running, regarding your calculation. We are just trying to understand whether it is a neck movement or a sheep walking. This is what we need to detect.(Estimating only forward-backward motion not up-down or left-right)
In addition to that, what do you mean saying significantly? Can you please give me a pratical sample? What is the meaning of "significantly different" for this system? between which values? How much far away from the acceleration data? If its possible to give me a real example, I'll have these all questions answers.
According to my calculation, you can determine whether the sensor is accelerating. How you relate that to a sheep is entirely up to you.
To determine what sensor readings might be significant, collect sensor data under a number of circumstances and calculate the magnitude of the acceleration as described in reply #8.
There will be some variations in the acceleration magnitude due to noise, and some due to "significant" accelerations (other than gravity).
Again, it is up to you to decide the difference. It will be helpful to use the Arduino serial plotter to view the data.
Am I going to do this linear acceleration data or normal acceleration data? What do we except exactly? I calculated the magnitude and acceleration Y data and printed out them on plotter, however, I dont know what needs to be or what the expectation is.
Here is the results... Blue->Acceleration of Y axis, Red->Magnitude
You need to understand what the sensor is actually measuring. Forget the invented term "linear acceleration".
When held still, the sensor measures the acceleration due to gravity. When not still, other accelerations add to or subtract from the acceleration due to gravity.
If the sensor is held still with Y is pointing down or up, what do you get?
What happens if Y is horizontal?
If you accelerate the unit (by hand) along the Y axis, what do you get?