
Lightbulb during normal traffic After detecting an attack
Figure 2. An example of our light bulb NIDS running on an ESP8266
microcontroller on a modified consumer smart light bulb. Green indicates
normal traffic, whereas red indicates an attack has been detected.
on the lowest power conventional edge microprocessors. We
show that the performance of this NIDS is comparable to the
existing approaches proposed in the literature, while being
significantly faster and more lightweight. To further demon-
strate the applicability of the proposed NIDS at the IoT edge,
we deploy it on a typical smart light bulb, and demonstrate
the world’s first NIDS in a light bulb. A similar smart
light bulb is shown in Figure 1. To do this, we replace the
ESP8266 microcontroller on a consumer smart light bulb, with
a transplant ESP8266 microcontroller featuring our modified
NIDS firmware. Then as a fun way to demonstrate our NIDS
running on the smart bulb, we control the colour of the light
emitted by the bulb, i.e. green during normal operation, and
red when an attack is detected, shown in Figure 2.
The key contribution of this paper is the proposal, imple-
mentation, and evaluation of an extremely lightweight NIDS,
capable of functioning on the lowest-power IoT devices. We
have made the code publicly available here 3. Based on our
experimental evaluation, our system outperforms the state-of-
the-art IoT NIDS proposals on IoT hardware both in terms of
detection accuracy, detection speed and resource requirements.
II. RELATED WORKS
There have been several efforts to develop lightweight and
scalable machine learning systems for use in IoT devices
and networks. There are many previous works that adopt a
signature-based approach for intrusion detection. However,
signature based detection suffers from the limitation that
signatures must be manually updated. Since this paper focuses
on ML-based NIDSs, these works have not been included in
our discussion.
In terms of machine learning based NIDS, these can be
grouped into shallow learning and deep learning. The authors
in [6] and [7] surveyed several approaches to NIDSs in IoT
devices, and found a variety of works that used shallow learn-
ing to great success. For example, [8] evaluated five classifiers
following feature selection, PCA based anomaly detection, a
local deep SVM, a logistic regression and a boosted decision
tree. Across three benchmark datasets, the authors showed
100% accuracy for all approaches other than PCA. There are
also several proposed approaches in the literature that utilise
3Code available at https://rft.io/lightbulb
deep learning models. For instance, [9] uses a multi-layer
perceptron (MLP) model, which is a fully connected dense
artificial neural network, to achieve 99.4% accuracy. There
are also several deep unsupervised approaches, such as [10],
which showed that using an autoencoder, a sufficiently low
reconstruction loss could be achieved for networking data, to
facilitate an IoT compatible anomaly detection system. More
advanced forms of neural networks, such as graph neural
networks, have also been proposed for IoT devices [11], and
these have achieved F1 scores of 0.81 on two IoT benchmark
datasets. However, these systems discussed here that have
achieved 99%+ accuracy were not tested on real IoT hardware.
There has been a limited number of works that have tested
proposed NIDSs on real IoT hardware. The use of Google’s
Edge TPU platform has been explored for use with NIDS
models [3]. Here, the authors compared the performance of
a convolutional neural network (CNN) running on a Google
Edge TPU with that of a Raspberry Pi (Cortex-A53), and
demonstrated fast performance as well as 0.98+ F1 scores.
However, both Edge TPU and Raspberry Pi have significantly
more processing power than the average IoT smart device.
[5] is the most relevant to our work, since it implements a
deep learning based NIDS on several lower power hardware
platforms [5], including ESP32-WROOM-32, ESP8266 and
ATmega328p. The authors used TensorFlow Lite for their
approach, which allowed them to bring a pre-trained neural
network model to various microcontrollers [4]. They were able
to achieve 96.7% detection accuracy on the ESP32-WROOM-
32. However, the proposed model was too large to be deployed
on low-end devices such as ATMega328p. Furthermore, the
authors’ ESP8266 implementation used nearly 100% of the
device’s memory, making it impractical for parallel deploy-
ment to an existing low-end IoT device, where a significant
amount of memory is likely required for the code and data of
the devices’ core functionality.
There exist several solutions, outside of TensorFlow Lite,
that allow machine learning models to be brought to mi-
crocontrollers. Of particular interest here are solutions that
can convert models developed in scikit-learn [12], another
widely used machine learning framework, to microcontroller
compatible code. These tools, which include sklearn-porter,
and EmbML [13], are capable of porting pre-trained scikit-
learn models to microcontrollers. However, unlike Tensorflow
Lite which is primarily focused on deep learning models,
scikit-learn features many shallow learning approaches. To
the best of our knowledge, no previous work has used these
techniques to take pre-trained NIDS models and run them on
IoT hardware.
In summary, although there are many works that demon-
strate high accuracy for IoT NIDSs when tested on benchmark
data, there has been relatively limited experimental research
into the practical implementation and deployment of NIDSs
on IoT edge hardware. The research that has been conducted
to date delivers NIDSs that either require too much processing
power to operate, or would utilise too much of device re-
sources to be applicable as part of a smart device with inbuilt