HomeElectronics NewsESP32 Pocket Aquarium Runs Its Own Tiny AI Brain

ESP32 Pocket Aquarium Runs Its Own Tiny AI Brain

A compact 14.3-million-parameter language model runs locally on an ESP32 board, giving virtual fish autonomous behaviours such as eating, hiding, and playing without an internet connection.

Pocket Tank interface showing a fish status panel with hunger, energy and stress bars beside two pixel-art fish swimming among plants
Pocket Tank’s status panel tracks each fish’s hunger, energy and stress. (Image: StratoBuilds / GitHub)

A palm-sized ESP32 board can run a virtual aquarium where a compact AI model controls the behaviour of digital fish, called Pocket Tank. The project brings the virtual-pet concept of the 1990s to a modern microcontroller, with its language model running entirely on the device without cloud services or an internet connection.

The aquarium runs on a 1.8-inch touchscreen, where fish progress from juvenile to elder stages while responding to hunger, energy, stress and interaction. Users can feed the fish, clean the virtual glass and trim plants. The project demonstrates how local AI workloads can be fitted onto a low-cost microcontroller platform.

The hardware uses the Waveshare ESP32-S3-Touch-AMOLED-1.8, featuring an ESP32-S3R8, 8 MB PSRAM, 16 MB flash and a 368 × 448 AMOLED touchscreen. Waveshare lists the board at US$27.99, or US$29.99 with a lithium battery. A 3.7 V lithium-polymer cell with an MX1.25 connector is optional for portable operation. A USB Type-C data cable is required for flashing and charging, while an enclosure is optional. A computer running Chrome or Edge is enough for the browser-based installation.

At the centre is a 14.3-million-parameter transformer with eight layers, 384-dimensional embeddings and eight attention heads. It was created using knowledge distillation, where a 26-billion-parameter gemma4:26b teacher model generated decisions for 51,613 fish situations and the smaller model learnt to reproduce them. The student model has roughly 1,818 times fewer parameters than its teacher.

Every few seconds, each fish describes its situation using factors such as hunger, energy, stress, nearby fish, personality, trust and boredom. The model selects a goal such as seeking food, following a friend, inspecting the reef, visiting bubbles, exploring, resting or playing. A separate reflex layer converts that decision into swimming and other movement at 25–30 frames per second. The builder says no hand-written fallback rules override the model’s selected goal.

Two techniques make the model fit on the ESP32-S3. Four-bit quantisation reduces the model from 57 MB in FP32 to 7.56 MB, while memory-mapping the weights directly from flash avoids copying them into RAM. This allows the board’s 8 MB PSRAM to handle the inference workload. On real hardware, the model generates about 12 tokens per second, with each decision taking roughly 3.7 seconds, while the aquarium continues rendering at 25–30 fps on the other CPU core.

Connect the board to a computer using USB Type-C and open the Pocket Tank web installer in Chrome or Edge. The installer uses ESP Web Tools to flash the firmware and model. Select the serial port and start the installation; the first flash also writes the 7.56 MB model to flash. On first boot, follow the on-screen setup and name the fish. A lithium cell can then be connected to the MX1.25 socket for unplugged operation.

For an advanced build, the source can be compiled using Espressif ESP-IDF v5.4, followed by idf.py build and idf.py flash. The model is written separately using esptool.py write_flash 0x290000 model_q4.bin. A desktop simulator using LVGL 9.2.2 and SDL2 is also available for testing before buying hardware.

The full source is available in the Pocket Tank GitHub repository under the MIT licence. Its inference engine is based on llama2.c, while the interface uses LVGL, also MIT-licensed. The StratoBuilds project page provides photographs and the installer. Community ports exist for ESP32-P4 and M5Stack Tab5 hardware.

Testing outside the training examples showed the student model selecting the same goal as its teacher 72 per cent of the time, while the teacher agreed with its own earlier answers about 82 per cent of the time. The aquarium currently has seven active goals: seek food, follow a friend, inspect the reef, visit bubbles, explore, rest and dart play. The flee_shadow goal remains in the model vocabulary but was removed from the tank in September 2026.

The firmware currently targets the Waveshare board, with other hardware requiring community ports and the Espressif development environment. Battery life has not yet been fully measured. The aquarium supports one fish species, and the touchscreen targets are adjusted for the curved display. The browser installer makes the basic setup accessible to beginners, while retraining the model or porting the firmware requires advanced skills.

The specific Waveshare board is available through Indian distribution, with Hubtronics listing it at Rs 3,099 including GST at the time of writing, although price and stock can change. For engineering students, Pocket Tank provides a compact way to experiment with on-device AI and model distillation. It can also suit school robotics and AI labs as a practical demonstration of how a large model can teach a much smaller model to run locally on constrained hardware.

For more information, click here.

Loading form…
Ananthu Ashok
Ananthu Ashok
Ananthu Ashok is a tech journalist and has a deep interest in embedded systems, open source, IoT, robotics and emerging tech.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics