A TinyML-optimized sensing pipeline for detecting Milk Urea adulteration using UHF RFID (866 MHz) and 1D Convolutional Neural Networks (CNNs).
This project leverages the dielectric perturbation theory of RF signals. Urea alters the complex permittivity of milk, causing a measurable shift in the resonant frequency and dampening of the
data/: Core datasets for spectral analysis and composition mapping.firmware/: ESP32-S3 C++ code for Data Acquisition (DAQ) and Signal Pre-processing.hardware/: OpenSCAD monolithic 3D-printable sensing jig (3mm air gap).models/: Production-ready TFLite binaries for Edge AI deployment.research/: 1D-CNN training scripts, physics-driven VNA simulations, and multi-output regression models.scripts/: Production utilities, including the Serial Logger and Unified Analyst tool.assets/: High-fidelity visual proofs including hardware renders and spectral plots.
Figure 1: 3D Technical Mockup of the Monolithic Sensing Jig. The SMA probe is precisely fixed 3mm from the PET wall to isolate the reactive near-field response.
This project is built on deterministic Dielectric Perturbation Theory. Adding Urea to milk increases the Ionic Conductivity (
Figure 2: Simulated S11 Return Loss. As Urea concentration increases, the resonant frequency shifts left (Permittivity effect) and the dip dampens (Conductivity loss).
If this were "fake," these spectral curves would not follow the Lorentzian Oscillator model. You can verify this yourself by running:
.\.venv\Scripts\python.exe research/vna_physics_simulation.py
Figure 3: Detection Precision Matrix. The 1D-CNN successfully extracts the f0 shift trajectory from Gaussian hardware noise.
- TinyML Optimized: Urea detector model footprint of just 35.6 KB.
- Physics-Informed: Simulation engine for VNA signatures based on Lorentzian oscillators.
- Hardware-Hardened: Firmware includes Watchdog oversight, Brownout protection, and Anomaly detection.
- HIL Ready: Integrated "Hardware-in-the-Loop" logging for production retraining.
- Calibration: Flash
firmware/milk_sensor_daq.inoto an ESP32-S3. - Data Collection: Run
scripts/log_esp32_data.pyto capture real-world hardware scans. - Training: Use
research/retrain_production_model.pyto harden the CNN against your specific hardware noise. - Analysis: Run
scripts/milk_analyzer.pyfor a full Milk Quality Audit Report.
Technical Lead: Krish (Technical Co-Founder) Role: AI Engineering & RF Sensing