State persistence
Power goes out? Hit the e-stop? The FluidBoard remembers your offsets, your tools and where the job was.
A dedicated persistence chip saves your machine state in real time — not to flash memory that wears out, but to a chip designed for practically unlimited writes. Your state is saved roughly 10 times per second, so even a sudden power loss won't set you back.
Why this matters
On most controllers, hitting the e-stop means re-homing, re-zeroing your work offset, re-measuring your tools, and hoping you can pick up where you left off. With the FluidBoard you still re-home after an e-stop, but that's all: your work offsets, tool offsets and G-code state are still there, so you don't re-measure anything.
Why re-home at all? An e-stop doesn't decelerate the machine the normal way; it stops the step pulses at once. A moving axis carries on for a little while under its own momentum, so the position the board last commanded is no longer exactly where the axis is. Homing puts the machine back on its reference, and because the work offsets are stored relative to that reference, they are valid again straight away.
After a normal power-off with the machine at rest, nothing moved, and the board comes back up knowing where it is without homing.
This is especially valuable on lathes, where losing your tool offsets mid-job can mean scrapping the workpiece. And it means you're never punished for using the e-stop — which is exactly how it should be. Safety features should feel safe to use.
Why FRAM
Without persistence, the controller only knows its position because it counts every step it sends to the motors. That count lives in RAM, and RAM is wiped the moment power drops. On power-up the controller has no idea where the axes are, which is why you normally have to home.
Flash or EEPROM are a poor fit for this. They're typically rated for ten thousand to a million write cycles, so writing ten times per second would wear out a flash sector within days. Flash also has to erase a whole block before writing, which takes milliseconds.
FRAM (ferroelectric RAM) doesn't have these problems. It's non-volatile like flash, so data survives without power, but it writes at the speed of the bus with no erase step, and it's rated for trillions of write cycles. At ten saves per second that is far beyond the life of any machine.
What is saved
- Machine position on all axes — no re-homing needed after a normal power-off at rest
- Homing status — the board knows which axes were already homed
- Work offsets and coordinate systems
- Feed rate, spindle speed, and all active G-code states
- Feed, rapid, and spindle overrides
- Current tool and turret position
- G-code variables (# parameters)
Because the tool table and the turret position are part of this, a lathe with an automatic tool changer comes back up knowing which tool is in the cutting position.
What persistence can't know
The board saves the position it commanded. It has no way to measure where the axes physically are. Those two are the same as long as nothing moved without the board knowing. That is not the case if:
- The motors lost holding torque while the power was off and gravity or a cutting load moved an axis. A Z axis without a brake or counterbalance is the usual suspect.
- Someone turned a handwheel or pushed an axis by hand while the machine was off.
- An axis stalled or crashed and lost steps before the power went out.
- The e-stop was hit, or the power went out, while an axis was moving. The step pulses stop at once and the axis carries on under its own momentum.
In any of these cases, re-home before you continue. When in doubt, re-home: it takes a minute, a crash takes much longer to fix.
Resuming after a power loss or e-stop
- Find out why it stopped, and fix that first.
- Check the tool and the workpiece. Is the tool intact? Is the workpiece still clamped where it was? A broken tool means a new tool length, and the stored offset no longer applies.
- Clear the tool from the work if it stopped in the cut. Jog it out along a safe direction before starting the spindle.
- Re-home, after an e-stop always. Then verify the position: jog to a reference you can check by eye, such as your work zero or the edge of the stock, and confirm the machine is where the display says it is.
- Restart from a safe point. Start the spindle, and restart the job a little before the point where it stopped, so the tool enters the cut the way the program intended.
Configuration
State persistence is enabled by default. If you change your machine configuration (for example, adding an axis or changing motor assignments), the board detects this automatically and asks you to re-home once. After that, persistence resumes.
state_persistence:
cs_pin: gpio.5
save_interval_ms: 100
spi_freq_mhz: 20
save_parameters: true
cs_pin — how the FRAM chip is wired on the board. Leave this as shown.
save_interval_ms — how often the state is saved, in milliseconds. 100 ms is the "about 10 times per second" mentioned above.
spi_freq_mhz — the speed of the connection between the ESP32 and the FRAM chip
save_parameters — whether the G-code # parameters are saved as well
Persistence keeps your position accurate as long as the axes didn't move while the board wasn't driving them. Always re-home after an e-stop. After a power loss there is no holding torque at all, so axes that can move under their own weight need checking. If an axis may have moved or was bumped by hand, you should re-home.