The invention discloses a mechanism for controlling a position of a variable valve. The mechanism comprises fixed lugs, a stand, a
servo motor, an
encoder, a second-grade gear shaft, a first-grade large gear, a first-grade small gear, a second-grade large gear, a bearing and an output shaft; the stand is fixed on the left side of the
servo motor, and is connected by adopting a bolt; the
encoder ismounted on the right side of the
servo motor, and is connected by adopting a bolt; the output shaft is fixed in the stand, and is in clearance fit; four fixed lugs are provided and mounted on the upper and lower sides of the stand, and are fixed by
welding; and the first-grade small gear is mounted on the left side of the servo motor, and is in
interference fit. The
encoder is provided with a photoelectric
receiver, a photoelectric emitter, a shell, a circuit board, a coded disc and a connecting shaft; and through the improved prior art, the openness of the valve is detected by adopting the encoder, so that the openness of the valve can be precisely controlled, the magnitude of water currents is not needed to judge if the valve is opened large or small, and the openness range is more precise.