📚 Tutorials & Technical Blog

Practical walkthroughs on TinyML, Smart Buildings, Federated Learning, and IoT — based on real research and datasets. To add a new tutorial, edit _data/tutorials.yml.

In this project, we aim to build a smart HVAC control system using data collected from various IoT sensors installed in a smart home environment. The core idea is to develop a digital twin of the HVAC system, which allows us to simulate, monitor, and control the HVAC performance in real-time by leveraging sensor data.
Data Collection and IoT Sensor Integration

We collected real-world data from multiple IoT sensors measuring temperature, humidity, CO₂ levels, and energy consumption. This dataset serves as the foundation for our predictive models.

Building Predictive Models with LSTM and BiLSTM

We employed LSTM and Bidirectional LSTM (BiLSTM) models to forecast environmental conditions. The BiLSTM analyses data in both forward and backward directions, yielding more accurate predictions for fluctuating environments.

Digital Twin Integration

The digital twin continuously receives real-time sensor data, making predictions and adjusting HVAC settings accordingly — improving comfort while reducing energy consumption.

Transformers have revolutionised NLP — but their attention mechanism is equally powerful for time-series analysis. In this tutorial we walk through the key concepts: multi-head self-attention, positional encoding, and why Transformers outperform LSTM on long-horizon forecasting tasks in smart building environments.

Why Transformers for Time Series?

LSTMs process sequences step-by-step, making it hard to capture long-range dependencies. Transformers attend to all time steps simultaneously, capturing seasonal patterns and cross-sensor correlations that LSTMs miss.

Practical Example: Indoor Temperature Forecasting

We apply a TCN-Transformer hybrid (FedTemp) to the UNICAL Smart Laboratory dataset, achieving state-of-the-art multi-step prediction across five rooms.

TinyML bridges the gap between powerful deep learning models and the extreme constraints of embedded IoT devices (< 256 KB RAM). This tutorial covers the full compression pipeline from a standard PyTorch/Keras model to a deployable binary.

Pruning

We remove unimportant weights using magnitude pruning, achieving up to 90% sparsity with less than 2% accuracy loss on indoor sensor datasets.

Post-Training Quantisation

Converting float32 weights to int8 reduces model size by 4× and speeds up inference on ARM Cortex-M by up to 3×. We demonstrate this on the iBTEC temperature model.

TensorFlow Lite Deployment

Step-by-step conversion from Keras → TFLite → C array, ready for Arduino / STM32.

Federated Learning trains a shared model across decentralised clients (buildings) without exposing their private sensor data. This tutorial builds a federated temperature forecasting system using the FedTemp framework.

System Architecture

Each building acts as a client, training a local TCN model on its own data. A central aggregator combines the local model weights using FedAvg — no raw data ever leaves the building.

FedProx for Heterogeneous Data

Real buildings have different occupancy patterns and HVAC systems (non-IID data). FedProx adds a proximal term to prevent client drift, significantly improving convergence in heterogeneous scenarios.

Running the Code

We use the UNICAL and AEI Energia datasets split across virtual clients, simulated with Flower (flwr) framework.

Neural networks suffer from catastrophic forgetting — when trained on a new task, they rapidly forget old ones. Continual Learning aims to solve this, enabling models that adapt to new data without losing past knowledge.

Key Strategies

Regularisation-based (EWC, SI): penalise changes to important weights.
Replay-based (Experience Replay, DGR): retain a memory buffer of past samples.
Architecture-based (PNN, PackNet): allocate separate network capacity per task.

Application to Smart Environments

In smart buildings, occupancy patterns change seasonally. A continual learning approach lets the forecasting model adapt to summer patterns without forgetting winter behaviour.