In order to improve the safety performance of the small bending machine, this paper designs a motor control system with ATmega2560 as the core. The laser transmitter and laser receiver are fixed on both sides of the small bending machine, and the laser receiver is used to detect foreign object intrusion in the protection area. If there is foreign object intrusion blocking the laser light, the motor is controlled to stop. This system will provide additional safety protection for workers during work. Speed control is achieved through the feedback of motor speed parameters through motor speed controller and the use of proportional integral differential algorithm to achieve precise speed control. Experimental research shows that the control system in this paper can operate smoothly on a small bending machine, detect foreign objects blocking the laser in a timely manner within the safety protection area, and accurately control the motor to stop.