As a supplement to the growing power grid, the microgrid provides high-quality power services for users at the grid's edge. Maintaining the stability of the microgrid is conducive to providing users with high-quality power services and maintaining the safe operation of the grid. This paper briefly introduced the smart microgrid and the automatic regulation strategy used for controlling the stability of the microgrid, optimized the PI regulation strategy with the backpropagation (BP) algorithm, and improved the BP algorithm with particle swarm optimization (PSO). Finally, the traditional, the BP algorithm based, and the improved BP algorithm based PI regulation strategies were simulated in MATLAB software. The results showed that the three strategies could all make effective, stable regulation on the grid-connected voltage and frequency, but the improved BP algorithm based PI regulation strategy is more effective for grid-connected voltage and frequency control.