Cyberattacks targeting Internet of Things (IoT), have increased significantly, over the past decade, with the spread of internet-connected smart devices and applications. Routing Protocol for Low-Power and Lossy Network (RPL) enables messages to be routed between nodes for the Wireless Sensor Network in the network layer. RPL protocol, which is sensitive and difficult to protect, is exposed to various attacks. These attacks negatively affect data transmission and cause great destruction to the topology by consuming the resources. Hello Flooding (HF) attacks against RPL cause consumption of constrained resources (memory, processing and energy) in nodes. Therefore, in this study, a Gated Recurrent Unit network model based deep learning has been proposed to predict and prevent HF attacks on RPL protocol in IoT networks. The proposed model has been compared with Support Vector Machine and Logistic Regression methods, and different power states and total energy consumptions of the nodes have been taken into consideration and experimented with. The results confirm the promised and expected performance from the model in terms of source efficiency and IoT security. In addition, attack detection has been carried out with a much lower error rate than literature studies for HF attacks from RPL flood attacks.