A Real-Time Tsetlin Machine-based Non-intrusive Load Monitoring System on MCUs
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
A Real-Time Tsetlin Machine-based Non-intrusive Load Monitoring System on MCUs Tianhang Tan, Han Wu, Tousif Rahman, Shengyu Duan, Alex Yakovlev, Rishad Shafik
arXiv:2608.18780v1 [cs.LG] 19 Aug 2026
School of Engineering, Newcastle University, Newcastle Upon Tyne, United Kingdom {t.tan8, han.wu2, Tousif.Rahman, Alex.Yakovlev, Rishad.Shafik}@newcastle.ac.uk
Abstract—Non-Intrusive Load Monitoring (NILM) systems estimate individual appliance energy consumption from a single aggregate meter, without requiring separate sensors for each device. By installing a single meter that measures a building’s total electricity consumption, NILM algorithms can determine the active status of each appliance. However, traditional NILM systems use computationally intensive optimization algorithms to process offline data, limiting their capability for on-device deployment, where sensitive household data must be processed locally. This paper proposes a Tsetlin Machine (TM)-based NILM framework, targeting real-time applications on resource-constrained microcontrollers (MCUs), enabling privacy-preserving edge deployment. The problem is reformulated as a classification task, and the proposed approach achieves an average precision of 90% and recall of 96% for two-appliance classification, and 77% precision and 80% recall for four appliances on the REDD dataset. The trained model occupies only 18 KB of flash memory and achieves an inference latency of 0.43 ms on an ESP32, demonstrating its suitability for embedded NILM applications on MCUs. Index Terms—Machine Learning.
I. I NTRODUCTION Non-intrusive Load Monitoring (NILM) aims to estimate the energy consumption of individual appliances within a building without installing a power meter for each device. Since deploying dedicated sensors for every appliance is both time-consuming and expensive, a more cost-effective approach is to install a single meter at the point where electricity enters the building (see Fig. 1a). Therefore, extracting the energy consumption of individual appliances from the total load becomes a key challenge, known as energy disaggregation. Traditional Model-based Methods: The first NILM algorithm was proposed in [1], where the energy disaggregation problem was formulated as a combinatorial optimization problem. In this approach, a Finite State Machine (FSM) is used to represent the operating states of individual appliances. Subsequently, a variety of model-based methods have been developed, including Factorial Hidden Markov Models (FHMMs) [2] and Mixed-Integer Linear Programming (MILP) approaches [3]. Machine Learning-based Methods: Model-based methods typically require prior knowledge of appliance characteristics and the number of appliances present in the household, which is often unavailable in real-world settings. To overcome these limitations, researchers turned to data-driven approaches that automatically extract appliance features from aggregated data.
Both traditional Machine Learning (ML) models, such as kNearest Neighbor (KNN) and Support Vector Machine (SVM) [4], as well as Deep Learning models [5], [6] are studied for the NILM problem. Real-time Applications: Both Model-based methods and ML-based methods rely on computationally intensive optimization algorithms, which limit their applicability in real-time monitoring applications [7]. To address this limitation, this work adopts a lightweight and memory-efficient machine learning model, the Tsetlin Machine (TM) [8], to enable near real-time NILM on a microcontroller unit (MCU). The NILM problem is reformulated as a classification task and solved using the TM model. The implementation of the proposed TM-based NILM system is released as open source on GitHub1 . II. TM-BASED NILM S YSTEM Due to the limited memory and computational power on MCUs, this work adopts the Tsetlin Machine (TM) as the underlying machine learning model. TM is a classification model that operates on binary input features, where each feature is a Boolean value (0 or 1) (see Fig. 2). Without heavy floating-point multiplications, TM is more computationally efficient than neural networks and enables real-time NILM on MCUs. The TM-based NILM system consists of four main components: Edge Detection, Event Pairing, Feature Extraction, and TM-based Machine Learning classification: Edge Detection module takes raw sensor data as input and identifies power transitions, which correspond to appliance activation (rising edges) and deactivation ( falling edges) events. • Event Pairing algorithm groups corresponding rising and falling edges into complete appliance activity windows, which are then used for feature extraction and classification. • Feature Extraction module converts each appliance activity window into a compact feature representation, capturing transition characteristics, temporal patterns, steadystate behavior, and energy consumption information. • TM-based Machine learning module first converts extracted features to boolean values (either 0 or 1) and •
1 The source code is available at: https://github.com/wuhanstudio/nilm.
(a) Illustration of a NILM system.
must be paired to form an active-cycle event before feature extraction. Features are then extracted from these paired event windows and used to train the Tsetlin Machine. A local event-pairing algorithm keeps a list of recent rising edges. When a falling edge is detected, it searches this list and selects the rising edge, or a small group of rising edges, whose power change best matches the falling transition. This follows the common NILM assumption that the power increase when an appliance turns on should be close to the power decrease when it turns off. However, a local strategy can be sensitive to noisy or closely spaced transitions. Once a rising edge is paired or removed from the recent-edge list, the decision cannot be revised later. As a result, a nearby but incorrect rising edge may be selected, while a more suitable edge is skipped. To reduce this problem, the local search strategy is improved with a global event-pairing step. First, the rising and falling edges are sorted by time. A rising edge and a subsequent falling edge are considered as a candidate pair only when their duration is within a time limit. We then check whether their power changes are consistent. For a rising edge (i) and a falling edge (j), the power error is defined as eij = |∆Pi+ + ∆Pj− |
(b) Demonstration of the proposed system on a MCU.
Fig. 1: (a) Non-Intrusive Load Monitoring (NILM) estimates the power consumption of individual appliances from a single aggregated mains meter without requiring dedicated sensors for each device. (b) Demonstration of the proposed TM-based NILM system on a MCU.
then classifies the appliance associated with each activity window. A. Edge Detection To reduce computational overhead on MCUs, the proposed NILM system adopts an event-driven architecture. Processing is triggered only when a transition is detected, that is, when the change in power consumption exceeds a predefined threshold, indicating that the power consumption has reached a new steady state. However, raw sensor data are inherently noisy, and transient spikes should not be detected as state transitions. To address this issue, Hart [1] proposed a steady-state detector that identifies only transitions between steady states, thereby filtering out transient noise. While the original implementation assumes access to offline data, the proposed system reimplements the detection algorithm for real-time streaming data on MCUs. B. Event Pairing After edge detection, each detected steady-state transition, whether a rising or falling edge, represents only a single change in power consumption. To capture a complete appliance activity, the corresponding rising and falling transitions
(1)
The pair is accepted only when this error is smaller than an allowed tolerance. The tolerance combines an absolute and a relative margin: τij = max(100, ; 0.25|∆Pj− |).
(2)
This allows small measurement errors while still rejecting pairs with clearly inconsistent power changes. For each valid candidate pair, we use the score eij , (3) sij = 1 − τij where a higher score means a better ON/OFF power match. A dynamic program is then used to select the set of pairs with the highest total score. In this way, each detected edge is used at most once, and unreliable edges can remain unmatched. C. Feature Extraction To formulate NILM as a classification problem, features are extracted from each paired event, which defines an appliance activity window. For each detected appliance activation episode, a set of 21 features is extracted to characterize its transition behaviour, steady-state characteristics, temporal properties, and internal dynamics. The complete list of extracted features is summarized in Table I. D. TM-based Machine Learning A Tsetlin Machine (TM) is a rule-based machine learning model that learns patterns through collections of Tsetlin Automata (TAs). Each TA independently learns whether to include or exclude input literals, enabling the model to construct interpretable logical clauses. These clauses are combined to
Fig. 2: The TM-based NILM approach extracts the 21 features from aggregated meter readings after edge detection and event pairing, normalizes and Booleanizes the resulting features, and then feeds them into the TM model for classification. TABLE I: Features extracted from each paired appliance activity window. Category
Transition
Steady-state statistics
Internal dynamics
Energy & context
Feature Positive transition magnitude Negative transition magnitude Average absolute transition magnitude Logarithm of absolute transition magnitude Episode duration Logarithm of episode duration Transition–duration product Transition–duration ratio Mean power Standard deviation of power Minimum power Maximum power Power range Mean absolute consecutive-sample difference Maximum absolute consecutive-sample difference Number of significant internal power transitions Estimated number of operating subcycles Active-state fraction Episode energy estimate Post-event minus pre-event mean power Number of large internal power transitions
perform classification using simple Boolean operations, avoiding computationally expensive operations such as floatingpoint multiplication and matrix operations. This makes TM particularly suitable for deployment on MCUs. Booleanization: TM accepts only Boolean values as input features. Therefore, each floating point feature is first normalized to the range [0, 1], then scaled to [0, 255] and converted to 8-bit integers. Lastly, bitwise decomposition is applied to each integer, producing the Boolean input features required by the TM. Model Inference: The TM model is trained offline on a host computer and then deployed to the MCU for inference. The trained model is serialized using Protobuf, and the inference model retains only the indices of active Tsetlin Automata (TAs), eliminating unnecessary state information and sub-
stantially reducing the memory footprint for deployment on resource-constrained MCUs. All aforementioned components are implemented on the MCU, including edge detection, event pairing, feature extraction, and TM inference, ensuring that sensitive household data remains securely processed on local device. III. E XPERIMENTAL R ESULTS Experiments are conducted on the REDD dataset, which was collected from 6 residential buildings [2] and pre-processed using the NILMTK toolkit [9]. The dataset contains both aggregate measurements from the main meter and individual appliance-level power measurements. Buildings 1, 2, 4, 5, and 6 are used for training, while Building 3 is selected for testing because it contains measurements for all appliances considered in this study. Hyperparameter optimisation is performed using Optuna [10]. The TM is trained with 286 clauses, 196 TA states, and 8-bit feature encoding. The threshold (T ) and specificity (s) parameters are set to 20 and 6.0, respectively. The model is trained for 10 epochs. A. Binary Classification First, a binary classification TM model was trained to distinguish between the active cycle of a fridge and a microwave. As shown in Tab. II, the model achieved high precision and recall for both appliances. The two appliances are easily separable because the fridge cycles are characterized by low-power transitions and long operating durations, whereas microwave cycles typically involve high-power transitions over short durations (see Fig.3). B. Multi-class Classification However, as the number of appliances increased, the overall classification performance decreased due to more complex operating patterns of certain appliances, as shown in Tab. III. For example, the electric furnace often consist of multiple
Appliance Fridge Microwave
Precision 0.99 0.80
Recall 0.97 0.95
TABLE II: Precision and Recall of a TM model trained on Fridge and Microwave. Appliance Fridge Microwave Dish Washer Electric Furnace
Precision 0.84 0.75 0.10 0.50
Recall 0.94 0.95 0.08 0.15
TABLE III: Precision and Recall of a TM trained on multiple appliances.
short active sub-cycles within a single operating cycle, making it difficult to distinguish from other appliances. C. SRAM and Flash Memory Consumption Lastly, the trained TM model requires only 23 KB of Flash memory and 168 bytes of SRAM (corresponding to 21 features encoded with 8 bits each). It achieves an inference time of approximately 0.43 ms per sample on an ESP32 using the Arduino framework, demonstrating its suitability for real-time deployment on MCUs. IV. D ISCUSSION The proposed TM-based NILM approach has several limitations. The main bottleneck lies in the accuracy of edge detection and event pairing, as incorrect detection of power transitions or failure to correctly associate rising and falling edges can lead to inaccurate appliance activity windows and consequently degrade classification performance. In addition, the performance decreases in multi-class scenarios due to the overlapping and complex power signatures of different appliances. Appliances with similar operating patterns or multi-stage operating cycles are particularly challenging to distinguish using the extracted Transition-Duration features. Future work will investigate more robust event detection and
Fig. 3: Scatter plot of appliance events in the TransitionDuration feature space, showing that fridge and microwave events are well separated.
pairing strategies, as well as richer feature representations, to improve scalability to a larger number of appliances. V. C ONCLUSION In conclusion, this paper presents a TM-based approach for NILM on resource-constrained MCUs. By reformulating NILM as a classification problem, the proposed method achieves an average precision of 90% and recall of 96% for two-appliance classification on the REDD dataset, while attaining 77% precision and 80% recall for four appliances. Furthermore, the trained model requires only 23 KB of Flash and achieves an inference speed of 0.43 ms per sample on an ESP32, making it suitable for real-time embedded applications. R EFERENCES [1] G. W. Hart, “Nonintrusive appliance load monitoring,” Proceedings of the IEEE, vol. 80, no. 12, pp. 1870–1891, 1992. [2] J. Z. Kolter and M. J. Johnson, “Redd: A public data set for energy disaggregation research,” in Workshop on data mining applications in sustainability (SIGKDD), San Diego, CA, vol. 25, 2011, pp. 59–62. [3] F. M. Wittmann, J. C. López, and M. J. Rider, “Nonintrusive load monitoring algorithm using mixed-integer linear programming,” IEEE Transactions on Consumer Electronics, vol. 64, no. 2, pp. 180–187, 2018. [4] E. Tabanelli, D. Brunelli, A. Acquaviva, and L. Benini, “Trimming feature extraction and inference for mcu-based edge nilm: A systematic approach,” IEEE Transactions on Industrial Informatics, vol. 18, no. 2, pp. 943–952, 2021. [5] V. Piccialli and A. Sudoso, “Improving non-intrusive load disaggregation through an attention-based deep neural network. energies 2021, 14, 847,” Energy Data Analytics for Smart Meter Data, p. 63, 2021. [6] N. Rajkumar, A. Govindaram, R. Geetha, S. ASF et al., “Non-intrusive load monitoring techniques for intelligent energy management: A comparative study of fhmm and lstm approach,” in 2025 International Conference on Visual Analytics and Data Visualization (ICVADV). IEEE, 2025, pp. 869–874. [7] A. Faustine, N. H. Mvungi, S. Kaijage, and K. Michael, “A survey on non-intrusive load monitoring methodies and techniques for energy disaggregation problem,” arXiv preprint arXiv:1703.00785, 2017. [8] O.-C. Granmo, “The tsetlin machine–a game theoretic bandit driven approach to optimal pattern recognition with propositional logic,” arXiv preprint arXiv:1804.01508, 2018. [9] N. Batra, J. Kelly, O. Parson, H. Dutta, W. Knottenbelt, A. Rogers, A. Singh, and M. Srivastava, “Nilmtk: An open source toolkit for non-intrusive load monitoring,” in Proceedings of the 5th international conference on Future energy systems, 2014, pp. 265–276. [10] T. Akiba, S. Sano, T. Yanase, T. Ohta, and M. Koyama, “Optuna: A next-generation hyperparameter optimization framework,” in The 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2019, pp. 2623–2631.
Related documents
- Resolving Conflicts Between RTOS Timekeeping and Uninterruptable Trusted Computing#1048641
- Advanced Diabetes Management Using Artificial Intelligence and Continuous Glucose Monitoring Sensors#976582
- Development of explainable intelligent solutions for self-monitoring and prognostics of connected manufacturing systems#161193
- Accuracy and Safety of Real Time Continuous Glucose Monitoring Before, During and After Surgery#909580
- Cutting Corners on Uncertainty: Zonotope Abstractions for Stream-based Runtime Monitoring#629899
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive