# Limits of dead reckoning using MEMS sensors

I'm trying to track body parts relative to a person's torso. I see quite a few questions about using MEMS accelerometers and gyros for dead reckoning, and they confirm my suspicions that various factors greatly limit their usefulness for these sorts of applications, but I'm seeking clarification of these limits:

• What exactly are these limits?

Other answers have addressed why these limits exist. Naturally the specifications the parts in the system in question and what is considered "acceptable error" for the system will both change the exact limits, but is there a single order of magnitude in time, or distance that I can expect dead reckoning to work? I'm well aware that over long distances (a few yards or so) the error becomes too large for most practical purposes, but what about within a few feet?

• What can I do to improve these limits?

I'm currently looking at using an accelerometer and a gyro. What other sensors can I add to the system to improve the error rate? I know over longer distances a GPS can be used, but I doubt any consumer electronics grade GPS has fine enough resolution to help in my case.

Additionally, a general consensus seems to the only way to improve these limits past the point of improved sensors is to provide a reference not subject to error. Some systems solve this using cameras and markers. What kind of reference points can a portable/wearable device provide?

I've seen the usage of radio waves to measure long distances accurately, but I can't tell if such a system could be accurate on such small scale (in terms of distance measured) using "off-the-shelf" components.

• To the person who flagged this for closure, and any others of that ilk - this is an electronic design question of the first order. It's asking how to build a better inertial navigation unit using COTS parts and whatever else is possible, and what the current limits are and what can be expected from the suggested improvements. The question can not be reasonably broken down into smaller questions for those who cannot handle the scope of it as the integration of all factors to gain an improved result is the core idea. Oct 22 '14 at 14:23
• A magnetometer can be added to a 6 DOF gyro and accelerometer chip. Oct 22 '14 at 14:26
• I was actually considering the fact the question is composed of two smaller questions, but came to the exact conclusion @RussellMcMahon has noted. Oct 22 '14 at 15:06
• I doubt any consumer electronics grade GPS has fine enough resolution to help in my case. There is in fact a consumer GPS that provides centimeter accuracy. Whether or not +/- 1cm is accurate enough for your application you have not specified. And of course, it costs quite a bit more than your typical +/- 3m accurate GPS modules Oct 22 '14 at 17:50
• I hadn't seen any in my searching, do you have the part numbers for any of them? Oct 22 '14 at 21:51

• What exactly are they?

The error sources include zero-offset (bias) and scale errors (which tend to vary slowly) and noise. The prices of MEMS sensors vary from less than $10 to over$1000, and the magnitude of the error terms covers a wide range, depending on the quality of the sensor.

The big problem is that integration is usually required to get from the sensor value (acceleration, angular rate) to the desired value (position, angle). All of the error sources are compounded — growing with time — when integrated. The value of the data for dead reckoning decays with time, with cheap sensors giving you at most a few minutes of useful data and high-end sensors being good for maybe a few hours.

• What can I do to improve these limits?

As you have already found, the best way to get rid of the growing integrated errors is to combine the sensor data with other independent sources of data that don't have the same kinds of errors. For example, GPS can give you an absolute position value that doesn't drift long-term, but has a relatively large "noise" component. You can use this data to estimate the bias and scale errors of your accelerometers, which allows you to correct for them in real time. It also allows you to cancel out the "random walk" created by the sensor noise. A Kalman Filter is one common method used to model the system (including the sensor error terms) and combine the data together to come up with an optimal estimate of the system state at any point in time.

Another example is to use the "gravity vector", as measured by the accelerometers, to cancel out the angular drift of the gyros. The trick here is to know exactly when you have a valid gravity vector; i.e., the system is not accelerating in any direction. Various heuristics (e.g., "zero update") are used to accomplish this. A magnetometer can also be used to measure gyro errors, even if you don't know the absolute direction of the magnetic field — as long as you can assume it's constant.

Optical sensing is another way to get a drift-free velocity, angle or position estimate, but the image processing that's required can require a lot of CPU (or FPGA) cycles, and the development of such a system is quite complicated.

