Skip to content

Repository files navigation

FastFluid

Realtime fluid simulation for embedded microcontrollers driving LEDs.

Running Navier–Stokes on hardware that has absolutely no business doing this.

FastFluid turns LED installations into living dynamic systems instead of playback devices.

Designed for:

  • 2D LED matrices
  • art installations
  • Burning Man projects
  • realtime procedural LED visuals
  • generative LED animations
  • future integration into FastLED

What Is This?

FastFluid is an experimental realtime fluid simulation engine for microcontrollers like the ESP32 and Teensy-class hardware, built specifically for LED rendering.

This is not a pre-rendered animation.

This is not noise pretending to be fluid.

This is not a cellular automaton fake-fire effect.

Every frame is generated from a live evolving velocity-field simulation running in realtime on the microcontroller itself.

The simulation includes:

  • advection
  • diffusion
  • pressure solving
  • buoyancy
  • vorticity confinement
  • obstacle interaction
  • realtime force injection

The goal is simple:

Make physically-inspired realtime visuals accessible on hardware that has no business running them.

Why?

Modern GPUs normalized realtime procedural graphics.

ShaderToy, Winamp MilkDrop, realtime smoke sims, procedural fire, generative visuals — all of that became standard on desktop hardware.

Microcontrollers never really got that evolution.

Most LED effects are still based on:

  • palettes
  • noise fields
  • cellular automata
  • repetitive animations
  • fake fire

FastFluid tries to bring actual realtime fluid dynamics into embedded LED art.

Not scientifically accurate CFD.

Not a physics benchmark.

Just enough physics to create visuals that feel deeply alive.

Why It Looks Alive

FastFluid is interesting not because it simulates fluids “accurately”.

It is interesting because systems based on differential equations like Navier–Stokes naturally produce emergent behavior.

Tiny local interactions accumulate into larger evolving structures:

  • vortices
  • turbulence
  • flowing motion
  • self-organizing patterns
  • chaotic but coherent dynamics

The simulation constantly rides the edge between order and chaos.

That is where much of the visual beauty comes from.

You are not animating pixels directly.

You are shaping a dynamic system and watching complex motion emerge from simple mathematical rules in realtime.

That is the real magic behind FastFluid.

Why This Is Difficult

Fluid simulation is computationally expensive.

Microcontrollers have:

  • tiny caches
  • limited RAM
  • low memory bandwidth
  • no desktop-class GPU
  • tight realtime timing constraints for LED output

FastFluid exists because the simulation model is aggressively simplified, optimized, and artistically tuned specifically for embedded hardware.

The challenge is not scientific accuracy.

The challenge is achieving visually convincing emergent motion within extremely constrained hardware budgets.

Current Capabilities

  • ESP32-S3
  • ESP32-P4
  • Teensy 4.x

Rendering through:

  • FastLED
  • WS2812 / NeoPixel
  • APA102
  • LED matrices
  • HUB75 panels
  • LED strips
  • basically anything FastLED can drive

Current performance:

  • ~30 FPS @ 64×48 = 3072 WS2812 LEDs on an ESP32-P4

Optimization work is ongoing:

  • SIMD
  • cache-aware layouts
  • reduced memory bandwidth
  • optional fixed-point paths for slower MCUs

Features

  • Realtime Navier–Stokes-inspired simulation
  • Smoke simulation
  • Stylized fluid rendering
  • Generic velocity fields
  • Interactive force injection
  • Artistic rather than scientific tuning
  • Designed for low-memory embedded systems
  • Portable architecture
  • Future FastLED integration planned

Philosophy

FastFluid is not trying to compete with desktop CFD solvers.

The target is:

  • visually convincing motion
  • emergent behavior
  • realtime interaction
  • low-latency LED rendering
  • procedural visuals for physical spaces

This project lives somewhere between:

  • decorative LED effects
  • demo-scene coding
  • generative art
  • realtime simulation
  • LED installation culture

Dual-Target Architecture

FastFluid can currently run on two different ESP32 platforms from a single shared codebase:

Target Board LED Driver BLE Build
ESP32-S3 Seeed XIAO ESP32S3 RMT On-chip VSCode PlatformIO
ESP32-P4 ESP32-P4-WIFI6 (Waveshare) PARLIO ESP32-C6 via ESP-Hosted VHCI over SDIO CLI

How It Works

  • #if __has_include("hosted_ble_bridge.h") → ESP-Hosted BLE init (P4 only)
  • #if defined(CONFIG_IDF_TARGET_ESP32S3) → S3-specific serial config
  • src/board_config.h → pin assignments, matrix dimensions, LED driver selection

Key Files

FilePurpose
platformio.iniESP32-S3 configuration
platformio_p4.iniESP32-P4 configuration
sdkconfig.defaultsESP-IDF settings
src/boardConfig.hHardware abstraction layer
src/bleControl.hNimBLE transport and callbacks
src/hosted_ble_bridge.cpp/.hP4-specific BLE initialization

Building

ESP32-S3

Use the standard PlatformIO build/upload buttons inside VSCode.

ESP32-P4

$env:PLATFORMIO_PROJECT_CONF="platformio_p4.ini"
C:/Users/Jeff/.platformio/penv/Scripts/pio.exe run -c platformio_p4.ini -t upload

Credits

FastFluid is a collaboration between:

Stefan Petrick

  • model design
  • artistic direction
  • Python prototyping
  • distilling fluid simulation models down to the absolute minimum needed for convincing realtime visuals on embedded hardware

Jeff Holman

  • C++ implementation
  • optimization
  • embedded architecture
  • making the whole thing actually run on microcontrollers

Our numeric solver model is heavily inspired by Jos Stam’s paper:

Stable Fluids (1999)

The simulation model is typically explored and tuned first in Python, then ported and heavily optimized for realtime embedded execution.

Media

First realtime fluid experiments

(put GIF/video here)

Fire simulation progress

(put GIF/video here)

Velocity field visualization

(put GIF/video here)

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages