The rapid adoption of Industry 4.0 (I4.0) has driven the need for automated machine-to-machine (M2M) communication in manufacturing. However, legacy equipment remains a challenge due to its incompatibility with modern protocols like semiconductor equipment and materials international (SEMI) equipment communication standard/generic equipment model (SECS/GEM). Replacing these machines is costly, making retrofitting a more viable solution. This paper proposes a modular automation software framework that enables SECS/GEM integration for legacy machines without extensive hardware modifications. The system is implemented using Raspberry Pi and Arduino, acting as an intermediary between legacy equipment and modern factory networks. The framework facilitates real-time data exchange, remote monitoring, and enhanced automation while ensuring scalability and cost-effectiveness. Experimental evaluation demonstrates improved interoperability and reduced manual intervention. This solution provides a practical and adaptable approach to integrating legacy systems into (I4.0) environments.