Close

Inspired experiments in visualization

A project log for anaQuad!

Reliably increase your quadrature-encoder's resolution using an ADC (or a bunch of comparators?)

eric-hertzEric Hertz 12/07/2021 at 08:410 Comments

This crossover-detection scheme is really hard to explain in words... I've tried countless times but what I really need is a great graphic.

Here are some attempts:

(And DAG NAB wouldn'tchaknow, switching tabs cleared all my work, leaving me with only a handful of screenshots)

Above is an example of what can result from using arctan when the measurements are off by +-10% (5%?)... This may seem like extremes that are unlikely to be encountered, but bear with me, anyhow.

The overall error at any of the measured positions is, frankly, not even near the step-size of anaQuad. So, at first glance it still seems like arctan is a great choice for higher resolution. And, indeed, depending on your application, it may be.

But consider this: With enough (only 5%?) measurement-error, noise, miscalibration, low battery, etc., arctan can report positions *decreasing* when in fact the motions are increasing. That can be a pretty significant problem if those position measurement/calculations are being fed into a feedback control loop.

Also, as described before, the area near arctan's discontinuities is of great concern, now multiplied. Notice how now the arctan lines overlap, jumping back and forth between roughly -90 and +90 degrees. Such a case would require special attention to avoid potential disaster in a motion-control situation.

Here's another example:

The stair-steps are anaQuad's output. Again, it has hysteresis...

Thus It's rather difficult to trigger the misdetection of a reversal where there was none.

The example above is at an extreme 20% error on each measurement, which one might hope never to run into...

On the other hand, we tend to push things beyond their specifications, in these parts... maybe completely unintentionally. And that's easy to do in analog.

For example, in one of my older videos, my analog optical encoder circuit had a strange effect where the outputs' amplitudes decreased somewhat dramatically with motor speed (WHAT?!). Maybe something to do with slew-rates? Rise/fall times? Internal capacitance?

But, say the amplitude, was merely 10% in error... no big deal, eh? But, consider this: The encoder is powered by a single supply voltage... its output is not centered at 0V. And the DC offset /also/ varied somewhat dramatically. So now our measurements with respect to ground, as the ADC reads them, are 20% in error! And to add to it, that was the error on only one of the two WAY-off channels.

Here's the extreme, where anaQuad may start failing:

40% error on both channels(!!!) causes weird cases where the hysteresis oscillates back and forth between two measured positions. As shown by the gaps and dashes in the stairsteps.

TBH, I'd never really contemplated what would happen in such a case... and I've never looked at it like this, graphically...

And it's past friggin midnight, brain-mush is allowed, no?

I *think* the hysteresis still applies, so e.g. the yellow line would *not* occur, falling through the crack to the next step, but then coming right back to the previous through the same crack... hmmm...

This is a very weird and enlightening visualization for me! And it can be animated, too.

...and I've been extremely busy with other things like destroying my progress on #Vintage Z80 palmtop compy hackery (TI-86)  which could really help with a much more pressing project than even that, so what am I doing /here?!/

Yeah, guess I'm pretty proud of this one.

Discussions