The magnetic encoder on Christoph's motor board can give a really high resolution absolute angle position output if you bother to read it via SPI. And while that feature is cool, it is more than needed for a lot of applications, and way too slow.
For realtime applications other interfaces are way better, one of them being quadrature as used here. It's a simple system, mainly consisting of two signal lines (usually called A and B), each of which switches between two states (high and low, in our case). When the measured position changes a certain amount, the lines switch, with their switching off by a quarter of a period.
Since the information you get is incremental (as in, you only get "it moved for 0.2 degrees", not an absolute "we're at 12.7 degrees"), you might lose some of that, and errors could accumulate. Also, you have to get some kind of zero point to initialise your system. To tackle that, the sensor also offers an index signal, emitting a high when it measures precisely the zero position, and a low otherwise.
Since there were no analog levels to measure, we decided to measure digital values over time, to get a representation of what the sensor output means. Holding a magnet over the sensor proved to be quite problematic, as the sensor is so sensitive and precise that it's almost impossible to keep the magnet still enough for reading a "no movement". Electrically, the measurement setup is simple, though: Daniel's Logic 8 is connected to ground (the clamp in front, at a pin of the CAN / power jack), Signals A and B (the clamps to the right of the sensor chip) and the Index signal (the clamp to the left).
Accelerating, in general, will lead to the time between switching becoming shorter. This first sample shows movement in one direction (Signal B goes high first) we'll call 'forwards', accelerating visibly through the screenshot.
This second part of the sampled data shows catching the index pulse, still moving 'forwards'.
This last batch of data shows moving 'backwards', again catching the index pulse. Not how short the index pulse is - catching it while moving fast will not be fun. Also note that the quadrature output of the Chip is really not 'clean', it seems to really not be at a clean 90 degrees phase angle, and it seems flickery about its speed. We will see how that works out on the motorboards.
Quadrature encoder data from the logic analyser |