Despite the growing reputation and the ubiquitous nature of the IoT, it poses significant challenges as it is also considered a convenient platform for cyberattacks. The connection of various devices without fixed security help attackers in allowing botnet to run high crash DDoS attacks against a range of internet services. The botnet is one of the main security challenges that have the most impact on IoT for several reasons. It allows the private network devices to be infected by malicious software and controlled as a group without the owners' awareness. Botnets are often utilized for sending spam, stealing data, and performing DDoS attacks. As there are many areas of security that utilize machine learning (ML) technology, utilizing ML to detect botnet appears to be realistic and workable. While several studies have been conducted using ML for detecting botnet, they are either not highly accurate or only compatible with specific types of botnet or devices. This study aims to create an ensemble learning model using the best ML methods among supervised learning, unsupervised learning, and regression learning to optimize the accuracy of botnet detection on IoT and minimize the number of features requested. After several examinations in different combinations of ML algorithms, this study managed to achieve 100% accuracy of botnet detection as well as minimizing the number of features to only 20.