• This is a really great answer, but I think it misses the intent of one part of the question (maybe I need to clarify it above). "What are they" is referring to what are those limits. I go into detail about what I mean by that in the question, since I realize the values will vary based on many factors. Oct 22 '14 at 15:13
• I couldn't tell whether you were asking about the nature of the errors or the magnitude of the errors. I tried to address both in the first part of my answer. Oct 22 '14 at 15:25
• Oh I see, so time is probably a greater factor than distance in this case (I realize it's not always going to be one or the other) Oct 22 '14 at 15:37

You asked what else could be added. A 3 axis magnetometer should be helpful. Earth's magnetic field tends to move around substantially slower than the average user does (fortunately).
Look at the fabulous MPU6000/6050

One version provides SPI & IIC interface, the other IIC only.

This contains a 3 axis gyroscope + a 3 axis accelerometer plus inputs to allow it to integrate the signal from and external 3 axis magnetometer.
The IC contains a 'digital motion processor' which integrates the signals from the 3 x 3 sensor array. I've not yet come to grips with the precise functionality provided but the intention is to process the 3 separate signal sources into a useful motion analysis system

The IC costs about $10/1 from Digikey and an evaluation board is about$50+ from the manufacturer. Or you can buy a complete board from China - they sell here for about \$6 US retail in 1's - IC and PCB assembled.
I still haven't worked out how that happens or if they are real or ... . I received one yesterday but will not be able to get to playing with it for a while. ('Whiles' vary greatly in magnitude, from very small to sometimes exceeding large, alas). There are a number of articles on web on using them with eg Arduinos.

How accurate?:

There is probably much discussion of this on web.
If I read the data sheet correctly (and it's not a device type I'm overly familiar with)
Table 6.1 on page 12 suggests the Gyroscope has a drift of +/- 20 degree/second max at 25 C and as much again over -40 to +85C temperature range. Assuming an actual 20 degrees/second rate that's one full turn in 18 seconds. However, both the magnetometer and accelerometer provide access to external reference vectors (gravity and earth's magnetic field) and signals from these can be used to derive short and longer term gyro drift rate and compensate. This may well be part of what their "motion processor" does.

Accelerometer error seems to be typically under +/- 5%.
I'd expect (and may be very wrong), that using the accelerometer and magnetometer to trim the gyro drift errors to essentially zero longer term would allow you to use the gyro signals for navigation over seconds to minutes. GPS also provides velocity signals and the combination of GPs position + velocity with the 9DOF unit sounds highly useful.

Wooly: The above sounds woolier than I'd like. I expect to know a lit more bout this in the next few weeks. I'd be interested to hear what you find out and if I learn useful things will try and report back.

.

Depending on your application you may be able to deposit a reference GPS and receiver temporarily at a convenient location.This could be extremely compact - GPS + battery + TX. Once deposited it knows where it is and can transmit corrections based on where the system says it is. Use of the same satellite constellation is 'probably a good idea'. If the user and the reference GPS are at the same point when it is deposited so much the better but this systems tends to work even if they are always spatially separated.

... I doubt any consumer electronics grade GPS has fine enough resolution to help in my case.

