Determining a position of a deadbolt used to lock and unlock a door is disclosed. An electromechanical lock can include a deadbolt that can retract or extend along a linear path as the door is to be locked and unlocked. A sensor such as an accelerometer can rotate along a non-linear path as the deadbolt moves along a linear path. The accelerometer can determine a gravity vector that can be indicative of a position of the accelerometer along the non-linear path. A controller can then determine a position of the deadbolt based on the gravity vector.