How to turn exact angle in increments to calibrate accelerometer?

Hello,

I am trying to build a rotating surface to place my accelerometer (MPU-6050) which can rotate precisely from -180 to +180 degrees by 1 degree increments. I searched for some 3D printable designs and found this: MPU-6050 Adjustable Support by PeriniM - Thingiverse but it does not allow me to measure the angle of rotation precisely even if i were to place a protractor next to it.

I am thinking of designing something similar and glue a transparent plastic protractor to it, but not sure how to do it. Another solution would be to use a motor, and from my research, servo motors seem to be the best option but then it seems like it will additionally need feedback from the motor and i have no idea how to implement that. I only have SG90 servos. Are these enough or should i modify them? If so, how?

Thank you in advance for any help or suggestions.

A stepper motor turns a defined angle per step.

Some info:

DryRun:
Hello,

I am trying to build a rotating surface to place my accelerometer (MPU-6050) which can rotate precisely from -180 to +180 degrees by 1 degree increments. I searched for some 3D printable designs and found this: MPU-6050 Adjustable Support by PeriniM - Thingiverse but it does not allow me to measure the angle of rotation

Define precisely.

A servo can be incremented by either degrees, micro seconds, or clock ticks.
A servo can be incremented in 1 degree steps by using degrees.
A servos range can be from 500uS to 2500uS. That's 2000uS for 180 degrees or 11.11uS per degree. Thus, using uS to torque the servos gives the ability to torque a servo in increments of degrees; such as 5.55uS for a 1/2 degree.

DryRun:
from my research,
servo motors seem to be the best option but then it seems like it will additionally need feedback from the motor and i have no idea how to implement that. I only have SG90 servos. Are these enough or should i modify them? If so, how?

Thank you in advance for any help or suggestions.

Servos have their own internal electronics for position determination.

Most servos are of the 180 degree type.

The SG90 is a plastic geared servo with a lot of hysteresis. Getting precise positional stability will be a trick, especially, as the plastic gears begin to wear down. I have got about 7 days of continuous operation with the SG90 plastic geared servo before the gears are worn down.

I have 3 metal geared servos holding an X/Y/Z platform level that, in a few days, will have been in continuous operation for 12 months. The Z platform rotates in 2uS increments, sweeping from +/- 45 degrees in increments of 2uS per torque.

If you require greater granularity then uS you can use an ESP32. which is what I use, that uses clock ticks to torque servos. The incremental of 1 clock is ~1/3 of a uS. The hobby metal geared servo cannot respond to such low torque values. But, hey, its granular.

To calibrate an accelerometer, follow this comprehensive tutorial. You don't need a table or platform of any sort.

@jremington
Your suggestion ought to be looked into. Driving 400 miles today i will have to wait.
Regarding steppers they move to very precise positions but studying the step in detail I expect a certain amount of overshoot at the end of each step. Servos have their internal circuitry trying to obtain the position according to a certain startegy. Study the step responce, if the motor overshoots.
Those overshoots are probably small but regarding what accurazy needed such a measurement might could be affected in a negative way.

A common 200 step per revolution stepper motor combined with either a 5 : 9 gear or toothed belt / sprocket reducer would give very close to 1 degree per step.

My objective is to make a table to show each angular rotation step and the corresponding Ax, Ay and Az values output from the MPU-6050. Then, i can make the calculations to show that using the atan or atan2 function gives a good estimate of the tilt angle.

I only have a 200 steps bipolar stepper motor with no gears or toothed belt reducer, so the minimum step angle is 1.8 degrees. I could work with this resolution but probably my biggest challenge is to build a good/reliable jig.

Something like this, but with only 2 axes of rotation.
jjspierxcalibrationrig.jpg
I would need a way to change and measure each rotation step and the total tilt precisely and i think stepper motor might be the best option.

I found this interesting page: KITS - Pan & Tilt Kits - ServoCity but these kits are expensive so i will try to build my own using only a stepper motor. A setup similar to this would be fine for the tilt only:
spt400_7_1.jpg
Link: https://www.servocity.com/sptd645mw-tilt-system

jjspierxcalibrationrig.jpg

spt400_7_1.jpg

Then, i can make the calculations to show that using the atan or atan2 function gives a good estimate of the tilt angle.

The math is correct and exact. No approximation is involved.

Any inaccuracy will be due to measurement noise and/or imperfect calibration of the accelerometer.

Woah guys! Way too complex.

Rolfe Schmidt published a method in 2011 that does not require any accurate positions. It's kind of a long series of blog posts starting here. Skip to the 4th to get the Arduino code.

Rolfe Schmidt published a method in 2011 that does not require any accurate positions.

See reply #3.

jremington:
See reply #3.

Yes, I wanted to comment on that but ran out of time yesterday.

  1. that post is 95% about compasses. The lille bit at the end about accelerometers doesn't discuss the significant differences for acceleration.

  2. the final solution presented requires PC software.

  3. the graphics are pretty but it makes it look like you need hundreds or thousands of points to calibrate.

Rolfe's Gauss-Newton method requires only 6 positions to be tested. They don't have to be orthogonal. The only requirement is that they be stable: you must hold the device against something solid like the edge of the desk. It will even tell you if you are not stable.

You can use more than 6 positions for greater accuracy but beyond about 8 or 10 you aren't really improveing the estimate.

The Arduino sketch needs no PC software except the Serial Monitor. It is not hard to change it to work without that too.

  1. The only significant difference between calibrating an accelerometer versus a magnetometer is that the accelerometer should be still when each data point is collected.

  2. Yes, PC software is required to get the off axis correction. Arduino isn't powerful enough to do that. Most people use a PC to program the Arduino.

  3. Not true, but the more the better. Time and patience are the limiting factors.

  4. Six data points versus many is inherently much less accurate due to measurement error, the influence of which goes down as sqrt(N) where N is the number of data points. Six data points do not allow for correction for off-axis errors.

For accurate calibration, the choice of methods could not be clearer.

What off-axis correction? The misalignment between the accelerometer and the flat bottom of the project housing? Or misalignment between the axes inside the chip?

6 positions. It does an average of many points at each position. (I forget how many and it is configurable.)

In my experience, 8 positions gets within the inherent accuracy of the consumer-grade accelerometer. Doing more does not make it better.

Try the superior method some time.