Abstract:The invertedpendulum systems are sensitive to the external interference signal and have a high precision request for state feedback quantity. In order to improve the precision of feedback quantity, a scheme used to pick up pulse signals of rotary photoelectric encoders is designed in this paper. The scheme is based on STM32, including second order lowpass filters, pulse shaping circuit and other subsidiary circuits. The pulse signals of photoelectric encoders are tested respectively at different speeds in the experiment and the result shows that the scheme is available to the high frequency disturbance, edge oscillation and pulse deformity. Besides, the mathematic model of single inverted pendulum is built by Lagrangian method and a LQR controller of the inverted pendulum based on this mathematic model is designed. Finally, the real time curve of the pendulum angle is observed in the actual system, indirectly proving the effectiveness and reasonability of the scheme in this paper.