The Internet of Things (IoT) includes various technologies, including sensing devices, Radio-Frequency Identification (RFID), and Microelectromechanical Systems (MEMS). Despite numerous advantages of IoT, security and privacy are important challenges. IoT infrastructures are frequently attacked by different invaders, including white hat hackers whose mission is to test the system's penetrability. Other attacks are orchestrated by adversaries that misuse system vulnerabilities to seize information for personal benefits. Hence, security is a key factor and fundamental requirement of IoT design. Thus, increased cyberattacks call for an appropriate strategic plan to ensure IoT security. Enhancing data security in IoT has proved to be a major concern, and one solution to mitigate this is to apply suitable encryption techniques when storing data in the IoT. An intruder will be able to control IoT devices without physical access if the network is not secure enough. To overcome this challenge, this paper proposes a security design based on Elliptic-Curve Cryptography (ECC), the SHA-256 (Secure Hash Algorithm 256) algorithm, and the Artificial Bee Colony (ABC) algorithm to boost the security of IoT-based smart irrigation systems. The proposed model applies the ABC algorithm to generate the private key for ECC. The results show that the optimal encoding and decoding times were 100 and 150 iterations, respectively. Moreover, compared to 3DES&ECC&SHA-256 and RC4&ECC&SHA-256, the total throughput of the proposed model was about 50.04% and 55.29% higher in encryption and 51.36% and 58.41% higher in decryption. The evaluation indicates a significant improvement (>50%) in the throughput rate. The performance results obtained indicate the efficiency and effectiveness of the proposed scheme in terms of performance and security.