# Position and velocity from accelerometer

Started by November 8, 2007
```Jerry Avins <""jya\"@ieee,org"> writes:

> There must be more here than I can see. To measure velocity from
> acceleration, integration is necessary. Even digital integrators
> drift. (How is left as an exercise for the reader. Answer on request.)

How? I'm assuming that quantization isn't the issue here since
by definition the input to a digital integrator is already digital.
And I can see you'd potentially get overflow, but I wouldn't consider
that "drift."
--
%  Randy Yates                  % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC            %  the Beatles on 'Hey Jude'"
%%% 919-577-9882                %
%%%% <yates@ieee.org>           % 'Shangri-La', *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```Jerry Avins <""jya\"@ieee,org"> writes:

> There must be more here than I can see. To measure velocity from
> acceleration, integration is necessary. Even digital integrators
> drift. (How is left as an exercise for the reader. Answer on request.)

How? I'm assuming that quantization isn't the issue here since
by definition the input to a digital integrator is already digital.
And I can see you'd potentially get overflow, but I wouldn't consider
that "drift."
--
%  Randy Yates                  % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC            %  the Beatles on 'Hey Jude'"
%%% 919-577-9882                %
%%%% <yates@ieee.org>           % 'Shangri-La', *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```Jerry Avins <""jya\"@ieee,org"> writes:

> There must be more here than I can see. To measure velocity from
> acceleration, integration is necessary. Even digital integrators
> drift. (How is left as an exercise for the reader. Answer on request.)

How? I'm assuming that quantization isn't the issue here since
by definition the input to a digital integrator is already digital.
And I can see you'd potentially get overflow, but I wouldn't consider
that "drift."
--
%  Randy Yates                  % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC            %  the Beatles on 'Hey Jude'"
%%% 919-577-9882                %
%%%% <yates@ieee.org>           % 'Shangri-La', *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```Jerry Avins <""jya\"@ieee,org"> writes:

> There must be more here than I can see. To measure velocity from
> acceleration, integration is necessary. Even digital integrators
> drift. (How is left as an exercise for the reader. Answer on request.)

How? I'm assuming that quantization isn't the issue here since
by definition the input to a digital integrator is already digital.
And I can see you'd potentially get overflow, but I wouldn't consider
that "drift."
--
%  Randy Yates                  % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC            %  the Beatles on 'Hey Jude'"
%%% 919-577-9882                %
%%%% <yates@ieee.org>           % 'Shangri-La', *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```Randy Yates wrote:
> Jerry Avins <""jya\"@ieee,org"> writes:
>
>> There must be more here than I can see. To measure velocity from
>> acceleration, integration is necessary. Even digital integrators
>> drift. (How is left as an exercise for the reader. Answer on request.)
>
> How? I'm assuming that quantization isn't the issue here since
> by definition the input to a digital integrator is already digital.
> And I can see you'd potentially get overflow, but I wouldn't consider
> that "drift."

The integrator alone doesn't drift, but the combination of integrator
and transducer. For one reason or another, the LSB can be uncertain.
(Nature tends to be maximally unkind. You call it Murphy's Law. I call
it IPOIO: innate perversity of inanimate objects.)

The way incremental encoders are connected by the unwary, the "CW" and
"CCW" pulses don't occur at the same shaft angle, but are offset by half
a quantized angle increment. For reciprocating motion, that can lead to
a slow drift. For an unfortunate small-amplitude oscillation, it can
lead to a disastrous false indication of continuous motion. My circuit
(and a more complicated state machine) give CW and CCW pulses at the
same shaft position. The difference is the direction from which that
position is approached. That solves most of the annoying difficulties
that seem small enough to let slide until they become large ones when
the brass show up for a demo.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
```
```Jerry Avins <""jya\"@ieee,org"> writes:

> Randy Yates wrote:
>> Jerry Avins <""jya\"@ieee,org"> writes:
>>
>>> There must be more here than I can see. To measure velocity from
>>> acceleration, integration is necessary. Even digital integrators
>>> drift. (How is left as an exercise for the reader. Answer on request.)
>>
>> How? I'm assuming that quantization isn't the issue here since
>> by definition the input to a digital integrator is already digital.
>> And I can see you'd potentially get overflow, but I wouldn't consider
>> that "drift."
>
> The integrator alone doesn't drift, but the combination of integrator
> and transducer. For one reason or another, the LSB can be
> uncertain. (Nature tends to be maximally unkind. You call it Murphy's
> Law. I call it IPOIO: innate perversity of inanimate objects.)
>
> The way incremental encoders are connected by the unwary, the "CW" and
> "CCW" pulses don't occur at the same shaft angle, but are offset by
> half a quantized angle increment. For reciprocating motion, that can
> lead to a slow drift. For an unfortunate small-amplitude oscillation,
> it can lead to a disastrous false indication of continuous motion. My
> circuit (and a more complicated state machine) give CW and CCW pulses
> at the same shaft position. The difference is the direction from which
> that position is approached. That solves most of the annoying
> difficulties that seem small enough to let slide until they become
> large ones when the brass show up for a demo.

Jerry,

The depth and bredth of your knowledge of engineering across a variety
of technologies is ... *scary*.

Are you sure there isn't some way we could hook you up to a few
Terrabytes of disk space do a data dump before you go away?
--
%  Randy Yates                  % "She's sweet on Wagner-I think she'd die for Beethoven.
%% Fuquay-Varina, NC            %  She love the way Puccini lays down a tune, and
%%% 919-577-9882                %  Verdi's always creepin' from her room."
%%%% <yates@ieee.org>           % "Rockaria", *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```Randy Yates wrote:

