1 of 58

AI & ML for IoT Systems

1

2 of 58

Why AI + IoT Now

2

Billions of connected sensors

Cheap compute at the edge

Real-time decisions are expected

AI turns raw telemetry into value

3 of 58

IoT Stack Overview

3

Perception layer: sensors, actuators

Network layer: connectivity + routing

Application layer: analytics, automation, AI

Feedback/control loop

4 of 58

From Raw Signals to Usable Data

4

Sampling rate & Nyquist

Quantization and compression

Denoising, normalization

Time sync across devices

5 of 58

Control and Actuation Loops

5

Sense → infer → act

Closed-loop autonomy (e.g. smart HVAC)

Latency budgets: ms vs seconds

Safety and fail-safes

6 of 58

Feature Engineering for Sensor Data

  • Windowing (fixed, sliding, adaptive)
  • Stats: mean, variance, kurtosis
  • Frequency domain: FFT, spectrograms
  • Domain features: vibration signatures

6

7 of 58

Why ML in IoT?

  • Predictive maintenance
  • Anomaly detection in industrial systems
  • Activity / gesture recognition
  • Occupancy-aware energy optimization
  • Autonomous navigation / robotics

7

8 of 58

Edge vs Cloud vs Hybrid

8

Edge: instant response, local context

Cloud: heavy analytics, global context

Hybrid: edge pre-filter + cloud refinement

Cascade inference patterns

9 of 58

What is Tiny Machine Learning (TinyML)?

9

TinyML

Fastest-growing field of ML

Algorithms, hardware, software

Low power consumption

On-device sensor analytics

Always-on ML

Battery-operated

10 of 58

Why Edge Intelligence?

  • Privacy: data stays local
  • Low latency: sub-100 ms actuation
  • Reliability offline / flaky network
  • Bandwidth savings: send insights, not raw video

10

11 of 58

Edge Hardware Landscape

11

MCUs (tens of kB RAM)

Single-board computers (Raspberry Pi class)

NPUs / TPUs / accelerators

Battery and thermal limits

12 of 58

TinyML Concepts

12

ML ON ULTRA-LOW-POWER MICROCONTROLLERS

USE CASES: WAKE-WORD, GESTURE, LEAK DETECTION

ALWAYS-ON SENSING UNDER ~1 MW BUDGET

13 of 58

Reference AIoT Architecture

13

Sensor node

Gateway / edge aggregator

Cloud analytics / data lake

Digital twin / dashboard

Human-in-the-loop feedback

14 of 58

EdgeML (P )

14

TinyML (P )

KeyWord Spotting

Motion & biometric

Environmental Control

Image Spot

Image Recognition

Autonomous Car Control

15 of 58

15

16 of 58

16

17 of 58

EdgeML

17

46

Rpi-Pico (Cortex-M0+)

Arduino Nano (Cortex-M4)

Arduino Pro (Cortex-M7)

RaspberryPi SmartPhone (Cortex-A)

Jetson Nano (Cortex-A + GPU)

Object Detection Complex Voice Processing

1 MB+

Image

Classification 250 KB+

KeyWord Spotting Audio Classification 50 KB

Anomaly Detection Sensor Classification 20 KB

Video Classification 2 MB+

Source: Edge Impulse

TinyML

Hardware

18 of 58

Software

18

(TFL Micro)

19 of 58

Example: KeyWord Spotting (KWS)

19

20 of 58

20

Sound

Image

21 of 58

KeyWord Spotting (KWS) - Inference

21

Digital Mic

“Yes”

Obtains an input

16KHz / 16 bits Sample: [1s]

22 of 58

KeyWord Spotting (KWS) - Inference

22

Digital Mic

“Yes”

MFCC

Feature Converter

Obtains an input

Pre-Process

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

23 of 58

KeyWord Spotting (KWS) - Inference

23

Digital Mic

“Yes”

MFCC

Feature Converter

Obtains an input

Pre-Process

Runs model

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

Output Dim [1, 4]

  • Prob ‘Silence’
  • Prob ‘Unknown’
  • Prob ‘Yes’
  • Prob ‘No’

24 of 58

KeyWord Spotting (KWS) - Inference

24

Digital Mic

“Yes”

MFCC

Feature Converter

Obtains an input

Pre-Process

Runs model

Post-Processes

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

Output Dim [1, 4]

  • Prob ‘Silence’
  • Prob ‘Unknown’
  • Prob ‘Yes’
  • Prob ‘No’

If Probability of YES is greater than 80% Take actions

25 of 58

KeyWord Spotting (KWS) - Inference

25

Digital Mic

“Yes”

MFCC

Feature Converter

Obtains an input

Pre-Process

Runs model

Post-Processes

Make things happen

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

Output Dim [1, 4]

  • Prob ‘Silence’
  • Prob ‘Unknown’
  • Prob ‘Yes’
  • Prob ‘No’

