|
ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Inputs and outputs > Rotary encoders > Rotary encoder measures
Rotary encoder measures

 | ANY-maze has been designed to be extended, and we'll be delighted to add any new measures you might find useful, for free! Just contact ANY-maze Support. |
ANY-maze will score the following measures for a rotary encoder. Note that each measure is available for the apparatus as whole, and also for each defined zone.
Number of rotations
| Description | Reports the number of complete rotations of the encoder. |
| Calculation method | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' same direction pulses is received. |
| Analysis in zones | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' same direction pulses is received and the animal is in the zone for the entire sequence. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of rotations that ENDED during the time period. |
Time turning
| Description | Reports the time for which the encoder was actually turning. |
| Calculation method | Reports the time for which the instantaneous rotational velocity (IRV) was not zero. The IRV is calculated as follows: Starts with a single pulse of a certain direction. Then counts the number of consecutive same direction pulses until at least 200 milliseconds have elapsed. Uses the elapsed time and the number of pulses detected during it to calculate the rotational velocity. This value is averaged (using a moving average) over ten values, and this is the instantaneous rotational velocity. |
| Analysis in zones | The time the encoder was turning while the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the time that the encoder was turning during the time period. |
Distance (only applies to running wheels)
| Description | Reports the distance the animal 'travelled'. |
| Calculation method | The number of rotations multiplied by the circumference of the wheel. |
| Analysis in zones | The distance the animal 'travelled' in the wheel while it was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of rotations that occurred during the time period multiplied by the circumference of the wheel. |
| Notes | This result is only available if the device which includes the rotary encoder reports a circumference - this feature is only supported by some running wheels. |
Number of clockwise rotations
| Description | Reports the number of complete clockwise rotations of the encoder. |
| Calculation method | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' clockwise pulses is received. |
| Analysis in zones | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' clockwise pulses is received and the animal is in the zone for the entire sequence. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of clockwise rotations that ENDED during the time period. |
Number of anti-clockwise rotations
| Description | Reports the number of complete anti-clockwise rotations of the encoder. |
| Calculation method | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' anti-clockwise pulses is received. |
| Analysis in zones | Counts a rotation when an unbroken sequence of 'number of pulses per rotation' anti-clockwise pulses is received and the animal is in the zone for the entire sequence. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of anti-clockwise rotations that ENDED during the time period. |
Number of reversals
| Description | Reports the number of times the direction of the encoder changed. |
| Calculation method | Counts the number of times a clockwise pulse was followed by an anti-clockwise pulse and vice versa. |
| Analysis in zones | Counts the number of times a clockwise pulse was followed by an anti-clockwise pulse and vice versa when the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of reversals that occurred during the time period. |
Number of half rotations
| Description | Reports the number of half rotations of the encoder. |
| Calculation method | Counts a half rotation when an unbroken sequence of 'number of pulses per rotation' divided by two, same direction pulses is received. |
| Analysis in zones | Counts a half rotation when an unbroken sequence of 'number of pulses per rotation' divided by two, same direction pulses is received and the animal is in the zone for the entire sequence. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of half rotations that ENDED during the time period. |
| Notes | If the number of pulses per rotation is not exactly divisible by 2, then the result is rounded down. This can yield some inaccuracy. Consider when the number of pulses per rotation is 5, then the number of pulses per half rotation will be considered to be 5/2 = 2.5, which when rounded down = 2. So after 2 same direction pulses, a half rotation will be counted; thus after 2 complete rotations 5 half rotations will be counted, when the correct value is 4. For this reason, it is not recommended to use encoders with a number of pulses per rotation (PPR) that is not divisible by 2. Fortunately, many encoders use binary powers for their PPR, for example 16, 32, 64, etc. |
Number of quarter rotations
| Description | Reports the number of quarter rotations of the encoder. |
| Calculation method | Counts a quarter rotation when an unbroken sequence of 'number of pulses per rotation' divided by four, same direction pulses is received. |
| Analysis in zones | Counts a quarter rotation when an unbroken sequence of 'number of pulses per rotation' divided by four, same direction pulses is received and the animal is in the zone for the entire sequence. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the number of quarter rotations that ENDED during the time period. |
| Notes | If the number of pulses per rotation is not exactly divisible by 4 then the result is rounded down. This can yield some inaccuracy. Consider when the number of pulses per rotation is 5, then the number of pulses per quarter rotation will be considered to be 5/4 = 1.25, which when rounded down = 1. So after 1 pulse, a quarter rotation will be counted; thus after 4 complete rotations 20 quarter rotations will be counted, when the correct value is 16. For this reason, it is not recommended to use encoders with a number of pulses per rotation that is not divisible by 4. Fortunately, many encoders use binary powers for their Pulses Per Rotation, for example 16, 32, 64, etc. |
Degrees of clockwise rotation
| Description | Reports the number of degrees of clockwise rotation of the encoder. |
| Calculation method | For each clockwise pulse of the encoder, adds '360 / Number of Pulses Per Rotation' to the result. |
| Analysis in zones | The number of degrees of clockwise rotation of the encoder while the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is updated for each clockwise pulse that occurred during the time period. |
| Notes | This result is useful because it provides fine resolution (compared to number of rotations), while being normalised for all encoders (unlike number of pulses). |
Degrees of anti-clockwise rotation
| Description | Reports the number of degrees of anti-clockwise rotation of the encoder. |
| Calculation method | For each anti-clockwise pulse of the encoder, adds '360 / Number of Pulses Per Rotation' to the result. |
| Analysis in zones | The number of degrees of anti-clockwise rotation of the encoder while the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is updated for each anti-clockwise pulse that occurred during the time period. |
| Notes | This result is useful because it provides fine resolution (compared to number of rotations), while being normalised for all encoders (unlike number of pulses). |
Maximum RPM
| Description | Reports the maximum rotational velocity of the encoder in units of revolutions per minute. |
| Calculation method | Starts with a single pulse of a certain direction, then counts the number of consecutive same-direction pulses until at least 200 milliseconds have elapsed. Uses the elapsed time and the number of pulses detected during it to calculate the rotational velocity. This value is averaged (using a moving average) over ten values, and this is the instantaneous rotational velocity. The highest instantaneous rotational velocity is the maximum RPM. |
| Analysis in zones | The highest instantaneous rotational velocity while the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the maximum value determined during the time period. |
| Units | Revolutions per minute |
| Notes | A rotary encoder has an inherent maximum rotational velocity, above which the encoder will not be read accurately. This value is reported on the I/O page when an encoder is selected. In fact, strictly speaking, this is a limitation of the interface that reads the encoder and not of the encoder itself. For example, when reading a 32 PPR encoder with the ANY-maze interface, the maximum RPM is 416, which is approximately 7 revolutions per second (enough for most likely situations in behavioural research). Note that using an encoder with half as many pulses per rotation will double this value. |
Minimum RPM
| Description | Reports the minimum rotational velocity of the encoder in units of revolutions per minute. |
| Calculation method | Starts with a single pulse of a certain direction. Then counts the number of consecutive same direction pulses until at least 200 milliseconds have elapsed. Uses the elapsed time and the number of pulses detected during it to calculate the rotational velocity. This value is averaged (using a moving average) over ten values, and this is the instantaneous rotational velocity. The lowest instantaneous rotational velocity is the minimum RPM. |
| Analysis in zones | The lowest instantaneous rotational velocity while the animal was in the zone. |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the minimum value determined during the time period. |
| Units | Revolutions per minute |
| Notes | If the encoder stops turning, this value will be zero. |
Average RPM
| Description | Reports the average rotational velocity of the encoder in units of revolutions per minute. |
| Calculation method | Starts with a single pulse of a certain direction. Then counts the number of consecutive same direction pulses until at least 200 milliseconds have elapsed. Uses the elapsed time and the number of pulses detected during it to calculate the rotational velocity. This value is averaged (using a moving average) over ten values, and this is the instantaneous rotational velocity. The instantaneous rotational velocity is averaged throughout the test to yield this measure (see notes). |
| Analysis in zones | The average of the instantaneous rotational velocity values reported while the animal was in the zone (see notes). |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the average of the instantaneous rotational velocity values reported during the time period (see notes). |
| Units | Revolutions per minute |
| Notes | The averaging of the instantaneous rotational velocity (IRV) values uses a time-based averaging technique, such that the average is the sum of each IRV value multiplied by the time between two consecutive values divided by the sum of the time between all values. This is required because the IRV values are not reported at a fixed frequency. |
Average RPM while turning
| Description | Reports the average rotational velocity of the encoder for the time when it was turning, in units of revolutions per minute. |
| Calculation method | Starts with a single pulse of a certain direction. Then counts the number of consecutive same direction pulses until at least 200 milliseconds have elapsed. Uses the elapsed time and the number of pulses detected during it to calculate the rotational velocity. This value is averaged (using a moving average) over ten values, and this is the instantaneous rotational velocity (IRV). All non-zero IRV values are averaged to yield this measure (see notes). |
| Analysis in zones | The average of the non-zero instantaneous rotational velocity values reported while the animal was in the zone (see notes). |
| Analysis across time | This measure can be analysed across time. For any time period, the result is the average of the non-zero instantaneous rotational velocity values reported during the time period (see notes). |
| Units | Revolutions per minute |
| Notes | The averaging of the instantaneous rotational velocity (IRV) values uses a time-based averaging technique, such that the average is the sum of each non-zero IRV value multiplied by the time between two consecutive non-zero values divided by the sum of the time between all such values. This is required because the IRV values are not reported at a fixed frequency. |
See also:

© Copyright 2003-2026 Stoelting Co. All rights reserved
ANY-maze help topic T0154
|