TinyNav: End-to-End Autonomous Driving on a $20 Microcontroller
TinyNav, a project by students at Queen's University, shows that a tiny ESP32 microcontroller can drive a small robot autonomously through a track — no GPU, no SLAM, no cloud. The core insight comes from optical flow: nearby objects produce fast-moving image features while distant ones move slowly, so a sequence of frames carries depth and motion information without explicit 3D reconstruction.
Hardware
- MCU: Waveshare ESP32-P4-WIFI6-M — dual-core 360 MHz, 32 MB PSRAM, 768 KB cache (~$20)
- Sensor: Sipeed MaixSense A010 Time-of-Flight camera, which emits modulated IR pulses and measures per-pixel return time to output a depth map directly
- Raw 100x100 resolution is 4x4-binned on the sensor to 25x25, then resized to 24x24
- Steering head: output in [-1, 1]
- Throttle head: output in [0, 1]
- Steering accuracy retained: 99.84%
- Throttle accuracy retained: 99.79%
- Inference on a 20-frame window: ~30 ms — real-time capable
- Predicted steering/throttle correlate with ground truth at ~0.6 — respectable for 23k parameters
- Distribution plots cover the full decision range (no lazy zero-steering outputs)
- Grad-CAM shows the steering head attends to upper wall-top edges; the throttle head focuses on approaching walls and slows in dead ends
- 40 consecutive collision-free laps on the training track; new layouts completed with only occasional light scrapes
- ~50k parameters is roughly the ESP32 ceiling — complex scenes are out of reach
- Training data comes only from low-wall indoor tracks; chairs, people, stairs, and outdoor lighting are unseen
- No wheel encoders or odometry — pure vision accumulates drift
- Forward driving only; reverse dynamics are untrained
ToF depth input avoids the 2D-to-3D ambiguity of RGB: instead of a gray wall, the model sees "obstacle at 1.2 m."
Data Collection
Rather than simulation, the team built a physical track with movable walls (varying widths, curves, dead ends), teleoperated the car lap after lap, and recorded depth frames paired with human steering/throttle commands. Horizontal flipping augmented the data; a 60/40 train/test split produced the final image-action dataset.
Model: 23k Parameters of Spatiotemporal Magic
LSTMs and 3D convolutions aren't feasible on ESP32, so TinyNav stacks 20 consecutive depth frames as channels into a 24x24x20 tensor and processes it with a plain 2D CNN, which implicitly captures motion. The network uses a few conv/pooling layers and two parallel fully-connected heads:
Total: 23,000 parameters — end-to-end learning straight from sensor to actuators.
INT8 Quantization
Post-training quantization with TensorFlow Lite Micro converts weights to 8-bit integers:

Dual-Core Pipeline
One ESP32 core runs CNN inference; the other handles sensor capture and motor commands, communicating through shared memory. A slightly slow inference never blocks the control loop.
Validation


Honest Limitations
References
1. R. David et al., "Tensorflow lite micro: Embedded machine learning on tinyml systems," arXiv preprint arXiv:2010.08678, 2021. 2. Espressif Systems, "Esp-nn: Optimised neural network functions for espressif chipsets," GitHub repository, 2026. 3. A. G. Howard et al., "Mobilenets: Efficient convolutional neural networks for mobile vision applications," arXiv preprint arXiv:1704.04861, 2017. 4. M. Sandler et al., "Inverted residuals and linear bottlenecks: Mobile networks for classification, detection and segmentation," arXiv preprint arXiv:1801.04381, 2018. 5. R. R. Selvaraju et al., "Grad-cam: Visual explanations from deep networks via gradient-based localization," arXiv preprint arXiv:1610.02391, 2016.