As a new development direction in the field of information science, wireless sensor network (WSN) has attracted wide attention of academia and industry with its huge application prospect. This research mainly discusses the automatic control system of balcony agriculture stereoscopic cultivation based on wireless sensor network. With the application background of environmental monitoring of protected cultivation, this paper analyzes the specific requirements of plant protected cultivation, and designs the overall scheme of wireless sensor network system with temperature, humidity and light as detection parameters. In this paper, a distance based routing algorithm is designed to realize the networking of wireless sensor networks, and the network simulation is carried out with TOSSIM. Aiming at the problem of packet loss in wireless network data transmission, this paper analyzes the operation mechanism and message structure of TinyOS operating system, and designs MAC protocol based on network synchronization to ensure reliable data transmission. The experimental results show that when the communication distance is 230 m, the two nodes can carry out normal data transmission; when the communication distance is less than 310 m, the bit error rate is very small; when the distance is more than 360 m, the bit error rate is significantly improved; when the distance is more than 400 m, the bit error rate is 100%. It can be seen that wireless sensor network can bring greater convenience to the acquisition of agricultural information, and it is of great significance to extend the application of wireless sensor network to the field of agricultural automation.