If Probability of YES is greater than 80% Take actions

26 of 58

KeyWord Spotting (KWS) - Model

26

Digital Mic

“Yes

MFCC

Feature Converter

Obtains an input

Pre-Process

Runs model

postprocesses

Make things happen

16KHz / 16

bits

Sample: [1s]

Output:

Image

[49, 40, 1]

Output Dim [1, 4]

  • Prob ‘Silence’
  • Prob ‘Unknown’
  • Prob ‘Yes’
  • Prob ‘No’

If Probability of YES is greater than 80%

Take actions

27 of 58

KeyWord Spotting (KWS) – Create Model (Training)

27

Digital Mic

MFCC

Feature Converter

Obtains data

Pre-Process

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

28 of 58

KeyWord Spotting (KWS) – Create Model (Training)

28

Digital Mic

MFCC

Feature Converter

Obtains data

Pre-Process

Train model

Evaluate Model

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

29 of 58

KeyWord Spotting (KWS) – Create Model (Training)

29

Digital Mic

MFCC

Feature Converter

Obtains data

Pre-Process

Train model

Evaluate Model

Deploy

16KHz / 16 bits Sample: [1s]

Output: Image [49, 40, 1]

30 of 58

Supervised Learning Refresher

  • Regression vs classification
  • Temporal train/val/test splits matter
  • Labeling is expensive and noisy
  • Concept drift over time

30

31 of 58

Supervised Learning

  • Majority of practical ML uses supervised learning
  • Mapping function approximated from past experience
    • Regression f(x)=y, y is a real number
    • Classification f(x)=y, y is a category label
  • Training
    • Labeled positive and negative examples
    • From unseen input predict corresponding output
    • Learning until acceptable performance is achieved

31

32 of 58

Unsupervised & Self-Supervised IoT

32

Clustering for behavior patterns

Autoencoders for anomaly detection

Contrastive learning on time windows

Few/zero-label environments

33 of 58

Unsupervised Learning

  • Discover hidden relations and learn about the data
    • Clustering f(X) = [X1, …, Xk], k disjoint subsets
    • Association f(Xi, Xj) = R, relation
  • Training
    • All examples are positive
    • No labeling, no teacher
    • No single correct answer
  • Practical usage
    • Derive groups, not explicitly labeled
    • Market basket analysis (association among items)

33

34 of 58

Time Series Modeling Approaches

34

Classical: ARIMA, Kalman filters

ML: Random Forests on engineered windows

Deep: RNN / LSTM / GRU / 1D CNN

Transformers for long context

35 of 58

Activity Recognition Example

  • Input: accelerometer / gyroscope
  • Sliding window segmentation
  • Feature extraction vs end-to-end deep model
  • Output: walk / run / fall / idle
  • Use case: elder fall detection

35

36 of 58

Predictive Maintenance Example

  • Vibration + temperature from motors
  • Estimate Remaining Useful Life (RUL)
  • Early fault signatures are subtle
  • Class imbalance: failures are ~0.1%
  • Metric: precision at very low false alarms

36

37 of 58

Anomaly Detection in IoT

  • Why anomalies matter: safety, cost, security
  • Thresholding simple stats
  • Isolation Forest / density methods
  • Autoencoder reconstruction error
  • Online streaming anomaly scores

37

38 of 58

Computer Vision in IoT

  • Smart cameras: traffic, quality inspection
  • Object detection, pose estimation
  • PPE compliance / safety zones
  • Privacy: blur faces, process on-device

38

39 of 58

Multimodal Sensor Fusion

  • Fusing IMU + camera + GPS + audio
  • Early fusion vs late fusion
  • Attention-based fusion architectures
  • Robustness if one sensor drops

39

40 of 58

ML Decision Tree

40

41 of 58

Diagnose Steps (part 1)

1. Is it a ML task? Are you sure ML is the best solution?

    • Hard: X is independent of Y: X<name, age, income>, Y = height
    • Easy: X is a set with limited variations. Configure Y = F(X)

2. Appropriate ML scenario?

    • Supervised learningclassification, regression, anomaly detection)
    • Unsupervised learning (clustering, pattern learning)

3. Appropriate model?

    • Data size (small data -> linear model, large data -> consider nonlinear)
    • Sparse data (require normalization to perform better)
    • Imbalanced data (special treatment of the minority class required)
    • Data quality (noise and missing values require loss function)

4. Enough training data?

    • Investigate how precision improves with more data

41

42 of 58

Diagnose Steps (part 2)

5. Model overly complicated?

    • Start simple first, increase complexity and evaluate performance
    • Avoid overfitting to training set

6. Feature quality

    • Have you identified all useful features?
    • Use domain knowledge of an expert to start
    • Include any feature that could be found and investigate model performance

