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 
 Time turning 
 Distance 
 Number of clockwise rotations 
 Number of anti-clockwise rotations 
 Number of reversals 
 Number of half rotations 
 Number of quarter rotations 
 Degrees of clockwise rotation 
 Degrees of anti-clockwise rotation 
 Maximum RPM 
 Minimum RPM 
 Average RPM 
 Average RPM while turning  

  

  

Number of rotations

DescriptionReports the number of complete rotations of the encoder.
Calculation methodCounts a rotation when an unbroken sequence of 'number of pulses per rotation' same direction pulses is received.
Analysis in zonesCounts 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 timeThis measure can be analysed across time. For any time period, the result is the number of rotations that ENDED during the time period.
UnitsNone
NotesNone

  

  

Time turning

DescriptionReports the time for which the encoder was actually turning.
Calculation methodReports 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 zonesThe time the encoder was turning while the animal was in the zone.
Analysis across timeThis measure can be analysed across time. For any time period, the result is the time that the encoder was turning during the time period.
UnitsSeconds
NotesNone

  

  

Distance (only applies to running wheels)

DescriptionReports the distance the animal 'travelled'.
Calculation methodThe number of rotations multiplied by the circumference of the wheel.
Analysis in zonesThe distance the animal 'travelled' in the wheel while it was in the zone.
Analysis across timeThis 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.
UnitsThe units specified in Analysis options on the Protocol page
NotesThis 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

DescriptionReports the number of complete clockwise rotations of the encoder.
Calculation methodCounts a rotation when an unbroken sequence of 'number of pulses per rotation' clockwise pulses is received.
Analysis in zonesCounts 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 timeThis measure can be analysed across time. For any time period, the result is the number of clockwise rotations that ENDED during the time period.
UnitsNone
NotesNone

  

  

Number of anti-clockwise rotations

DescriptionReports the number of complete anti-clockwise rotations of the encoder.
Calculation methodCounts a rotation when an unbroken sequence of 'number of pulses per rotation' anti-clockwise pulses is received.
Analysis in zonesCounts 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 timeThis 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.
UnitsNone
NotesNone

  

  

Number of reversals

DescriptionReports the number of times the direction of the encoder changed.
Calculation methodCounts the number of times a clockwise pulse was followed by an anti-clockwise pulse and vice versa.
Analysis in zonesCounts 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 timeThis measure can be analysed across time. For any time period, the result is the number of reversals that occurred during the time period.
UnitsNone
NotesNone

  

  

Number of half rotations

DescriptionReports the number of half rotations of the encoder.
Calculation methodCounts a half rotation when an unbroken sequence of 'number of pulses per rotation' divided by two, same direction pulses is received.
Analysis in zonesCounts 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 timeThis measure can be analysed across time. For any time period, the result is the number of half rotations that ENDED during the time period.
UnitsNone
NotesIf 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

DescriptionReports the number of quarter rotations of the encoder.
Calculation methodCounts a quarter rotation when an unbroken sequence of 'number of pulses per rotation' divided by four, same direction pulses is received.
Analysis in zonesCounts 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 timeThis measure can be analysed across time. For any time period, the result is the number of quarter rotations that ENDED during the time period.
UnitsNone
NotesIf 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

DescriptionReports the number of degrees of clockwise rotation of the encoder.
Calculation methodFor each clockwise pulse of the encoder, adds '360 / Number of Pulses Per Rotation' to the result.
Analysis in zonesThe number of degrees of clockwise rotation of the encoder while the animal was in the zone.
Analysis across timeThis measure can be analysed across time. For any time period, the result is updated for each clockwise pulse that occurred during the time period.
UnitsDegrees
NotesThis 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

DescriptionReports the number of degrees of anti-clockwise rotation of the encoder.
Calculation methodFor each anti-clockwise pulse of the encoder, adds '360 / Number of Pulses Per Rotation' to the result.
Analysis in zonesThe number of degrees of anti-clockwise rotation of the encoder while the animal was in the zone.
Analysis across timeThis 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.
UnitsDegrees
NotesThis 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

DescriptionReports the maximum rotational velocity of the encoder in units of revolutions per minute.
Calculation methodStarts 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 zonesThe highest instantaneous rotational velocity while the animal was in the zone.
Analysis across timeThis measure can be analysed across time. For any time period, the result is the maximum value determined during the time period.
UnitsRevolutions per minute
NotesA 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

DescriptionReports the minimum rotational velocity of the encoder in units of revolutions per minute.
Calculation methodStarts 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 zonesThe lowest instantaneous rotational velocity while the animal was in the zone.
Analysis across timeThis measure can be analysed across time. For any time period, the result is the minimum value determined during the time period.
UnitsRevolutions per minute
NotesIf the encoder stops turning, this value will be zero.

  

  

Average RPM

DescriptionReports the average rotational velocity of the encoder in units of revolutions per minute.
Calculation methodStarts 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 zonesThe average of the instantaneous rotational velocity values reported while the animal was in the zone (see notes).
Analysis across timeThis 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).
UnitsRevolutions per minute
NotesThe 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

DescriptionReports the average rotational velocity of the encoder for the time when it was turning, in units of revolutions per minute.
Calculation methodStarts 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 zonesThe average of the non-zero instantaneous rotational velocity values reported while the animal was in the zone (see notes).
Analysis across timeThis 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).
UnitsRevolutions per minute
NotesThe 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:

 Information measures 
 Apparatus measures 
 Zone measures 
 Point measures 
 Sequence measures 
 Key measures 
 On/off input measures 
 Signal measures 
 Sensor measures 
 Movement detector measures 
 On/off output measures 
 Speaker measures 
 Shocker measures 
 Pellet dispenser measures 
 Laser controller measures 
 Syringe pump measures 
 OPAD measures 
 Light controller measures 
 Procedure measures 
 Event measures 
 Virtual switch measures 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T0154