The Pololu 3081 Magnetic Encoder Pair Kit includes two dual-channel hall effect sensor boards and two 6-pole magnetic discs that can be used to add quadrature encoding to two micro metal gear motors with extended back shafts.
The encoder senses the rotation of the magnetic disc and provides a resolution of 12 counts per revolution of the motor shaft when counting both edges of both channels. To compute the counts per revolution of the gearbox output shaft, multiply the gear ratio by 12.
These boards are designed to be soldered directly to the back of your motors, with the back shaft of the motor protruding through the hole in the centre. Once the boards are soldered, the motor leads are connected to the M1 and M2 pads along the edge of the board; the remaining four pads are used to power the sensors and access the two quadrature outputs.
The sensors are powered through the VCC and GND pins. VCC can be 2.7 V to 18 V. The quadrature outputs A and B are digital signals that are either driven low by the sensors or pulled to VCC through 10 kΩ pull-up resistors, depending on the applied magnetic field.