← Paper Digest

Ferrofluid Shape Control with Deep Reinforcement Learning

Anthony Czubarow, Antonio Terpin, Raffaello D'Andrea

November 2026

TL;DR A DreamerV3 policy trained only on the physical setup drives a single fixed electromagnet from camera images to push a drop of ferrofluid through brief target shapes such as triangles, asterisks and pentominoes. Across 20 targets the mean episode score rises from 0.581 untrained to 0.760, and the I pentomino is reached in 150 of 150 evaluation episodes.

What they do

Ferrofluid deforms under magnetic fields, which makes it a candidate body for soft robots, but its continuum dynamics are hard to model. Instead of holding equilibrium shapes with an array of magnets, this work uses one fixed electromagnet and learns to exploit the fluid’s motion to reach target silhouettes that it cannot hold at rest. All learning happens on the physical platform.

How it works

  • Platform. 5 mL of ferrofluid in a water-filled glass jar sits about 2 mm above an electromagnet, with a global-shutter camera overhead. A Teensy microcontroller regulates the coil current at 1 kHz, and the image-based loop runs at 55 Hz.
  • Learning. DreamerV3 trains one policy per target. It sees 64×64 grayscale images and outputs a single current command between 0 and 0.5 A. An 8 s pulse at 0.8 A merges the fluid into one drop before each episode.
  • Reward. IoU between the fluid mask and the target, after aligning position, rotation and scale. The reward pays only when the best 7-frame average IoU in the episode improves, so a brief visit to the shape counts.

Results

  • 20 targets (4 polygons, 4 asterisks, 12 pentominoes), three seeds each: all 60 trained policies beat the untrained policy’s mean return for their target, and the mean return rises from 0.581 to 0.760 (+30.7%).
  • No untrained evaluation episode reached the IoU thresholds. Final policies reach the triangle in 122/150 episodes, the three-ray asterisk in 98/150 and the I pentomino in 150/150.
  • During training, triangle crossings rise from 30/150 to 149/150 episodes between the first and last 50 episodes per seed, and the mean time to reach it falls from 4.19 to 1.17 s.

Limitations

The shapes are transient: near-peak frames last 0.07 to 0.34 s. The pentagon, hexagon and five-ray asterisk never reach their thresholds in evaluation, and P, N and W pentominoes come out with merged limbs. IoU misses corners and branch structure, and each target needs its own policy.

Figures

From Figure 5: DreamerV3 applied to ferrofluid shaping. Recorded images, actions and rewards train a world model, and...
From Figure 5: DreamerV3 applied to ferrofluid shaping. Recorded images, actions and rewards train a world model, and the policy trains on imagined interaction with it; the physical control loop runs at 55 Hz and receives new policy weights before each episode.
From Figure 3: Cutaway of the apparatus: the jar of ferrofluid and water rests above the electromagnet, with its cent...
From Figure 3: Cutaway of the apparatus: the jar of ferrofluid and water rests above the electromagnet, with its central pole and annular winding, and a heat sink sits below the magnet.
From Figure 9: Three- to six-ray asterisk targets with example ferrofluid images, episode return and time to first re...
From Figure 9: Three- to six-ray asterisk targets with example ferrofluid images, episode return and time to first reach the target over training, for policies trained for 100,000 steps.
From Figure 10: Pentomino targets F, I, L, N, P and T with example ferrofluid images, episode return and time to firs...
From Figure 10: Pentomino targets F, I, L, N, P and T with example ferrofluid images, episode return and time to first reach the target over training, for policies trained for 300,000 steps.
Abstract

Ferrofluids are liquids containing magnetic nanoparticles, enabling shape control through external magnetic fields. This deformability supports their use as soft robotic bodies that can navigate confined spaces and manipulate objects. Their nonlinear continuum dynamics, however, make reliable control challenging. Existing work shows how spatial magnetic fields from electromagnet arrays can establish and maintain desired ferrofluid configurations. A complementary objective is to exploit the fluid's dynamics under limited actuation to reach prescribed shapes that may not be sustainable at equilibrium. Here, we use deep model-based reinforcement learning to control these transient shapes. Learning directly through physical interaction, our policies select current commands for a single fixed electromagnet based on visual observations, guiding the moving ferrofluid toward prescribed geometries. The learned policies repeatedly attain a variety of shapes spanning polygons, asterisks and pentominoes. These results demonstrate that learning directly from physical interaction enables reliable fluid shaping, opening new possibilities for controlling ferrofluid-based soft robots.

Summaries are written automatically from each paper's text. Figures and videos come from the paper and its project page; all credit goes to the authors.