I'm wondering if someone with more Arduino knowledge than me can point me towards the right direction to solve this. I'm trying to smooth out some accelerometer readings. I was following the suggestion to do so over here: http://arduino.cc/en/Tutorial/Smoothing
The issue is that I'm using a Light Blue Bean which has an on board accelerometer which calls a struct? And has some form of on-board filtering: https://punchthrough.com/bean/the-arduino-reference/accelerationreading/ | https://punchthrough.com/bean/the-arduino-reference/getacceleration/
I'm not sure how to go about this. Try and smooth each axis (https://punchthrough.com/bean/the-arduino-reference/getaccelerationx/)? work of the arduino digital smooth example? Maybe smoothing is the wrong approach?
Mostly its just giving me some big jumps in readings even when its sitting still. ie: the y-axis will be: 0, 1, -8, 0, 3, etc.. in a sample.
I am less than a novice on this, but this page https://punchthrough.com/bean/the-arduino-reference/getacceleration/
says the conversion for the units to "Gs" is 3.91X10-3. So, if you multiply the values you are getting by .00391, then you should get the units in Gs. Your value of -8 above is only -0.03128G. This is a reasonable acceleration for something "sitting still."
Related
I'm not sure if something like this has been asked but I've spent days trying to figure this out to no avail.
I've been working on a project that has a straight tube and a sleeve placed some length down the tube, this part of the problem isn't causing any issues but the orientation of the placed sleeve is. When the sleeve is placed it is given a location that intersects another object giving it all the information it needs to be placed, but I need that sleeve to orient itself with the tube, pretty much just along the roll axis, but I would like to hammer out how yaw and pitch would be done similarly.
The tube has transform data connected to it. It has an origin for the center point of the tube, and 3 xyz points standing for each basis axis. in example for one of the tubes tested:
origin:{(119.814557964, -37.330669765, 8.400185257)},
BasisX: {(1.000000000, 0.000000000, 0.000000000)},
BasisY: {(0.000000000, 0.939692621, 0.342020143)},
BasisZ: {(0.000000000, -0.342020143, 0.939692621)}.
In some of the solution parts I've come across I found some ways this information is used. And I've had some success with this way of doing it:
(note: I realize this code has a lot of pointless variable use, I didn't want to adjust it and confuse myself more)
upDownAxis = givenSleeveObject.passedOnTransform.BasisZ;
leftRightAxis = givenSleeveObject.passedOnTransform.BasisX;
tempOfVector = givenSleeveObject.passedOnTransform.OfVector(upDownAxis);//this ofvector is applying the transform to the vector
rotationAngle = upDownAxis.AngleOnPlaneTo(tempOfVector, leftRightAxis);
This was able to give me the angle rotation of this particular tube which was 20 degrees.
The problem is that this doesn't really work along the y axis the same, and completely wrong along the z axis. Likely due to after rotating to z axis the axis for each direction changes to one of the others at that angle. Also if it is of any help, the direction of the tube basically follows the basisX. If z is the only one with a 1, it is heading upward.
So now my issue is, how can I find the roll of this tube no matter it's orientation? Also rotation direction might matter in the long run. Since this object's transforms are all connected to itself, there must be a way to know how much of a roll has been done to it even at an extreme of 45 in every axis, right?
On a device I want to detect a range of forces: small forces (Minimum around 0.01g) but also stronger forces like 0.1g - 0.15g.
This device will have different positions in 3d space so in order to detect the small forces I have to know its angle in order to be able to subtract 1g. Because the device can have a random position (angle position).
What I did so far: I used the MPU6050 and used a complementary filter with accel. and gyro.
It's something like:
agnleX_k+1 = 0.98*(angle_k + deltaT * gyro_k+1) + 0.02*angle_acc_k+1;
angle_acc is the angle calculated from the accel. sensor. Something like:
arctan(accelX / sqrt(accelX^2 + accelY^2 + accelZ^2 + ))
So I am interested in:
forceX_k+1 = accelX_k+1 - 1g*sin(agnleX_k+1)
The problem is:
If I want to detect a small force coming in very fast, let's say on accelX_k+1 I would want to detect a Change from 0g to 0.01g or more but in a very small time range. The problem is that my calculated angle would then also be influenced by this small and fast change of the accel. sensor although the angle haven't really changed.
I think I would have to do the angle calculation independent of the accel. sensor. Can I do something like a complementary filter with gyro and magnetometer? Would that work the same as my filter described above but just with the mag. sensor instead? Or how would you do that? I was thinking about using MPU9250.
You stated using MPU6050, which contains both an accelerometer and a gyrosocpe. You could use them independantly - get acceleration from the accelerometer and get angles from the gyroscope, and then use the angles to compensate for rotation. There is no need for the angle to depend on your accelerometer.
Using DMP library fromJeff Rowberg will do the work for you.
it can compensate gravity acceleration internally way faster that Arduino code.
Link to github
I know that what I'm going to ask could sounds crazy, but I'm trying to figure out how to resolve a problem in a smart way.
It's quite difficult to explain my problem, that's why I made an hand-made draft downloadable from here :) https://dl.dropboxusercontent.com/u/5049281/static/Images_Impulse_Direction.zip.
images in that zip (copied by Spektre)
The setup can be approximated with a pipe endorsed on a rubber wall. The pipe is firmly connected (whit an unknown position and orientation) to a IMU equipped with an accelerometer and a gyroscope (sample frequency 110 hz).
I would like to discover the direction of the pipe axis (expressed in the IMU reference system) analyzing the data acquired during some taps at the end of the pipe in the same direction of the pipe axis. The taps are applied with the palm of the hand. In the figure the direction should be just on X axis.
I think that if the motion is just a translation (I could verify it checking if gyroscope data is close to zero), the acceleration (with the gravity removed) during the tap should have the same direction of the pipe axis.
Is there a smarter solution than just apply an high-pass filter to the signal an then save the direction of the sample with the higher magnitude?
Thanks for your help!
I am using arduino and accelerometer MMA7341 to measure the acceleration in x direction of an oscillating metal table. But the mounting of the accelerometer is tilted by a small angle (say Q) . Is it affect the acceleration?. If it is affect the acceleration in x direction , how can correct it without changing the tilt of the acceleration sensor.
"Tilt" and "acceleration" are both the same, from the perspective of most sensors, since both measure a force, rather than an actual angle (tilt) or change in velocity (acceleration).
What you should do is make sure the object on which the sensor is mounted is "level", within the best of your ability to determine such a thing, and use the values from analogRead() or whatever else your device provides, as the "0" values.
For the MMA7341 you'll also need to calibrate your analog signals, or else use a high precision reference as input to the Aref pin, assuming you're Arduino exposes that pin.
I think this depends on what you are measuring. THe MMA7341 looks to be able to be used for acceleration as well as tilt. If you are measuring acceleration then the mounting position doesn't matter since acceleration is a change of velocity and the velocity delta will be constant regardless of orientation.
If you are measuring tilt then thats obviously different. You could theoretically measure the initial tilt and then compensate for that in your code if you wanted to of course.
I'm working in a project that involves gyroscopes...
I'm using Arduino and an ITG 3200 to read the data from the gyroscope. I get 3 values in deg/s for each axis (x,y,z).
My question is: How can I know the actual (physical) position or direction of the device (let's say an airplane). There has to be a math formula or something like that.
Using only the gyroscope signal (which you have to integrate numerically), you'll eventually run into trouble, due to drift. What's normally done is combining an accelerometer (for low frequency signals, i.e. drift) with a gyroscope (for high frequency signals). Here's a link few links showing more or less exactly what you want:
http://www.starlino.com/imu_guide.html
http://www.instructables.com/id/Accelerometer-Gyro-Tutorial
http://www.starlino.com/quadcopter_acc_gyro.html
Also, see these StackOverflow questions:
Combine Gyroscope and Accelerometer Data
Integrating gyro and accelerometer readings
gyro, accelerometer, magnetometer and Kalman filter
How to determine relative position using accelerometer and gyro data
We are working on a similar problem.
We found this video on YouTube especially helpful, as it came with a paper as well as an implementation (which runs on Arduino):
http://www.youtube.com/watch?v=fOSTOnQzZCI
The paper and source code:
http://code.google.com/p/imumargalgorithm30042010sohm/
In our case (getting the orientation of a remote-controlled ball), we also had to include an accelerometer and a magnetoscope.