...

> Jerry,
>
> The depth and breadth of your knowledge of engineering across a variety
> of technologies is ... *scary*.
>
> Are you sure there isn't some way we could hook you up to a few
> Terrabytes of disk space do a data dump before you go away?

I wish such a way existed. If there were, many people should have
priority over me, but I'd be delighted to do my bit. A danger of knowing
a lot is the ease with which I can believe I know more than I do. As for
going away, well ... I turned 75 not long ago.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
```
```Jerry Avins > wrote:

> For an unfortunate small-amplitude oscillation, it can
> lead to a disastrous false indication of continuous motion. My circuit
> (and a more complicated state machine) give CW and CCW pulses at the
> same shaft position. The difference is the direction from which that
> position is approached. That solves most of the annoying difficulties
> that seem small enough to let slide until they become large ones when
> the brass show up for a demo.
>
> Jerry

Been there done that quite a while back.  Yup, you need to pay attention
to the direction of the approach to get around it.  It took some time to
wipe the egg off my face from that.
```
```Ray Andraka wrote:
> Jerry Avins > wrote:
>
>> For an unfortunate small-amplitude oscillation, it can lead to a
>> disastrous false indication of continuous motion. My circuit (and a
>> more complicated state machine) give CW and CCW pulses at the same
>> shaft position. The difference is the direction from which that
>> position is approached. That solves most of the annoying difficulties
>> that seem small enough to let slide until they become large ones when
>> the brass show up for a demo.
>>
>> Jerry
>
>
> Been there done that quite a while back.  Yup, you need to pay attention
> to the direction of the approach to get around it.  It took some time to
> wipe the egg off my face from that.

The simplest to do is make every state transition that counts one way
count the other way when traversed in reverse. When I first has to solve
the problem, it was done only for high-reliability applications using an
expensive discrete-component state machine to drive a counter. I kept
the counter, but replaced the state machine with a pair of exclusive-or
gates (and incidentally doubled the counting rate.) How it's done is
immaterial. If the CCW counts occur in the same place as the CW counts,
there can be no ambiguity.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
```
```Jerry Avins > wrote:

>
> The simplest to do is make every state transition that counts one way
> count the other way when traversed in reverse. When I first has to solve
> the problem, it was done only for high-reliability applications using an
> expensive discrete-component state machine to drive a counter. I kept
> the counter, but replaced the state machine with a pair of exclusive-or
> gates (and incidentally doubled the counting rate.) How it's done is
> immaterial. If the CCW counts occur in the same place as the CW counts,
> there can be no ambiguity.
>
> Jerry

As I recall, I solved it with a state machine in a PAL, probably a 22V10.
```