7. Feature engineering

    • The best strategy to improve performance and reveal important input
    • Encode features, normalize [0:1], combine features

8. Combine models

    • If multiple models have similar performance there is a chance of improvement
    • Use one model for one subset of data and another model for the other

42

43 of 58

Diagnose Steps (part 3)

9. Model validation

    • Use appropriate performance indicator (accuracy, precision, recall, F1, etc.)
    • How well does the model describe data? (AUC)
    • Data typically divide into Training and Validation
    • Evaluate accuracy on disjoint dataset (other than training dataset)
    • Tune model hyper parameters (i.e. number of iterations)

43

44 of 58

Types of Algorithms

  • Linear Algorithms
    • Classification – classes separated by straight line
    • Support Vector Machine – wide gap instead of line
    • Regression – linear relation between variables and label
  • Non-Linear Algorithms
    • Decision Trees and Jungles – divide space into regions
    • Neural Networks – complex and irregular boundaries
  • Special Algorithms
    • Ordinal Regression – ranked values (i.e. race)
    • Poisson – discrete distribution (i.e. count of events)
    • Bayesian – normal distribution of errors (bell curve)

44

45 of 58

Model Performance (Classification)

  • Binary classification outcomes {positive; negative}
  • ROC curve
    • TP Rate = True Positives / All Positives
    • FP Rate = False Positives / All Negatives
  • Example:

  • AUC (Area Under Curve)
    • KPI for model performance and comparison
    • 0.5 = random prediction, 1 = perfect match
  • For Multiclass – average from all RoC curves

45

46 of 58

Threshold Selection (Binary)

  • Probability Threshold
    • Cost of one error could be much higher than cost of other
    • E.g. spam filter – it is more expensive to miss a real mail
  • Accuracy
    • For symmetric 50/50 data
  • Precision
    • E.g. 1000 devices, 5 fails, 8 predicted, 4 true failures
    • Correct positives (e.g. 4/8 = 0.5, FP are expensive)
  • Recall
    • Correctly predicted positives (e.g. 4/5=0.8, FN are expensive)
  • F1(balanced error cost)
    • Balanced cost of Precision/Recall

46

47 of 58

Model Performance (Regression)

  • Coefficient of Determination (R2)
    • Single numeric KPI – how well data fits model
    • R2 > 0.6 – good, R2 > 0.8 – very good, R2 = 1 – perfect
  • Mean Absoute Error (MAE) / Root Mean Squared Error
    • Deviation of estimates from observed real values
    • Compare model errors measure in the SAME units
  • Relative Absolute Error Relative Squared Error
    • % deviation from real value
    • Compare model errors measure in the DIFFERENT units

47

48 of 58

Evaluation Metrics for IoT ML

  • Latency (ms)
  • Power draw (mW)
  • Model size / memory footprint
  • False alarm vs miss cost
  • Closed-loop control stability

48

49 of 58

Model Compression Techniques

  • Quantization (8-bit, 4-bit)
  • Pruning weights / neurons
  • Knowledge distillation
  • Neural architecture search for low FLOPs

49

50 of 58

On-Device Inference Pipeline

  • Capture → preprocess → inference → decision
  • Memory budgeting for buffers + weights
  • Real-time scheduling with firmware tasks
  • Interrupt-driven ML (e.g. wake word)

50

51 of 58

Federated Learning for IoT

  • Devices train locally on private data
  • Only model updates are shared
  • Benefits: personalization + privacy
  • Challenges: non-IID data, stragglers

51

52 of 58

Digital Twins

  • Virtual replica of a physical asset
  • Live sync with sensor data
  • Simulate 'what if' scenarios
  • Uses: predictive maintenance, optimization

52

53 of 58

Privacy & Responsible AI in IoT

  • Always-on sensing = surveillance risk
  • Behavior inference from 'harmless' signals
  • Data minimization and edge filtering
  • Transparency + consent for end users

53

54 of 58

Regulatory & Compliance

  • Safety standards for industrial monitoring
  • Data protection (GDPR-style thinking)
  • AI accountability + audit trails
  • Explainability for automated decisions

54

55 of 58

LLMs + IoT

  • Natural language interfaces ('Why did the alarm trigger?')
  • Edge copilots for technicians
  • Summarizing fleets of sensor logs
  • Risk: hallucination in safety-critical loops

55

56 of 58

Energy-Aware Intelligence

56

Adaptive sampling / duty cycling

Battery-aware model selection

Green AI: minimize inference carbon cost

Sustainability as design constraint

57 of 58

Edge Swarms & Collective Intelligence

57

Many small devices collaborating locally

Gossip instead of central cloud

Distributed anomaly detection

Use cases: env monitoring, precision agriculture

58 of 58

Where This Field Is Going

58

Every sensor becomes intelligent

Every decision must be explainable

AI/ML is the differentiator in IoT

Your job: design systems that are smart, safe, and trustworthy