to mechanically store the number of revolutions. The position of the single gears is detected with one of the above-mentioned technologies. Self-powered multi-turn encoder These encoders use the principle of energy harvesting to generate energy from the moving shaft. This principle, introduced in 2007, uses a Wiegand sensor to produce electricity sufficient to power the encoder and write the turns count to non-volatile memory. Ways of encoding shaft position Standard binary encoding An example of a binary code, in an extremely simplified encoder with only three contacts, is shown below. In general, where there are n contacts, the number of distinct positions of the shaft is 2n. In this example, n is 3, so there are 2³ or 8 positions. In the above example, the contacts produce a standard binary count as the disc rotates. However, this has the drawback that if the disc stops between two adjacent sectors, or the contacts are not perfectly aligned, it can be impossible to determine the angle of the shaft. To illustrate this problem, consider what happens when the shaft angle changes from 179.9° to 180.1° (from sector 3 to sector 4). At some instant, according to the above table, the contact pattern changes from off-on-on to on-off-off. However, this is not what happens in reality. In a practical device, the contacts are never perfectly aligned, so each switches at a different moment. If contact 1 switches first, followed by contact 3 and then contact 2, for example, the actual sequence of codes is: off-on-on (starting position) on-on-on (first, contact 1 switches on) on-on-off (next, contact 3 switches off) on-off-off (finally, contact 2 switches off) Now look at the sectors corresponding to these codes in the table. In order, they are 3, 7, 6 and then 4. So, from the sequence of codes produced, the shaft appears to have jumped from sector 3 to sector 7, then gone backwards to sector 6, then backwards again to sector 4, which is where we expected to find it. In many situations, this behaviour is undesirable and could cause the system to fail. For example, if the encoder were used in a robot arm, the controller would think that the arm was in the wrong position, and try to correct the error by turning it through 180°, perhaps causing damage to the arm. Gray encoding To avoid the above problem, Gray coding is used. This is