According to some exemplary embodiments described herein, a door lock may include a driveshaft operatively couplable to a bolt configured to move between an extended position and a retracted position to selective secure an associated door. The door lock may also include a transmission coupled to the driveshaft, where the driveshaft includes at least one gear configured to rotate with the driveshaft. The door lock may also include a magnetic encoder coupled to the transmission and configured to measure a position of the at least one gear. The magnetic encoder may include a diametrically polarized magnet coupled to the at least one gear.