A __Motor Encoder__ uses either a Hall Effect sensor or some kind of opto-interrupter to determine how fast a [motor] is turning. This is used by a [PID Controller] to set and maintain control over a robot motor. !! Hall Effect This uses a small magnet attached to the motor's shaft and two electromagnetic __[Hall Effect|https://en.wikipedia.org/wiki/Hall_effect]__ sensors spaced 180° across each other from the shaft, which detect the motor's motion, with the sensors out of phase of each other. The phase shift permits a determination of motor direction (though this generally isn't required in a robot controller since we already know which direction the motor is going by the polarity we're sending it). See: [Interfacing Hall Effect Motor Encoder|InterfacingHallEffectMotorEncoder] !! Opto-Interrupter This uses an LED emittor-detector pair and a small wheel connected to the motor's shaft, with either holes (if the sensor is measuring the light passing through the holes) or alternating black and white patches (if the sensor is measuring reflected light). On the [motors] page is listed a ''MiniQ Motor Wheel Set w/ Encoder'' that uses the teeth of a white plastic wheel hub for an optical encoder. !! Links Here's some preliminary links related to quadrature encoders running on an RP2040 PIO: * [https://github.com/GitJer/Rotary_encoder|https://github.com/GitJer/Rotary_encoder] * [https://news.ycombinator.com/item?id=26130863|https://news.ycombinator.com/item?id=26130863] * [https://www.raspberrypi.org/forums/viewtopic.php?t=303553|https://www.raspberrypi.org/forums/viewtopic.php?t=303553] * [https://github.com/MikeTeachman/micropython-rotary|https://github.com/MikeTeachman/micropython-rotary] * [https://docs.micropython.org/en/latest/pyboard/tutorial/assembler.html?highlight=assembler#|https://docs.micropython.org/en/latest/pyboard/tutorial/assembler.html?highlight=assembler#] ---- [{Tag Hardware}]