This research focused on testing with maize, economical crop grown in Phetchabun province, Thailand, by installing a total of 20 sets of internet of things (IoT) devices which consist of soil moisture sensors and temperature and humidity sensors (DHT11). Data science tools such as rapidminer studio was used for data cleansing, data imputation, clustering, and prediction. Next, these data would undergo data cleansing in order to group them to obtain optimization clustering to identify the optimum condition and amount of water required to grow the maize through k-mean technique. From the analysis, the optimization result showed 3 classes and these data were further analyzed through prediction to identify precision. By comparing several algorithms including artificial neural network (ANN), decision tree, naïve bayes, and deep learning, it was found that deep learning algorithm can provide the most accurate result at 99.6% with root mean square error (RMSE)=0.0039. The algorithm obtained was used to write function to control the automated watering system to make sure that the temperature and humidity for growing maize is at appropriate condition. By using the improved watering system, it improved the efficacy of watering system which saves more water by 13.89%