AbstractTemperature and humidity as the key factors affecting the storage and ripening of fruits and vegetables directly determine the quality of fruits and vegetables. In this paper, a temperature and humidity model was constructed based on an integrated device of controlled atmosphere storage and ripening. Aiming at the shortcomings of the temperature and humidity model such as large inertia, nonlinearity, and model uncertainty, a fuzzy‐PID controller based on the improved Lévy flight particle swarm algorithm (LFPSO) is proposed. Initially, a mathematical model of temperature and humidity is developed through mechanism research and parameter estimation. Subsequently, a temperature and humidity fuzzy‐PID control strategy is proposed for regulating temperature and humidity. An improved LFPSO is then introduced to optimize the key parameters of the fuzzy‐PID controller, such as the quantization factor and the scale factor. The superiority of the improved LFPSO algorithm is verified by comparing the test functions. Finally, the improved LFPSO‐fuzzy‐PID controller, fuzzy‐PID controller, and Smith‐PID controller are applied to the simulation model for comparison using the MATLAB Simulink simulation platform. The results show that the improved LFPSO‐fuzzy‐PID control algorithm has a good control effect in the temperature and humidity simulation system of controlled atmosphere (CA) ripening container, which provides a reference for solving the optimization problem of actual engineering design.Practical applicationsIn order to reduce the postharvest cold chain losses of fruits and vegetables, this paper proposes a containerized style device that combines fruits and vegetables storage and ripening for simplifying the losses caused by transshipment at cold chain nodes. Since temperature and humidity play a key role in fruits and vegetables storage and ripening, which directly affect the product quality, this paper establishes a complete mathematical model of CA ripening temperature and humidity system by combining mechanism modeling and parameter identification. In order to keep the temperature and humidity within the ideal range, Smith‐PID controller, fuzzy‐PID controller, and fuzzy‐PID control method based on improved Lévy flight particle swarm optimization are proposed to regulate the air conditioner and humidifier. The performance of three different types of controllers was tested on the MATLAB. The simulation results demonstrate that the improved LFPSO‐fuzzy‐PID controller is superior and more effective than Smith‐PID and fuzzy‐PID controllers.