In this work, issues of water separation and purification are addressed, where, in order to achieve the desired results, it is necessary to use several disciplines such as classical physics, biotechnology, automatic control, automation, and applications of industry 4.0. Further, the need for comprehensive and automated solutions for rainwater treatment in the agricultural sector is addressed. This research focuses on designing and implementing a system adapted to these needs using Siemens technologies. The methodology ranges from the design of the Piping and Instrumentation Diagram (P&ID) to the implementation of the interface, incorporating Siemens technologies for data acquisition, electrical connections, treatment programming, and PID controller design. The results show significant advances in the development of the system, highlighting the effectiveness of automation and the HMI-PLC human–machine interface in process monitoring and control. These findings support the viability of a comprehensive rainwater treatment system for the agricultural sector, with important implications for water efficiency, environmental preservation, and increased productivity in agricultural and livestock activities. The contribution of this work is the relationship between engineering and research focused on industrial processes. The scientific contribution is to obtain the dynamic models and apply two strategies to obtain the gains of the PID controller. The first method is performed through the proposal of a Hurwitz polynomial, and the second is performed through genetic algorithms (GA), where they are implemented in a controller that is commonly used in the industry. The technological part includes the integration of work (schemes, programming, and communications) so that the result is as close to what was expected.