A temperature and humidity monitoring and control system based on ESP8266 single-chip microcomputer is designed for showing the real-time temperature and humidity of the factory buildings and machine rooms and to control these two factors. This system takes the ESP8266-12F module as the control unit, and the DHT22 module as the temperature and humidity data acquisition module. The terminal equipment is connected to the Internet through WIFI, and the Alibaba Cloud Internet of things cloud platform can display the temperature and humidity data. The OLED screen is used for real-time data display on the worksite. After processing the data with the amplitude limiting filtering algorithm optimized by the weighted smoothing method, the algorithm is designed to control the 2-way optocoupler relay module to make the fan and the condensing fan operate. And the threshold is set for audible and visual alarm. This design is economical, practical, accurate in operation and basically does not require manual operation, and can meet the design requirements.