The Internet of Things (IoT) continues to grow, with billions of connected devices operating insafety-critical domains, from smart homes to healthcare, where a single breach can disrupt physical infrastructure and daily life. In response, machine-learning-driven Intrusion Detection Systems (IDS) have emerged as a prominent defence. Although models trained with supervisedlearning can detect anomalies in network traffic with high accuracy, their performance dependson the dataset, and high-quality datasets remain difficult to obtain. This thesis addresses thechallenge of creating datasets that emulate behaviours found in real-life IoT networks, using theCooja network simulator. By implementing a base blackhole attack we evaluate IDS performanceand data generalisability on network sizes ranging up to 40 nodes, one versus two simultaneousattackers, fluctuating node availability, and varied simulation durations. Each setup yields labelledtraces for training and testing. The test results show that despite more realistic conditions the IDSachieves robust detection accuracy, most median ROC-AUC scores exceed 0.80, demonstratingthat the IDS can detect attacks with good accuracy in realistic IoT networks. We can also see astrong generalization ability from the IDS, yielding either a more compact interquartile range, indicating stabler performance across random seeds, or a higher median ROC-AUC when combiningsimilar datasets for training.