In order to improve the management of modern large library, an automatic system is needed to arrange the books. The system uses two-dimensional code recognition technology and microcontroller control technology to achieve the efficient management of library. We choose STC89C52 chip as the core controller and the scanning module in the HR-200 laser two-dimensional code scanner as the external communication port. Data is transmitted by serial communication interface between them. By scanning the two-dimensional code on the books and shelves, we can quickly find out the books in wrong position. In this way we can enhance the efficiency of books management obviously. In comparison with the experimental results, the feasibility and rationality of the design are validated as well as the practicability of the system.