A real‑time FLIP fluid simulation for a 2‑inch round LED pocket watch.
- Claude helped develop an html for being able to see the simulation and make live updates in a browser.
- Personally developed the javascript code to be ran in the html, next is to translate the javascript to c++ code to be ran on an ESP32.
- The plan is to have the physics designed to port cleanly to an ESP32-C3 Super Mini driving a circular addressable‑LED matrix.
No build step. learn/led-matrix-10.html loads the solver from src/sim.js and the harness from src/engine.js.
- Quickest: open
learn/led-matrix-10.htmlin a browser. - With live‑reload while editing: run
npx live-serverfrom the repo root (so thesrc/scripts resolve), then open/learn/led-matrix-10.html.
It's a FLIP (Fluid‑Implicit‑Particle) solver:
- P2G — splat particle velocities onto a grid.
- Forces — add gravity (in the direction the watch is tilted).
- G2P — read velocities back to the particles (FLIP/PIC blend).
- Advect — move the particles; bounce them off the circular wall.
- Push‑apart + cohesion — keep particles from overlapping, and let droplets ball up and break off (surface tension).
To learn, I had Claude help develop an explanation of flip fluids that are fit for my needs in learn/physics-and-code.html.
- MCU: ESP32 (hardware FPU, dual‑core, plenty of RAM)
- Display: circular addressable‑LED matrix, ~10–24 across in a 2″ circle
- Tilt: an accelerometer/IMU (its gravity vector feeds the sim's
gravityDirdirectly) - Board: custom round PCB (KiCad project in
pcb/)
Working on C++ code now to put on ESP32.
Idea credit fully given to mitxela. First given the idea from his video here.