The chemical industry generates a broad spectrum of hazardous gases, presenting significant challenges for conventional detection methods due to their diverse chemical properties and low concentration levels. E-nose systems, employing sensor arrays, offer significant potential for the determination of gas mixtures. This study presents a novel E-nose algorithm, CNN-ECA, which integrated CNNs and attention mechanisms to improve the recognition accuracy of E-nose systems. By integrating the attention mechanism module into CNN's convolutional operations, the algorithm emphasizes critical feature information. Three hazardous gases (ammonia, methanol, and acetone) and their mixtures were chosen as target gases. CNNs were combined with various attention mechanism networks (SENet, ECA, and CBAM) to construct models, which were then employed to train and evaluate data collected from the sensor array. The results were compared with traditional network models (KNN, SVM, and CNN). Experimental findings indicated that the prediction performance of CNN models combined with attention mechanism networks surpassed that of traditional network models. Particularly, the CNN-ECA network model demonstrated the highest performance in both qualitative and quantitative analyses. This study presents a promising solution for mixed gas detection by synergizing CNN and attention mechanism networks, thereby enhancing the accuracy and reliability of mixed gas measurements. Moreover, capitalizing on the lightweight architecture of the CNN-ECA model, transfer learning techniques were employed to adapt it for deployment on the Raspberry Pi hardware platform. This facilitates the development of a real-time E-nose system for gas detection.