Not knowing what your case is makes it hard to say. But relative sample to sample GPS resolution is typically far superior to what is achieved over minutes or hours. I have conducted tests where I drove over an urban route and plotted the GPS coordinates and then repeated the exercise several hours later. The two paths were in some cases several meters apart but when say driving in a straight line along an urban street the plot was a straight line with "noise" either side of a straight line of perhaps less than a meter. (That was some years ago - it's easy to try this yourself. I just recorded data from a GPS serial RS232 output (4800 baud typically) and in that case plotted it in Excel as an X-Y graph.There are many many program available to handle such data in a far more sophisticated way but the above method provided excellent visualisation and easy access to data at a selected point.

Differential GPS can be used whereby a local stationary receiver of fixed location provides error corrections based on where it knows it is and where the system now says it is.There are many providers of such systems but the concept is simple and easy enough to implement if on a tight budget.

• I want to discuss that drift. I what they mention in the datasheet is not drift, but what the Gyro outputs as values while being at 0 rotation rate. The second figure would then be how much that value differs over the whole temperature range. Do you think that makes sense? Oct 22 '14 at 15:15
• I'm trying to track body parts relative to a person's torso (I mentioned it in the question, but I should probably move that to the introduction, I accidentally buried it). I see quite a few breakout boards for it on E-bay, I'm about to order one. Looking over the datasheet it's a very promising device. The note about GPS is referring to how short the distance is (<1 meter). The devices I've seen for that type of measurement used very specialized hardware. I had never thought about using a differential GPS system. I've heard of them, but don't know to much about them so I'll read up, Thanks! Oct 22 '14 at 15:29
• "Use of the same satellite constellation is probably a good idea." That isn't how DGPS works. The reference station computes pseudorange corrections to the individual satellites in its view and transmits those. The other station only uses the corrections for those satellites that are also in its own view. Oct 22 '14 at 15:37
• Invensense now has their MPU-9250, which combines the MPU-6000 (Gyro/Accel) with a 3-axis magnetometer (Asahi Kasei AK8963), giving 9 axes on one chip. And it's smaller than the MPU-6000 :) Oct 22 '14 at 16:49
• It also had similar e-bay listings so I've ordered one since the average price of magnetometers on breakout boards was about the same (These boards sure are cheap!) Oct 22 '14 at 17:30

Something that's not covered in these answers yet is your specific application, which actually has been tackled at least a dozen times before by very smart people. The two keywords here are inverse kinematics and Kalman filters.

By now it should be clear what the source of errors are for your application, and how to fix them. But when dealing with sensors that are essentially fixed to a human, you can decrease the range of spatial and angular positions of your sensors by applying inverse kinematics to the equation. This basically means you track the relative positions of as many joints on the body as possible and apply a kinematic model of the human body to it. For instance, the length of peoples' arms doesn't vary over time, nor does their range of motion change appreciably. Bones don't bend (under normal circumstances). All of this can be used to constrain your sensor positions.

The other solution is to use as many orthogonal sensors as possible. Orthogonal in the sense of: using fundamentally different measurement principles. Using as much sensor input as possible, you can use a so-called Kalman filter to work out as precisely as possible given the data where your sensors are. Kalman filters aren't some magical entity that poops out the best answer, though. They are mathematical models that need to be tuned and modified to your specific application, and it can be quite a hassle to get them to work well. But it does allow you, in a roundabout kind of way, to combine otherwise very hard to correlate sensor data. Inputs for this kind of filters can be anything: position, acceleration and speed sensors but also e.g. light sensors that can add information by responding to light sources that are visible at certain angles.

A few 'powergloves' with this working principle (kinematics+kalman filters) have been demonstrated by companies and universities alike. The most recent one I saw at TU Eindhoven used MPU6050s on flexible substrates woven into a glove as well as some supporting sensors (I think at the moment it's just webcams) all fed into a big Matlab-powered Kalman filter. It works to within 1mm repeatability.

• I've already examined these aspects of the problem so far for my specific case, so I'm more interested in what I can do with hardware, but these are excellent points (especially using I.K. for constraints). Oct 22 '14 at 17:16

The Fundamental Problem

Naturally the specifications the parts in the system in question and what is considered "acceptable error" for the system will both change the exact limits, but is there a single order of magnitude in time, or distance that I can expect dead reckoning to work? I'm well aware that over long distances (a few yards or so) the error becomes too large for most practical purposes, but what about within a few feet?

This can be addressed by studying the short term error dynamics of an inertial navigation system. It's covered in detail in many texts, but here's the short "equation free" version.

1. Precisely know your initial position, velocity and attitude (i.e. pitch roll and yaw).

2. Integrate the output of your gyroscopes (angular rate) over some short period of time $\Delta t$ to get an increment of pitch, roll and yaw and add them to your current attitude.

3. Use your new attitude you just calculated to mathematically rotate your accelerometer readings to be level with the earth.

5. Integrate your accel-minus-gravity measurements over a short period of time $\Delta t$ to get an increment of velocity. Add this to your current velocity.

6. Integrate your newly calculate velocity over a short period of time $\Delta t$ to get an increment of position. Add this to your current position.

7. Repeat steps 2-6 for as long as want.

Suppose your gyro has some error on it - for example, a bias $b_g$. The error will get integrated once for attitude, integrated again for velocity then integrated again for position. Thus, that error grows with $b_g \times \Delta t \times \Delta t \times \Delta t = b_g (\Delta t)^3$ from one time step alone.

Furthermore, that bias will accumulate into attitude, which will cause the accelerometers to be leveled wrong, which will cause the acceleration to be leveled in the wrong direction, which will then be integrated into the wrong direction - three tiers of errors.

This means that gyro errors cause position errors to grow with the cube of time.

By the same logic accelerometer error cause position errors to grow with the square of time.

Because of this, you'll get mere seconds of useful (pure) inertial navigation from mobile-phone grade MEMS sensors.

Even if you have extremely good inertial sensors - say, aircraft grade - then you are still fundamentally limited to slightly under ten minutes of (pure) inertial navigation. The reason is Step 3 - gravity changes with height. Get your height wrong and your gravity will will be wrong, which causes your height to be wrong, which causes your gravity to be more wrong and so on - exponential error growth. Thus, even a "pure" inertial navigation system such as those found in military jets will usually have something like a barometric altimeter. Source.

Solutions

Additionally, a general consensus seems to the only way to improve these limits past the point of improved sensors is to provide a reference not subject to error.

Even if you have a reference attitude (e.g. magentometer to provide heading, and something else to provide accurate pitch and roll), you will still be limited by the $t^2$ error in accelerometers. Thus, some sort of positioning is necessary.

Some systems solve this using cameras and markers. What kind of reference points can a portable/wearable device provide?

There is both research and commerical products that can do this.

Conceptually, it works like stereo vision - you have a known baseline between cameras, and a different angle to each marker as viewed from each camera. From this, the 3D position of each mark can be computed (relative to the camera). It can work better with more cameras.

I've seen the usage of radio waves to measure long distances accurately, but I can't tell if such a system could be accurate on such small scale (in terms of distance measured) using "off-the-shelf" components.

Using cheap hardware, decawave UWB might be of some use (10cm ranging or so). You'll need to come up with your own algorithms through.

I know over longer distances a GPS can be used, but I doubt any consumer electronics grade GPS has fine enough resolution to help in my case.

Next to the body, a GPS system will struggle. Getting cm-level GPS relies on continuous phase tracking of the (very, very weak) GPS signals, which is extremely difficult if the antenna is next to the body, and the body is moving around! For L1 only-systems - regardless which they are cheap or expensive - the tracking has to be for a very long time (10min+) and is thus impractical for this problem. A dual-frequency receiver might work sometimes, but these are really not cheap (thousands of dollars).