Indoor occupancy detection is a key enabling technology for energy-efficient smart building management, as heating, ventilation, air conditioning, and lighting systems waste significant energy when conditioned spaces are unoccupied. This paper implements a compact Convolutional Neural Network (CNN) trained on the UCI Occupancy Detection Dataset and deployed entirely on the ESP32-S3 microcontroller using TensorFlow Lite Micro with INT8 post-training quantization, eliminating any cloud dependency. Models are trained under a leakage-controlled protocol on the designated training file, selected on the first test file, and evaluated on the held-out second test file; the INT8 quantizer is calibrated from an evenly spaced spread of training windows to avoid class bias. Twelve configurations spanning four filter capacities, (F₁,F₂) ∈ {(4,8),(8,16),(16,32),(32,64)}, and three temporal window lengths, W ∈ {15,30,60} minutes, are quantized, flashed, and measured on the device for tensor arena, flash footprint, inference latency, and held-out F1. All twelve configurations execute successfully: the best compact model, CNN(8,16) at fifteen-minute window, reaches a held-out F1 of 0.959 using 4.2 KB of tensor arena and 1.24 ms per inference, with more than 320 KB of heap remaining free; the tensor arena across the full grid stays between 2.6 and 30 KB; and INT8 quantization changes F1 by at most ±0.021 relative to the floating-point baseline. These results demonstrate that on-device CNN occupancy detection is practical on low-cost microcontroller, that a compact two-block architecture is sufficient to reach near-optimal accuracy, and that the full pipeline from leak-free training through representative INT8 calibration to on-device measurement is reproducible.
Copyrights © 2026