The majority of dams still use traditional technologies to manage water gates. These strategies have a number of limitations, including those related to human error. This study describes an automated method for controlling and managing dams based on the structure of a cyber-physical system (CPS) in order to reduce work hazards and human efforts. The suggested system design consists of four ESP8266 nodes, each connected to a water level sensor and distributed around the main dam and its feeder sections. These nodes are linked to a central server (Raspberry Pi4). The data is gathered and retransmitted through the message queuing telemetry transfer (MQTT) protocol to the (Raspberry Pi4) central server via wireless sensor nodes (WSNs) distributed on the dam's various sides to regulate the water levels in the dam's main reservoir and the areas it feeds. Furthermore, the Raspberry Pi4 transmits data to the cloud server using internet media. A cloud-based dashboard with numerous tabs for each node has been constructed. The results of the experiments reveal that the proposed technique is superior to the ones currently in use for dam management.